Class Point2D
java.lang.Object
com.treemap.swing.fastvoronoi.polygon.Point2D
Two-dimensional point, which also has functions as a two-dimensional vectors
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal doubleComputes 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)doublefinal doubleComputes the dot-product of the given vector with position vector of the current pointdoublegetX()doublegetY()final doublelength()final doublefinal voidfinal voidScales the coordinates with 1/(length of given vector)final voidscale(double d) voidsetLocation(double x, double y) toString()
-
Field Details
-
x
public double x -
y
public double y
-
-
Constructor Details
-
Point2D
public Point2D() -
Point2D
public Point2D(double x, double y)
-
-
Method Details
-
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
-
getX
public double getX() -
getY
public double getY() -
toString
-
scale
public final void scale(double d) -
dot
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
Scales the coordinates with 1/(length of given vector)- Parameters:
vector2d-
-
normalize
public final void normalize() -
angle
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)
-