Class Point2D

java.lang.Object
com.esri.core.geometry.Point2D
All Implemented Interfaces:
Serializable

public final class Point2D extends Object implements Serializable
Basic 2D point class. Contains only two double fields.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • x

      public double x
    • y

      public double y
  • Constructor Details

    • Point2D

      public Point2D()
    • Point2D

      public Point2D(double x, double y)
    • Point2D

      public Point2D(Point2D other)
  • Method Details

    • 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(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • sub

      public void sub(Point2D other)
    • sub

      public void sub(Point2D p1, Point2D p2)
    • add

      public void add(Point2D other)
    • add

      public void add(Point2D p1, Point2D p2)
    • negate

      public void negate()
    • negate

      public void negate(Point2D other)
    • interpolate

      public void interpolate(Point2D other, double alpha)
    • interpolate

      public void interpolate(Point2D p1, Point2D p2, 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()
    • distance

      public static double distance(Point2D pt1, Point2D pt2)
    • 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

      static final int _compareVectors(Point2D v1, Point2D v2)
    • 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.
    • sqrDistance

      public static double sqrDistance(Point2D pt1, Point2D pt2)
    • toString

      public String toString()
      Overrides:
      toString in class 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.
    • inCircleRobustMP_

      private static int inCircleRobustMP_(Point2D p, Point2D q, Point2D r, Point2D s)
    • 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)