org.shlublu.javax.math
Class Point2D

java.lang.Object
  |
  +--org.shlublu.javax.math.Point2D
All Implemented Interfaces:
java.lang.Cloneable, Point

public final class Point2D
extends java.lang.Object
implements Point

Creation : 2002/03/23 Class dedicated to implement 2D point operations

Since:
0.5

Field Summary
 double x
          x coordinate
 double y
          y coordinate
 
Constructor Summary
Point2D()
          Empty constructor, init to (.0, .0)
Point2D(double dblX, double dblY)
          Constructor, init to the given arguments
Point2D(Point2D p)
          Constructor, init to the given point
 
Method Summary
 java.lang.Object clone()
          Return a Point2D equals() to this one
 boolean equals(java.lang.Object o)
          True if o is not null, from the Point2D class without beeing from a subclass, and have the same coordinates in the same order than this.
 double getDistanceTo(Point2D pt)
          Get the distance between this and the given Point
 Point2D getTranslated(Vector2D v)
          Get the point corresponding to this translated by the given vector
 Vector2D getVector()
          Get the Vector corresponding to the translation from the origin to this Point
 Vector2D getVectorTo(Point2D pt)
          Get the vector between this and the given Point
 java.lang.String toString()
          Get this point as a string
 void translate(Vector2D v)
          Translate this point using the given vector
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
x coordinate

y

public double y
y coordinate
Constructor Detail

Point2D

public Point2D()
Empty constructor, init to (.0, .0)

Point2D

public Point2D(double dblX,
               double dblY)
Constructor, init to the given arguments

Point2D

public Point2D(Point2D p)
Constructor, init to the given point
Method Detail

toString

public java.lang.String toString()
Get this point as a string
Specified by:
toString in interface Point
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
True if o is not null, from the Point2D class without beeing from a subclass, and have the same coordinates in the same order than this.
Specified by:
equals in interface Point
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Return a Point2D
equals()
to this one
Specified by:
clone in interface Point
Overrides:
clone in class java.lang.Object

getVector

public Vector2D getVector()
Get the Vector corresponding to the translation from the origin to this Point

translate

public void translate(Vector2D v)
Translate this point using the given vector

getTranslated

public Point2D getTranslated(Vector2D v)
Get the point corresponding to this translated by the given vector

getDistanceTo

public double getDistanceTo(Point2D pt)
Get the distance between this and the given Point

getVectorTo

public Vector2D getVectorTo(Point2D pt)
Get the vector between this and the given Point