Package javax.vecmath
Class Point2d
java.lang.Object
javax.vecmath.Tuple2d
javax.vecmath.Point2d
- All Implemented Interfaces:
Serializable
,Cloneable
A 2 element point that is represented by double precision floating
point x,y coordinates.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPoint2d()
Constructs and initializes a Point2d to (0,0).Point2d
(double[] p) Constructs and initializes a Point2d from the specified array.Point2d
(double x, double y) Constructs and initializes a Point2d from the specified xy coordinates.Constructs and initializes a Point2d from the specified Point2d.Constructs and initializes a Point2d from the specified Point2f.Constructs and initializes a Point2d from the specified Tuple2d.Constructs and initializes a Point2d from the specified Tuple2f. -
Method Summary
Modifier and TypeMethodDescriptionfinal double
Computes the distance between this point and point p1.final double
distanceL1
(Point2d p1) Computes the L-1 (Manhattan) distance between this point and point p1.final double
distanceLinf
(Point2d p1) Computes the L-infinite distance between this point and point p1.final double
Computes the square of the distance between this point and point p1.Methods inherited from class javax.vecmath.Tuple2d
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, getX, getY, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, setX, setY, sub, sub, toString
-
Constructor Details
-
Point2d
public Point2d(double x, double y) Constructs and initializes a Point2d from the specified xy coordinates.- Parameters:
x
- the x coordinatey
- the y coordinate
-
Point2d
public Point2d(double[] p) Constructs and initializes a Point2d from the specified array.- Parameters:
p
- the array of length 2 containing xy in order
-
Point2d
Constructs and initializes a Point2d from the specified Point2d.- Parameters:
p1
- the Point2d containing the initialization x y data
-
Point2d
Constructs and initializes a Point2d from the specified Point2f.- Parameters:
p1
- the Point2f containing the initialization x y data
-
Point2d
Constructs and initializes a Point2d from the specified Tuple2d.- Parameters:
t1
- the Tuple2d containing the initialization x y data
-
Point2d
Constructs and initializes a Point2d from the specified Tuple2f.- Parameters:
t1
- the Tuple2f containing the initialization x y data
-
Point2d
public Point2d()Constructs and initializes a Point2d to (0,0).
-
-
Method Details
-
distanceSquared
Computes the square of the distance between this point and point p1.- Parameters:
p1
- the other point
-
distance
Computes the distance between this point and point p1.- Parameters:
p1
- the other point
-
distanceL1
Computes the L-1 (Manhattan) distance between this point and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).- Parameters:
p1
- the other point
-
distanceLinf
Computes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].- Parameters:
p1
- the other point
-