Package com.esri.core.geometry
Class Point2D
- java.lang.Object
-
- com.esri.core.geometry.Point2D
-
- All Implemented Interfaces:
java.io.Serializable
public final class Point2D extends java.lang.Object implements java.io.SerializableBasic 2D point class. Contains only two double fields.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPoint2D.CompareVectors
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDdoublexdoubley
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static int_compareVectors(Point2D v1, Point2D v2)(package private) double_dotProductAbs(Point2D other)(package private) int_getQuarter()(package private) boolean_isNan()(package private) double_norm(int metric)(package private) void_setNan()voidadd(Point2D other)voidadd(Point2D p1, Point2D p2)private static Point2DcalculateCenterFromThreePointsHelper_(Point2D from, Point2D mid_point, Point2D to)private static Point2DcalculateCenterFromThreePointsHelperMP_(Point2D from, Point2D mid_point, Point2D to)(package private) static Point2DcalculateCircleCenterFromThreePoints(Point2D from, Point2D mid_point, Point2D to)intcompare(Point2D other)Compares two vertices lexicographically by y.static intcompareVectors(Point2D v1, Point2D v2)Assume vector v1 and v2 have same origin.(package private) intcompareX(Point2D other)Compares two vertices lexicographically by x.static Point2Dconstruct(double x, double y)doublecrossProduct(Point2D other)static doubledistance(Point2D pt1, Point2D pt2)doubledotProduct(Point2D other)booleanequals(Point2D other)booleanequals(java.lang.Object other)(package private) doublegetAxis(int ordinate)intgetQuarter()Calculates which quarter of XY plane the vector lies in.inthashCode()(package private) static intinCircleRobust(Point2D p, Point2D q, Point2D r, Point2D s)Calculates if the point s is inside of the circumcircle inscribed by the clockwise oriented triangle p-q-r.private static intinCircleRobustMP_(Point2D p, Point2D q, Point2D r, Point2D s)voidinterpolate(Point2D other, double alpha)voidinterpolate(Point2D p1, Point2D p2, double alpha)booleanisEqual(double x_, double y_)booleanisEqual(Point2D other)booleanisEqual(Point2D other, double tol)booleanisNaN()voidleftPerpendicular()90 degree rotation, anticlockwise.voidleftPerpendicular(Point2D pt)90 degree rotation, anticlockwise.doublelength()voidnegate()voidnegate(Point2D other)voidnormalize()voidnormalize(Point2D other)(package private) doubleoffset(Point2D pt1, Point2D pt2)returns signed distance of point from infinite line represented by pt_1...pt_2.static intorientationRobust(Point2D p, Point2D q, Point2D r)Calculates the orientation of the triangle formed by p, q, r.voidrightPerpendicular()270 degree rotation, anticlockwise.voidrightPerpendicular(Point2D pt)270 degree rotation, anticlockwise.voidrotateDirect(double Cos, double Sin)voidrotateReverse(double Cos, double Sin)voidscale(double f)voidscale(double f, Point2D other)voidscaleAdd(double f, Point2D shift)Calculates this = this * f + shiftvoidscaleAdd(double f, Point2D other, Point2D shift)Calculates this = other * f + shiftvoidsetCoords(double x, double y)voidsetCoords(Point2D other)voidsetNaN()static doublesqrDistance(Point2D pt1, Point2D pt2)doublesqrLength()voidsub(Point2D other)voidsub(Point2D p1, Point2D p2)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
x
public double x
-
y
public double y
-
-
Constructor Detail
-
Point2D
public Point2D()
-
Point2D
public Point2D(double x, double y)
-
Point2D
public Point2D(Point2D other)
-
-
Method Detail
-
construct
public static Point2D construct(double x, double y)
-
setCoords
public void setCoords(double x, double y)
-
setCoords
public void setCoords(Point2D other)
-
isEqual
public boolean isEqual(Point2D other)
-
isEqual
public boolean isEqual(double x_, double y_)
-
isEqual
public boolean isEqual(Point2D other, double tol)
-
equals
public boolean equals(Point2D other)
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
sub
public void sub(Point2D other)
-
add
public void add(Point2D other)
-
negate
public void negate()
-
negate
public void negate(Point2D other)
-
interpolate
public void interpolate(Point2D other, double alpha)
-
scaleAdd
public void scaleAdd(double f, Point2D shift)Calculates this = this * f + shift- Parameters:
f-shift-
-
scaleAdd
public void scaleAdd(double f, Point2D other, Point2D shift)Calculates this = other * f + shift- Parameters:
f-other-shift-
-
scale
public void scale(double f, Point2D other)
-
scale
public void scale(double f)
-
compare
public int compare(Point2D other)
Compares two vertices lexicographically by y.
-
compareX
int compareX(Point2D other)
Compares two vertices lexicographically by x.
-
normalize
public void normalize(Point2D other)
-
normalize
public void normalize()
-
length
public double length()
-
sqrLength
public double sqrLength()
-
dotProduct
public double dotProduct(Point2D other)
-
_dotProductAbs
double _dotProductAbs(Point2D other)
-
crossProduct
public double crossProduct(Point2D other)
-
rotateDirect
public void rotateDirect(double Cos, double Sin)
-
rotateReverse
public void rotateReverse(double Cos, double Sin)
-
leftPerpendicular
public void leftPerpendicular()
90 degree rotation, anticlockwise. Equivalent to RotateDirect(cos(pi/2), sin(pi/2)).
-
leftPerpendicular
public void leftPerpendicular(Point2D pt)
90 degree rotation, anticlockwise. Equivalent to RotateDirect(cos(pi/2), sin(pi/2)).
-
rightPerpendicular
public void rightPerpendicular()
270 degree rotation, anticlockwise. Equivalent to RotateDirect(-cos(pi/2), sin(-pi/2)).
-
rightPerpendicular
public void rightPerpendicular(Point2D pt)
270 degree rotation, anticlockwise. Equivalent to RotateDirect(-cos(pi/2), sin(-pi/2)).
-
_setNan
void _setNan()
-
_isNan
boolean _isNan()
-
_getQuarter
final int _getQuarter()
-
getQuarter
public int getQuarter()
Calculates which quarter of XY plane the vector lies in. First quarter is between vectors (1,0) and (0, 1), second between (0, 1) and (-1, 0), etc. The quarters are numbered counterclockwise. Angle intervals corresponding to quarters: 1 : [0 : 90); 2 : [90 : 180); 3 : [180 : 270); 4 : [270 : 360)
-
compareVectors
public static int compareVectors(Point2D v1, Point2D v2)
Assume vector v1 and v2 have same origin. The function compares the vectors by angle in the counter clockwise direction from the axis X. For example, V1 makes 30 degree angle counterclockwise from horizontal x axis V2, makes 270, V3 makes 90, then compareVectors(V1, V2) == -1. compareVectors(V1, V3) == -1. compareVectors(V2, V3) == 1.- Returns:
- Returns 1 if v1 is less than v2, 0 if equal, and 1 if greater.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setNaN
public void setNaN()
-
isNaN
public boolean isNaN()
-
_norm
double _norm(int metric)
-
offset
double offset(Point2D pt1, Point2D pt2)
returns signed distance of point from infinite line represented by pt_1...pt_2. The returned distance is positive if this point lies on the right-hand side of the line, negative otherwise. If the two input points are equal, the (positive) distance of this point to p_1 is returned.
-
orientationRobust
public static int orientationRobust(Point2D p, Point2D q, Point2D r)
Calculates the orientation of the triangle formed by p, q, r. Returns 1 for counter-clockwise, -1 for clockwise, and 0 for collinear. May use high precision arithmetics for some special degenerate cases.
-
inCircleRobust
static int inCircleRobust(Point2D p, Point2D q, Point2D r, Point2D s)
Calculates if the point s is inside of the circumcircle inscribed by the clockwise oriented triangle p-q-r. Returns 1 for outside, -1 for inside, and 0 for cocircular. Note that the convention used here differs from what is commonly found in literature, which can define the relation in terms of a counter-clockwise oriented circle, and this flips the sign (think of the signed volume of the tetrahedron). May use high precision arithmetics for some special cases.
-
calculateCenterFromThreePointsHelperMP_
private static Point2D calculateCenterFromThreePointsHelperMP_(Point2D from, Point2D mid_point, Point2D to)
-
calculateCenterFromThreePointsHelper_
private static Point2D calculateCenterFromThreePointsHelper_(Point2D from, Point2D mid_point, Point2D to)
-
calculateCircleCenterFromThreePoints
static Point2D calculateCircleCenterFromThreePoints(Point2D from, Point2D mid_point, Point2D to)
-
getAxis
double getAxis(int ordinate)
-
-