Class CompJGeom


  • public class CompJGeom
    extends java.lang.Object
    Since:
    release specific (what release of product did this appear in)
    • Constructor Detail

      • CompJGeom

        public CompJGeom()
    • Method Detail

      • lineLineIntersect

        public static final boolean lineLineIntersect​(double a1x,
                                                      double a1y,
                                                      double a2x,
                                                      double a2y,
                                                      double b1x,
                                                      double b1y,
                                                      double b2x,
                                                      double b2y,
                                                      double[] c)
        Finds the open-set intersection of two line segments, if any.

        Returns false ("no intersection") if the lines are nearly parallel (regardless of whether they cross).

        If the end-point of a segment lies very near to the other segment, intersection test is not reliable; the caller should test the point-on-line case separately. If the endpoint lies exactly on an endpoint of the other segment this method guarantees to return false.

        Parameters:
        a1x - the first endpoint x-value of line segment a
        a1y - the first endpoint y-value of line segment a
        a2x - the first endpoint x-value of line segment a
        a2y - the first endpoint y-value of line segment a
        b1x - the first endpoint x-value of line segment b
        b1y - the first endpoint y-value of line segment b
        b2x - the first endpoint x-value of line segment b
        b2y - the first endpoint y-value of line segment a
        c - the intersection (if any). May pass null. If non-null, may be overwritten even if result is false.
        Returns:
        true if there is an intersection; false otherwise
      • distToPoint

        public static final double distToPoint​(JPoint2DD p1,
                                               JPoint2DD p2,
                                               CoordSysInfo CSI)
        Compute the distance from a point to a line. Geodetic computations assume a sphere. All input is in degrees.
        Parameters:
        p1 - the point
        p2 - other end of the line
        CSI - coordinate system
        Returns:
        distance in coordiante system units (meters if geodetic)
      • distToLine

        public static final double distToLine​(JPoint2DD pt,
                                              JPoint2DD q1,
                                              JPoint2DD q2,
                                              CoordSysInfo CSI)
        Compute the distance from a point to a line. Geodetic computations assume a sphere. All input is in degrees.
        Parameters:
        pt - the point
        q1 - one end of the line
        q2 - other end of the line
        CSI - coordinate system
        Returns:
        distance in coordiante system units (meters if geodetic)
      • distLineToLine

        public static final double distLineToLine​(JPoint2DD p1,
                                                  JPoint2DD p2,
                                                  JPoint2DD q1,
                                                  JPoint2DD q2,
                                                  CoordSysInfo CSI)
        Compute the distance from a line to a line. Geodetic computations assume a sphere. All input is in degrees.
        Parameters:
        pt1 - one end of the line
        pt2 - other end of the line
        q1 - one end of the line
        q2 - other end of the line
        CSI - coordinate system
        Returns:
        distance in coordiante system units (meters if geodetic)
      • distToPoint

        public static final double distToPoint​(double q1x,
                                               double q1y,
                                               double q2x,
                                               double q2y)
        Finds the planar closest distance from a point to a point.
        Parameters:
        p1 - The first point
        p2 - The second point
      • distToLine

        public static final double distToLine​(double px,
                                              double py,
                                              double q1x,
                                              double q1y,
                                              double q2x,
                                              double q2y)
        Finds the planar closest distance from a point to a line segment.
        Parameters:
        p - The point
        q1 - The first vertex of the line segment
        q2 - The second vertex of the line segment
        Returns:
        The distance in coordinate system units
      • jMdspheedis

        protected static double jMdspheedis​(double x1,
                                            double y1,
                                            double x2,
                                            double y2,
                                            double smax,
                                            double iflat)
        The method jMdspheedis computes the precise ellipsoidal distance using long/lat of two points. It is the Java version of mdspheedis function in mdsph.c Original function by Author: B. Blackwell from mdsph.c

        Input is geodetic longitude, latitude in radians of two points on earth spheroid.

        Based on Mathematica Geodesy package by John Novak

        Will return 0. for arcs of the order of a meter or less. For very short arcs use mdsphedis(). Will return the antipodal distance for points which are very close to antipodal.

        Accuracy is of order 1e-9.

        Parameters:
        x1 - longitude of first point in radians
        y1 - latitude of first point in radians
        x2 - longitude of second point in radians
        y2 - latitude of second point in radians
        smax - smax of ellipsoid
        iflat - inverse flattening
        Returns:
        ellipsoid distance in meters.
      • MBRIscts

        public static boolean MBRIscts​(double[] mbrA,
                                       double[] mbrB,
                                       CoordSysInfo CSI)
      • MBRDistance

        public static double MBRDistance​(double[] mbrA,
                                         double[] mbrB,
                                         CoordSysInfo CSI)