Class Point2D
- java.lang.Object
-
- com.macrofocus.treemap.originalfastvoronoi.j2d.Point2D
-
public class Point2D extends java.lang.Object
Two-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 double
angle(Point2D vector2d)
Computes the angle between the given vector and the position vector of the current pointdouble
distance(double px, double py)
Computes the euclidean distance bewteen (px,py) to the current pointstatic double
distance(double x1, double y1, double x2, double y2)
Computes the euclidean distance between (x1,y1) and (x2,y2)double
distance(Point2D point)
double
dot(Point2D vector2d)
Computes the dot-product of the given vector with position vector of the current pointdouble
getX()
double
getY()
double
length()
double
lengthSquared()
void
normalize()
void
normalize(Point2D vector2d)
Scales the coordinates with 1/(length of given vector)void
scale(double d)
void
setLocation(double x, double y)
java.lang.String
toString()
-
-
-
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:
toString
in 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)
-
-