Class dnx.geom.Point2
All Packages Class Hierarchy This Package Previous Next Index
Class dnx.geom.Point2
java.lang.Object
|
+----dnx.geom.Point2
- public class Point2
- extends Object
- implements Cloneable, Copyable
point in two dimensions; similar to java.awt.Point but with floats.
-
x
-
-
y
-
-
Point2()
- Construct a point at the origin.
-
Point2(double, double)
- Construct a point from the specified double coordinates.
-
Point2(float, float)
- Construct a point from the specified coordinates.
-
Point2(Point2)
- Construct a point from another point.
-
Point2(Vector2)
- Construct a point from a vector pointing to the point.
-
acute(Point2, Point2)
- Examine the angle between the vectors P1->P2 and P2->P3.
-
add(Vector2)
- Add a vector to a point.
-
between(Point2, Point2, Point2)
- Given three rays THIS->P1, AHCHOR->P2, and THIS->P3,
return true if sweeping CCW around THIS from THIS->P1
would hit THIS->P2 before THIS->P3.
-
between1(Point2, Point2, Point2)
- Like between() but assumes that the angle (THIS->P1, THIS->P3)
<= 180 degrees.
-
CCW(Point2, Point2)
- Examine the angle formed by line segments P1->P2 and P2->P3.
-
clear()
-
-
copy(Copyable)
-
-
distanceTo(Point2)
- Return the distance to another point.
-
equals(Object)
-
-
hashCode()
-
-
scale(float)
- Scale a point by the specified amount.
-
setValue(double, double)
- Set the value as specified.
-
setValue(float, float)
- Set the value as specified.
-
subtract(Vector2)
- Subtract a vector from a point.
-
toString()
-
-
translate(float, float)
- Translate a point by the specified amount.
x
public float x
y
public float y
Point2
public Point2()
- Construct a point at the origin.
Point2
public Point2(float x,
float y)
- Construct a point from the specified coordinates.
Point2
public Point2(double x,
double y)
- Construct a point from the specified double coordinates.
Point2
public Point2(Point2 obj)
- Construct a point from another point.
Point2
public Point2(Vector2 obj)
- Construct a point from a vector pointing to the point.
clear
public void clear()
setValue
public void setValue(float x,
float y)
- Set the value as specified.
setValue
public void setValue(double x,
double y)
- Set the value as specified.
distanceTo
public float distanceTo(Point2 p)
- Return the distance to another point.
add
public final void add(Vector2 v)
- Add a vector to a point.
subtract
public final void subtract(Vector2 v)
- Subtract a vector from a point.
translate
public void translate(float x,
float y)
- Translate a point by the specified amount.
scale
public void scale(float sc)
- Scale a point by the specified amount.
equals
public boolean equals(Object obj)
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Overrides:
- hashCode in class Object
copy
public void copy(Copyable o)
toString
public String toString()
- Overrides:
- toString in class Object
CCW
public int CCW(Point2 p2,
Point2 p3)
- Examine the angle formed by line segments P1->P2 and P2->P3.
If this forms a counterclockwise bend, return > 0.
If a clockwise bend, return < 0.
If all three points are collinear, return 0.
This is equivalent to constructing the line that passes through
P1 and P2 and asking which side of this line the point P3 is on.
acute
public int acute(Point2 p2,
Point2 p3)
- Examine the angle between the vectors P1->P2 and P2->P3.
If this is acute (less than 90 degrees), return > 0.
If obtuse, return < 0.
If right or if P2 and P3 are the same point, return 0.
This is analogous to CCW and is equivalent to constructing
the line through P2 that is perpendicular to the line segment
P1->P2 and asking which side of this line the point P3 is on.
between1
public boolean between1(Point2 p1,
Point2 p2,
Point2 p3)
- Like between() but assumes that the angle (THIS->P1, THIS->P3)
<= 180 degrees.
If this is true, a necessary and sufficient condition for THIS->P2
between THIS->P1 and THIS->P3 is that angle (THIS->P1,
THIS->P2) <= 180 degrees and angle (THIS->P2, THIS->P3) <= 180
degrees.
between
public boolean between(Point2 p1,
Point2 p2,
Point2 p3)
- Given three rays THIS->P1, AHCHOR->P2, and THIS->P3,
return true if sweeping CCW around THIS from THIS->P1
would hit THIS->P2 before THIS->P3.
All Packages Class Hierarchy This Package Previous Next Index