Package geomss.geom

Class GeomUtil


  • public final class GeomUtil
    extends java.lang.Object
    A collection of static methods used by classes in the geometry package.

    Modified by: Joseph A. Huwaldt

    Version:
    February 17, 2025
    Author:
    Joseph A. Huwaldt, Date: March 31, 2009
    • Field Detail

      • EPS

        public static final double EPS
        The machine epsilon or unit roundoff for double in the Java environment. Machine epsilon gives an upper bound on the relative error due to rounding in floating point arithmetic.
      • SQRT_EPS

        public static final double SQRT_EPS
        The square-root of EPS.
        See Also:
        EPS
    • Method Detail

      • averagePoints

        public static Point averagePoints​(GeomPoint... pnts)
        Compute the average of an array of points (returning the mid-point between them all).
        Parameters:
        pnts - The array of points to average. There must be at least one point.
        Returns:
        The average of the input points.
      • averagePoints

        public static Point averagePoints​(java.util.List<? extends GeomPoint> pnts)
        Compute the average of a list of points (returning the mid-point between them all).
        Parameters:
        pnts - The list of points to average. There must be at least one point.
        Returns:
        The average of the input points.
      • getTotalTransform

        public static GTransform getTotalTransform​(GeomTransform tElem)
        Returns the total transformation represented by an entire chain of GeomTransform objects below the one provided.
        Parameters:
        tElem - The transformed geometry element to have the total TM returned for. May not be null.
        Returns:
        The transformation matrix (TM) that represents the entire chain of transformations contained in a nested set of transformed geometry elements.
      • bound2Pi

        public static double bound2Pi​(double angle)
        Returns the input angle (in radians) bounded to the range 0 - 2*PI.
        Parameters:
        angle - The angle (in radians) to be bounded.
        Returns:
        The input angle bounded to the range 0 to 2*PI (radians).
      • bound2Pi

        public static Parameter<javax.measure.quantity.Angle> bound2Pi​(Parameter<javax.measure.quantity.Angle> angle)
        Returns the input angle bounded to the range 0 - 2*PI.
        Parameters:
        angle - The angle to be bounded. May not be null.
        Returns:
        The input angle bounded to the range 0 to 2*PI.
      • boundPi

        public static double boundPi​(double angle)
        Returns the input angle (in radians) bounded to the range +/-PI.
        Parameters:
        angle - The angle (in radians) to be bounded.
        Returns:
        The input angle bounded to the range -PI to +PI (radians).
      • boundPi

        public static Parameter<javax.measure.quantity.Angle> boundPi​(Parameter<javax.measure.quantity.Angle> angle)
        Returns the input angle bounded to the range +/-PI (+/- 180 deg).
        Parameters:
        angle - The angle to be bounded. May not be null.
        Returns:
        The input angle bounded to the range -PI to +PI.
      • maxPhyDimension

        public static int maxPhyDimension​(GeomElement... elements)
        Return the maximum physical dimension among a collection of geometry elements.
        Parameters:
        elements - The array of geometry elements to query. May not be null.
        Returns:
        The maximum physical dimension among the input list of geometry elements.
      • maxPhyDimension

        public static int maxPhyDimension​(java.util.Collection<GeomElement> elements)
        Return the maximum physical dimension among a collection of geometry elements.
        Parameters:
        elements - The collection of geometry elements to query. May not be null.
        Returns:
        The maximum physical dimension among the input list of geometry elements.
      • makeXVector

        public static Vector<javax.measure.quantity.Dimensionless> makeXVector​(int numDims)
        Return a unit vector, of nDims dimensions, in the X (dimension = 0) direction.
        Parameters:
        numDims - The number of dimensions for the unit vector.
        Returns:
        A unit vector, with the given dimensions, in the "X" direction.
      • makeYVector

        public static Vector<javax.measure.quantity.Dimensionless> makeYVector​(int numDims)
        Return a unit vector, of nDims dimensions, in the Y (dimension = 1) direction. If the number of dimensions is less than two, this will return null.
        Parameters:
        numDims - The number of dimensions for the unit vector.
        Returns:
        A unit vector, with the given dimensions, in the "Y" direction.
      • makeZVector

        public static Vector<javax.measure.quantity.Dimensionless> makeZVector​(int numDims)
        Return a unit vector, of nDims dimensions, in the Z (dimension = 2) direction. If the number of dimensions is less than three, then this will return null.
        Parameters:
        numDims - The number of dimensions for the unit vector.
        Returns:
        A unit vector, with the given dimensions, in the "Z" direction.
      • calcYHat

        public static Vector<javax.measure.quantity.Dimensionless> calcYHat​(GeomVector<javax.measure.quantity.Dimensionless> n)
        Return the yhat vector (a Y axis orthogonal to the specified plane normal). The returned vector will have the origin set to zero.
        Parameters:
        n - A unit plane normal vector for the plane containing the new axis. Pass null for 2D geometry.
        Returns:
        A unit vector orthogonal to the specified plane normal vector.
      • calcXHat

        public static Vector<javax.measure.quantity.Dimensionless> calcXHat​(GeomVector<javax.measure.quantity.Dimensionless> n,
                                                                            GeomVector<javax.measure.quantity.Dimensionless> yhat)
        Return the xhat vector (an X axis orthogonal to the specified normal and Y-axis vectors).
        Parameters:
        n - A unit plane normal vector for the plane containing the new axis. Pass null for 2D geometry.
        yhat - The unit direction of the Y axis in the plane containing the new axis.
        Returns:
        A unit vector orthogonal to the specified normal and Y-axis vectors.
      • normal2D

        public static Vector normal2D​(GeomVector u)
        Return a vector that is the in-plane normal to the input 2D vector.
        Parameters:
        u - The 2D vector that the normal vector is to be determined for.
        Returns:
        The 2D vector normal of the input 2D vector.
      • crossArea

        public static Parameter crossArea​(GeomVector v1,
                                          GeomVector v2)
        Return the vector or cross product area value for two vectors. The magnitude of the vector or cross product results in a scalar that represents the the area of a parallelogram with the vectors for sides. This is also the magnitude of the determinant of the two vectors. For 2D vectors, a signed area will be returned with positive area indicating a normal vector that is pointing "out of the page" and a negative area indicating a normal vector pointing "into the page".
        Parameters:
        v1 - The 1st vector to be multiplied. May not be null.
        v2 - The 2nd vector multiplier. May not be null.
        Returns:
        The vector or cross product between the input vectors (v1 X v2) as a scalar area.
      • pointLineDistance

        public static Parameter<javax.measure.quantity.Length> pointLineDistance​(GeomPoint p,
                                                                                 GeomPoint a,
                                                                                 GeomVector<javax.measure.quantity.Dimensionless> u)
        Finds the shortest distance from a point to an infinite line.
        Parameters:
        p - The point being compared to the line to find the shortest distance. May not be null.
        a - A point on the line. May not be null.
        u - The unit direction vector for the line. May not be null.
        Returns:
        The distance from the point to the line.
      • pointLineSegDistance

        public static Parameter<javax.measure.quantity.Length> pointLineSegDistance​(GeomPoint p,
                                                                                    GeomPoint p0,
                                                                                    GeomPoint p1)
        Finds the shortest distance from a point to an finite line segment.
        Parameters:
        p - The point being compared to the segment to find the shortest distance. May not be null.
        p0 - The start of the line segment. May not be null.
        p1 - The end of the line segment. May not be null.
        Returns:
        The shortest distance from the point to the line segment.
      • pointLineClosest

        public static Point pointLineClosest​(GeomPoint p,
                                             GeomPoint a,
                                             GeomVector<javax.measure.quantity.Dimensionless> u)
        Finds the point on an infinite line that is closest to the specified point.
        Parameters:
        p - The point being compared to the line to find the closest point on the line. May not be null.
        a - A point on the line. May not be null.
        u - The unit direction vector for the line. May not be null.
        Returns:
        The point on the line closest to the point "p".
      • pointPlaneDistance

        public static Parameter<javax.measure.quantity.Length> pointPlaneDistance​(GeomPoint p,
                                                                                  GeomPoint a,
                                                                                  GeomVector<javax.measure.quantity.Dimensionless> n)
                                                                           throws DimensionException
        Finds the shortest signed distance from a point to an infinite plane.
        Parameters:
        p - The point being compared to the plane to find the closest point on the plane. May not be null.
        a - Any point in the plane. May not be null.
        n - The unit normal vector for the plane. May not be null.
        Returns:
        The signed shortest distance from the input point "p" to the plane. The distance is positive for points on the side of the plane pointed to by the normal vector "n", and negative for points on the other side of the plane.
        Throws:
        DimensionException - if input normal vector physical dimension is not at least 3 dimensional.
      • pointPlaneClosest

        public static Point pointPlaneClosest​(GeomPoint p,
                                              GeomPoint a,
                                              GeomVector<javax.measure.quantity.Dimensionless> n)
                                       throws DimensionException
        Finds the point on an infinite plane that is closest to the specified point. The distance to the plane is simply: p.minus(pointPlaneClosest(p,...)).norm();.
        Parameters:
        p - The point being compared to the plane to find the closest point on the plane. May not be null.
        a - Any point in the plane. May not be null.
        n - The unit normal vector for the plane. May not be null.
        Returns:
        The point on the plane closest to the point "p". May return the input point "p" if it is in the plane.
        Throws:
        DimensionException - if input normal vector physical dimension is not at least 3 dimensional.
      • threePointCircle

        public static CircleInfo threePointCircle​(GeomPoint p1,
                                                  GeomPoint p2,
                                                  GeomPoint p3)
                                           throws DimensionException
        Find a circle that passes through the supplied (not co-linear) points.
        Parameters:
        p1 - The 1st of the points that define the circle (must not be colinear with the other two). May not be null.
        p2 - The 2nd of the points that define the circle (must not be colinear with the other two). May not be null.
        p3 - The 3rd of the points that define the circle (must not be colinear with the other two). May not be null.
        Returns:
        A CircleInfo record containing the geometry of the circle. The "xhat" parameter points to the first point supplied. The "yhat" parameter indicates the direction to the next point. The "angle" parameter gives the angle swept out from the 1st point to the 3rd point.
        Throws:
        DimensionException - if one of the 3 points does not have at least 2 physical dimensions.
        java.lang.IllegalArgumentException - if the input points are co-linear.
      • centerTwoPointCircle

        public static CircleInfo centerTwoPointCircle​(GeomPoint o,
                                                      GeomPoint p1,
                                                      GeomPoint p2)
                                               throws DimensionException
        Finds a circle that is approximately centered on the specified origin point and passes through the two input points. The origin point is used to determine the plane that the circle lies in and is used to approximate the center of the circle. The true origin/center of the circle is calculated to ensure that the circle passes through the supplied edge points.
        Parameters:
        o - Approximate origin or center to create the full-circle around. May not be null.
        p1 - The 1st of the points that define the circle (must not be colinear with the other two). May not be null.
        p2 - The 2nd of the points that define the circle (must not be colinear with the other two). May not be null.
        Returns:
        A CircleInfo record containing the geometry of the circle. THe "xhat" parameter points to the first point supplied. The "yhat" parameter indicates the direction to the 2nd point. The "angle" parameter gives the angle swept out from the 1st point to the 2nd point.
        Throws:
        DimensionException - if the origin or 2 points do not have at least 2 physical dimensions.
      • twoPointTangentCircle

        public static CircleInfo twoPointTangentCircle​(GeomPoint p1,
                                                       GeomVector t1,
                                                       GeomPoint p2)
                                                throws DimensionException
        Finds a circle that passes through the two specified points with the specified tangent vector at the start.
        Parameters:
        p1 - The 1st of the points that define the circle. May not be null.
        t1 - The tangent vector at p1 (must not point directly at p2). May not be null.
        p2 - The 2nd of the points that define the circle. May not be null.
        Returns:
        A CircleInfo record containing the geometry of the circle. THe "xhat" parameter points to the first point supplied. The "yhat" parameter indicates the direction to the 2nd point. The "angle" parameter gives the angle swept out from the 1st point to the 2nd point.
        Throws:
        DimensionException - if the 2 points do not have at least 2 physical dimensions.
      • getDefaultUnit

        public static javax.measure.unit.Unit<javax.measure.quantity.Length> getDefaultUnit()
        Returns the default units for this system. The default unit is based on the user's locale. If the user's locale is the United States, then a value of NonSI.INCH is returned, otherwise a value of SI.CENTIMETER is returned.
        Returns:
        The default units for this system.
      • lineLineIntersect

        public static IntersectType lineLineIntersect​(GeomPoint p1,
                                                      GeomVector t1,
                                                      GeomPoint p2,
                                                      GeomVector t2,
                                                      Parameter<javax.measure.quantity.Length> tol,
                                                      MutablePoint sOut,
                                                      MutablePoint out1,
                                                      MutablePoint out2)
                                               throws DimensionException
        Finds the intersection point between two lines, or the point of closest approach if the lines do not intersect, and returns the point on each line. The output data is returned by modifying the input sOut, out1 and out2 points.
        Parameters:
        p1 - A point on the 1st line. May not be null.
        t1 - The direction vector for the 1st line (does not have to be a unit vector). May not be null.
        p2 - A point on the 2nd line. May not be null.
        t2 - The direction vector for the 2nd line (MUST be similar to t1; unit vector if t1 is unit vector and dimension vector if t1 is a dimensional vector). Do NOT mix dimensional and unit vectors in the same call. May not be null.
        tol - Tolerance on how close the lines must be to be considered intersecting. A value of null indicates that an exact intersection is required.
        sOut - The pre-defined 2D output parametric positions on the input lines that will be filled in to represent the points where the lines intersect. If the input direction vectors are dimensionless (unit vectors), then the output point will be scaled to the units of p1 (indicating the distance that the intersection point is away from the origin in p1 units). If the input direction vectors are dimensional, then the point will be scaled such that 1.0 m represents the direction vector's length along the line. If there is no intersection, the point is not modified. If null is passed, then the parametric point is not calculated.
        out1 - The pre-defined output point on the 1st line representing the intersection or closest approach of the two lines (may be null if not required).
        out2 - The pre-defined output point on the 2nd line representing the intersection or closest approach of the two lines (may be null if not required).
        Returns:
        DISJOINT if the lines do not intersect or INTERSECT if they do.
        Throws:
        DimensionException - if the output points do not have at least as many dimensions as the input points.
      • linePlaneIntersect

        public static IntersectType linePlaneIntersect​(GeomPoint L0,
                                                       GeomVector Ldir,
                                                       GeomPlane plane,
                                                       MutablePoint out)
                                                throws DimensionException
        Finds the intersection point between a line and a plane (if there is an intersection). If the line and the plane are parallel, then IntersectType.DISJOINT is output, if there is an intersection, then 1 is output and the intersection point is returned in the input out point. Finally, if the line is coincident with the plane, then 2 is output and out is set to the L0 point.
        Parameters:
        L0 - A point on the line (origin of the line). May not be null.
        Ldir - The direction vector for the line (does not have to be a unit vector). May not be null.
        plane - The plane being tested for intersection. May not be null.
        out - The pre-defined output point on the line that will be filled in to represent the intersection of the line and the plane (not modified if there is no intersection). If null is passed, then the point is not calculated, but the return codes of this method are still valid.
        Returns:
        DISJOINT if the line and plane are disjoint (parallel), INTERSECT if there is a unique intersection and COINCIDENT if the line is coincident with the plane.
        Throws:
        DimensionException - if the output point does not have at least as many dimensions as the input line and plane.
      • linePlaneIntersect

        public static IntersectType linePlaneIntersect​(GeomPoint L0,
                                                       GeomVector Ldir,
                                                       GeomPlane plane,
                                                       MutablePoint out,
                                                       double tol)
                                                throws DimensionException
        Finds the intersection point between a line and a plane (if there is an intersection). If the line and the plane are parallel, then IntersectType.DISJOINT is output, if there is an intersection, then 1 is output and the intersection point is returned in the input out point. Finally, if the line is coincident with the plane, then 2 is output and out is set to the L0 point.
        Parameters:
        L0 - A point on the line (origin of the line). May not be null.
        Ldir - The direction vector for the line (does not have to be a unit vector). May not be null.
        plane - The plane being tested for intersection. May not be null.
        out - The pre-defined output point on the line that will be filled in to represent the intersection of the line and the plane (not modified if there is no intersection). If null is passed, then the point is not calculated, but the return codes of this method are still valid.
        tol - The fractional tolerance on determining if the line and plane are coincident or disjoint.
        Returns:
        DISJOINT if the line and plane are disjoint (parallel), INTERSECT if there is a unique intersection and COINCIDENT if the line is coincident with the plane.
        Throws:
        DimensionException - if the output point does not have at least as many dimensions as the input line and plane.
      • planePlaneIntersect

        public static IntersectType planePlaneIntersect​(GeomPlane plane1,
                                                        GeomPlane plane2,
                                                        MutablePoint out,
                                                        MutableVector<javax.measure.quantity.Dimensionless> dir)
                                                 throws DimensionException
        Finds the intersection line between two planes (if there is an intersection). If the two planes are parallel, then IntersectType.DISJOINT is output, if there is an intersection, then IntersectType.INTERSECT is output and a point on the intersection line is returned in the input out point and the direction vector of the intersection line is returned in the input dir vector. Finally, if the two planes are coincident, then IntersectType.COINCIDENT is output.
        Parameters:
        plane1 - The 1st plane being tested for intersection. May not be null.
        plane2 - The 2nd plane being tested for intersection. May not be null.
        out - The pre-defined output point on the intersection line that will be filled in to represent the intersection of the two planes (not modified if there is no intersection or if the planes are coincident). If null is passed, then the intersection line point is not calculated, but the return codes of this method are still valid.
        dir - The pre-defined output unit direction vector of the intersection line that will be filled in to represent the intersection of the two planes (not modified if there is no intersection or if the planes are coincident). If null is passed, then the intersection line direction is not calculated, but the return codes of this method are still valid.
        Returns:
        DISJOINT if the line and plane are disjoint (parallel), INTERSECT if there is a unique intersection and COINCIDENT if the line is coincident with the plane.
        Throws:
        DimensionException - if the output point and plane do not have at least as many dimensions as the input planes.
      • boundsIntersect

        public static boolean boundsIntersect​(GeomElement b1,
                                              GeomElement b2)
        Returns true if the bounding boxes of two geometry objects intersect or overlap. This is an aligned axis bounding box (AABB) test.
        Parameters:
        b1 - The first geometric object to test for overlap. May not be null.
        b2 - The 2nd geometric object to test for overlap. May not be null.
        Returns:
        true if the bounding boxes of the two input geometry objects intersect or overlap (including one box contained completely inside of the other).
      • lineBoundsIntersect

        public static boolean lineBoundsIntersect​(GeomPoint L0,
                                                  GeomVector Ldir,
                                                  GeomElement box,
                                                  MutablePoint sOut)
        Returns true if the specified infinite line and bounding box of the specified geometry element intersect. This is an infinite line - aligned axis bounding box (AABB) test.
        Parameters:
        L0 - A point on the line (origin of the line). May not be null.
        Ldir - The direction vector for the line (does not have to be a unit vector). May not be null.
        box - The geometry element to extract the bounding box from. May not be null.
        sOut - The pre-defined 2D output parametric position on the line (relative to the origin) that will be filled in to represent the points where the line enters and leaves the bounding box. If there is no intersection, the point is not modified. If null is passed, then the parametric point is not calculated.
        Returns:
        true if the line and geometry element bounding box intersects.
      • lineSegBoundsIntersect

        public static boolean lineSegBoundsIntersect​(GeomPoint p0,
                                                     GeomPoint p1,
                                                     GeomElement box)
        Returns true if the specified line segment and bounding box of the specified geometry element intersect or overlap. This is a line segment aligned axis bounding box (AABB) test.
        Parameters:
        p0 - One end of the line segment. May not be null.
        p1 - The other end of the line segment. May not be null.
        box - The geometry element to extract the bounding box from. May not be null.
        Returns:
        true if the line segment and geometry element bounding box intersects or overlaps (including the line segment contained completely inside of the box).
      • planeBoundsIntersect

        public static boolean planeBoundsIntersect​(GeomPlane plane,
                                                   GeomElement box)
        Returns true if the specified infinite plane and bounding box of the specified geometry element intersect. This is a aligned axis bounding box (AABB) - infinite plane test.
        Parameters:
        plane - The infinite plane being used for the intersection test. May not be null.
        box - The geometry element to extract the bounding box from. May not be null.
        Returns:
        true if the plane and geometry element bounding box intersects.
      • quadNormal

        public static Vector<javax.measure.quantity.Dimensionless> quadNormal​(GeomPoint quadA,
                                                                              GeomPoint quadB,
                                                                              GeomPoint quadC,
                                                                              GeomPoint quadD)
        Return the approximate normal vector for a quadrilateral panel. Quadrilateral panels are not necessarily planar, but in practical applications usually are close. This method returns the cross-product of the diagonal vectors of the quadrilateral panel which approximates the normal vector of the quadrilateral panel.
        Parameters:
        quadA - 1st corner point of a quadrilateral panel. May not be null.
        quadB - 2nd corner point in a counter-clockwise direction. May not be null.
        quadC - 3rd corner point in a counter-clockwise direction. May not be null.
        quadD - 4th corner point in a counter-clockwise direction. May not be null.
        Returns:
        The normal vector formed by the cross-product of the diagonal vectors of the quadrilateral panel. Will be at least 3-dimensional no matter the inputs.
      • lineSegTriIntersect

        public static IntersectType lineSegTriIntersect​(GeomPoint L0,
                                                        GeomPoint L1,
                                                        GeomPoint V0,
                                                        GeomPoint V1,
                                                        GeomPoint V2,
                                                        MutablePoint pOut)
        Test to see if a line segment intersects a triangle.
        Parameters:
        L0 - The start point on the line segment (origin of the line). May not be null.
        L1 - The end point on the line segment. May not be null.
        V0 - 1st corner point of a triangle. May not be null.
        V1 - 2nd corner point in a counter-clockwise direction. May not be null.
        V2 - 3rd corner point in a counter-clockwise direction. May not be null.
        pOut - A point that will be filled in with the intersection point in this triangle. If there is no intersection with this triangle, then pOut is not modified. Pass null if the intersection point is not required.
        Returns:
        DISJOINT if the line and triangle are disjoint (do not intersect), INTERSECT if there is a unique intersection and COINCIDENT if the line is coincident with the plane of the triangle.
      • lineQuadIntersect

        public static boolean lineQuadIntersect​(GeomPoint L0,
                                                GeomVector Ldir,
                                                GeomPoint quadA,
                                                GeomPoint quadB,
                                                GeomPoint quadC,
                                                GeomPoint quadD,
                                                GeomVector nhat,
                                                MutablePoint sOut)
        Test to see if an infinite line intersects a quadrilateral panel.
        Parameters:
        L0 - A point on the line (origin of the line). May not be null.
        Ldir - The direction vector for the line (does not have to be a unit vector). May not be null.
        quadA - 1st corner point of a quadrilateral panel. May not be null.
        quadB - 2nd corner point in a counter-clockwise direction. May not be null.
        quadC - 3rd corner point in a counter-clockwise direction. May not be null.
        quadD - 4th corner point in a counter-clockwise direction. May not be null.
        nhat - The normal vector for the quadrilateral panel. May not be null.
        sOut - A 2D point that will be filled in with the parametric position of the intersection point in this quad (s, t) where "s" is the fractional distance between corners AB (or DC) and "t" is the fractional distance between corners AD (or BC). If there is no intersection with this panel, then sOut is not modified. Pass null if the parametric position is not required.
        Returns:
        true if the line and quadrilateral panel intersect.
      • planeQuadIntersect

        public static boolean planeQuadIntersect​(GeomPoint P0,
                                                 GeomVector<javax.measure.quantity.Dimensionless> nhat,
                                                 GeomPoint quadA,
                                                 GeomPoint quadB,
                                                 GeomPoint quadC,
                                                 GeomPoint quadD)
        Test to see if an infinite plane intersects a quadrilateral panel.
        Parameters:
        P0 - A reference point in the plane to test for intersection with a quadrilateral panel. May not be null.
        nhat - The unit normal vector for the plane. May not be null.
        quadA - 1st corner point of a quadrilateral panel. May not be null.
        quadB - 2nd corner point in a counter-clockwise direction. May not be null.
        quadC - 3rd corner point in a counter-clockwise direction. May not be null.
        quadD - 4th corner point in a counter-clockwise direction. May not be null.
        Returns:
        true if the plane and quadrilateral panel intersect.
      • detectCorners

        public static int detectCorners​(java.util.List<? extends GeomPoint> points,
                                        double[] sValues,
                                        Parameter<javax.measure.quantity.Length> dmin,
                                        Parameter<javax.measure.quantity.Length> dmax,
                                        Parameter<javax.measure.quantity.Angle> amax)

        Method that detects corners in a a list of 2D points which represent a planar curve. The input array "sValues" is filled in with the sharpness of a corner detected at each point. If no corner is detected at a point, that entry in "sValues" is filled in with Math.PI. The opening angle of a triangle fit to each corner can be calculated as: alpha[i] = Math.PI - sValues[i];.

        Parameters:
        points - A list of at least 2D GeomPoint objects making up a planar curve. If the input points are greater than 2D, then the higher dimensions are simply ignored.
        sValues - An existing array of doubles of size points.size(). The sharpness (in radians) of a corner applied to each point will be stored here.
        dmin - The minimum distance to consider (any points closer together than this are ignored.
        dmax - The maximum distance to consider (any points further apart than this are ignored).
        amax - The maximum opening angle to consider as a corner.
        Returns:
        A count of the number of corners (sharper than amax) detected in the curve.
      • convexHull

        public static PointString<PointconvexHull​(java.util.Collection<? extends GeomPoint> points)
        Return an ordered list of 2D points that represent the convex hull of a collection of unordered 2D points.
        Parameters:
        points - A collection of 2D points to find the convex hull of. If the input points have dimensions > 2, then only the 1st two dimensions are used (higher dimensions are dropped).
        Returns:
        The ordered 2D points representing the convex hull of the input collection of points.
      • convexHullList

        public static GeomList<PointString<Point>> convexHullList​(java.util.List<java.util.Collection<? extends GeomPoint>> listOfPointCollections)
        Return a list of strings of ordered 2D points that represent the 2D convex hulls of each input collection of 2D points. The convex hull for each collection of points in the list will be run concurrently.
        Parameters:
        listOfPointCollections - The list of collections of 2D points to find the convex hull of. If the input points have dimensions > 2, then only the 1st two dimensions are used (higher dimensions are dropped).
        Returns:
        A list of strings of ordered 2D points that represent the convex hull of the input collections of points.