public class Point extends Point2D.Float
Point2D.Double, Point2D.Float
x, y
Constructor and Description |
---|
Point(float radians)
Returns a point ad distance 1 from the origin and an angle
radans to the x-axis |
Point(float x,
float y)
returns a Point at location x,y
|
Modifier and Type | Method and Description |
---|---|
Point |
add(Point other)
Returns the vector sum of
this and other |
Point |
addWith(Point other)
Vector addition; add other to
this |
float |
angle()
returns the angle in radians of this point from the origin.
|
float |
angleTo(Point p)
Returns the direction angle from this point to the Point p
|
Point |
clone()
returns a clone of itself
|
Point |
copyTo(Point p) |
float |
dotProduct(Point other)
Returns the inner dot product.
|
Point |
getNormalized()
get a copy of
this with length 1 |
Point |
leftOrth()
calculate left orthogonal vector of
this |
float |
length()
Returns the length of this vector
|
Point |
makeLeftOrth()
Turns this vector into its left-handed cartesian orthagonal
|
Point |
makeRightOrth()
Turns this vector into its right-handed cartesian orthagonal
|
void |
moveTo(Point other)
Makes
this a copy of the other point |
Point |
multiply(float scale)
Scalar multiplication
|
Point |
multiplyBy(float scale)
scalar multiplication
|
Point |
normalize()
Sets this vector's length to 1 unit while retaining direction
|
Point |
pointAt(float distance,
float angle)
Returns a new point at the specified distance in the direction angle from
this point.
|
Point |
projectOn(Line line)
Finds the orthogonal projection of this point onto the line.
|
Point |
reverse()
same as multiply(-1);
|
Point |
rightOrth()
calculate the right handed cartesian orthogonal of this poiont
|
Point |
subtract(float length)
Vector subtraction
|
Point |
subtract(Point other)
Vector subtraction
|
Point |
subtractWith(Point other)
vector subtraction
|
void |
translate(float dx,
float dy)
Translates this point, at location (x, y), by dx along the x axis and
dy along the y axis so that it now represents the point (x + dx, y + dy).
|
getX, getY, setLocation, setLocation, toString
distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, setLocation
public Point(float x, float y)
x
- coordinatey
- coordinatepublic Point(float radians)
radans
to the x-axisradians
- public float angleTo(Point p)
p
- the Point to determine the angle topublic void translate(float dx, float dy)
dx
- dy
- public Point clone()
public Point add(Point other)
this
and otherother
- the point added to this
public Point addWith(Point other)
this
other
- is added to this
this
after the additionpublic void moveTo(Point other)
this
a copy of the other pointother
- public Point subtract(Point other)
other
- is subtracted from this
public Point subtract(float length)
length
- of a copy of this
public Point multiply(float scale)
scale
- multilies the length of this to give a new lengthpublic Point getNormalized()
this
with length 1public Point reverse()
public Point projectOn(Line line)
line
- onto which the projection is madepublic float angle()
public Point leftOrth()
this
public Point rightOrth()
public Point subtractWith(Point other)
other
- is subtracted from this
public Point multiplyBy(float scale)
scale
- public float length()
public Point normalize()
public Point makeLeftOrth()
public Point makeRightOrth()
public float dotProduct(Point other)
public Point pointAt(float distance, float angle)
distance
- the distance to the new pointangle
- the angle to the new point