Class Point2D
- java.lang.Object
-
- com.macrofocus.treemap.originalfastvoronoi.j2d.Point2D
-
public class Point2D extends java.lang.ObjectTwo-dimensional point, which also has functions as a two-dimensional vectors
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleangle(Point2D vector2d)Computes the angle between the given vector and the position vector of the current pointdoubledistance(double px, double py)Computes the euclidean distance bewteen (px,py) to the current pointstatic doubledistance(double x1, double y1, double x2, double y2)Computes the euclidean distance between (x1,y1) and (x2,y2)doubledistance(Point2D point)doubledot(Point2D vector2d)Computes the dot-product of the given vector with position vector of the current pointdoublegetX()doublegetY()doublelength()doublelengthSquared()voidnormalize()voidnormalize(Point2D vector2d)Scales the coordinates with 1/(length of given vector)voidscale(double d)voidsetLocation(double x, double y)java.lang.StringtoString()
-
-
-
Method Detail
-
distance
public static double distance(double x1, double y1, double x2, double y2)Computes the euclidean distance between (x1,y1) and (x2,y2)- Parameters:
x1-y1-x2-y2-- Returns:
- euclidean distance between (x1,y1) and (x2,y2)
-
distance
public double distance(double px, double py)Computes the euclidean distance bewteen (px,py) to the current point- Parameters:
px-py-- Returns:
-
distance
public double distance(Point2D point)
-
getX
public double getX()
-
getY
public double getY()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
scale
public final void scale(double d)
-
dot
public final double dot(Point2D vector2d)
Computes the dot-product of the given vector with position vector of the current point- Parameters:
vector2d-- Returns:
-
length
public final double length()
-
lengthSquared
public final double lengthSquared()
-
normalize
public final void normalize(Point2D vector2d)
Scales the coordinates with 1/(length of given vector)- Parameters:
vector2d-
-
normalize
public final void normalize()
-
angle
public final double angle(Point2D vector2d)
Computes the angle between the given vector and the position vector of the current point- Parameters:
vector2d-- Returns:
-
setLocation
public void setLocation(double x, double y)
-
-