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.

Variable Index

 o x
 o y

Constructor Index

 o Point2()
Construct a point at the origin.
 o Point2(double, double)
Construct a point from the specified double coordinates.
 o Point2(float, float)
Construct a point from the specified coordinates.
 o Point2(Point2)
Construct a point from another point.
 o Point2(Vector2)
Construct a point from a vector pointing to the point.

Method Index

 o acute(Point2, Point2)
Examine the angle between the vectors P1->P2 and P2->P3.
 o add(Vector2)
Add a vector to a point.
 o 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.
 o between1(Point2, Point2, Point2)
Like between() but assumes that the angle (THIS->P1, THIS->P3) <= 180 degrees.
 o CCW(Point2, Point2)
Examine the angle formed by line segments P1->P2 and P2->P3.
 o clear()
 o copy(Copyable)
 o distanceTo(Point2)
Return the distance to another point.
 o equals(Object)
 o hashCode()
 o scale(float)
Scale a point by the specified amount.
 o setValue(double, double)
Set the value as specified.
 o setValue(float, float)
Set the value as specified.
 o subtract(Vector2)
Subtract a vector from a point.
 o toString()
 o translate(float, float)
Translate a point by the specified amount.

Variables

 o x
  public float x
 o y
  public float y

Constructors

 o Point2
  public Point2()
Construct a point at the origin.
 o Point2
  public Point2(float x,
                float y)
Construct a point from the specified coordinates.
 o Point2
  public Point2(double x,
                double y)
Construct a point from the specified double coordinates.
 o Point2
  public Point2(Point2 obj)
Construct a point from another point.
 o Point2
  public Point2(Vector2 obj)
Construct a point from a vector pointing to the point.

Methods

 o clear
  public void clear()
 o setValue
  public void setValue(float x,
                       float y)
Set the value as specified.
 o setValue
  public void setValue(double x,
                       double y)
Set the value as specified.
 o distanceTo
  public float distanceTo(Point2 p)
Return the distance to another point.
 o add
  public final void add(Vector2 v)
Add a vector to a point.
 o subtract
  public final void subtract(Vector2 v)
Subtract a vector from a point.
 o translate
  public void translate(float x,
                        float y)
Translate a point by the specified amount.
 o scale
  public void scale(float sc)
Scale a point by the specified amount.
 o equals
  public boolean equals(Object obj)
Overrides:
equals in class Object
 o hashCode
  public int hashCode()
Overrides:
hashCode in class Object
 o copy
  public void copy(Copyable o)
 o toString
  public String toString()
Overrides:
toString in class Object
 o 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.
 o 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.
 o 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.
 o 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