Class GeometryFunctions

java.lang.Object
mgui.interfaces.Utility
mgui.geometry.util.GeometryFunctions

public class GeometryFunctions
extends Utility
Utility class providing a library of common geometric functions. All functions in this class are blocking, meaning that if they need to run in a worker thread, they should be called from that thread.

TODO: All functions should use double for calculations, to minimize rounding errors.

Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    protected static class  GeometryFunctions.AnglePoint2D  
    static class  GeometryFunctions.Point3fComp  
  • Field Summary

    Fields
    Modifier and Type Field Description
    static double error
    Acceptable margin of error
  • Constructor Summary

    Constructors
    Constructor Description
    GeometryFunctions()  
  • Method Summary

    Modifier and Type Method Description
    static int compareDouble​(double a, double b)
    Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
    static int compareDouble​(double a, double b, double error)
    Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
    static int compareFloat​(float a, float b)
    Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
    static int compareFloat​(float a, float b, double error)
    Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
    static int compareToPlane​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
    Determines the position of pt with respect to plane.
    static int compareToPlane​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
    Determines the position of pt with respect to plane.
    static boolean crosses​(Box3D box1, Box3D box2)
    Determines whether the spaces defined by these boxes intersect.
    static boolean crosses​(LineSegment2D l1, LineSegment2D l2)
    Determines whether the line segments l1 and l2 cross.
    static boolean crosses​(LineSegment2D segment, Rect2D rect)  
    static boolean crosses​(Rect2D rect1, Rect2D rect2)  
    static boolean crosses​(Vector2D vector, Rect2D rect)
    Determines whether vector crosses rect.
    static boolean crosses​(Vector2D vector, Rect2D rect, boolean is_infinite)
    Determines whether vector crosses rect.
    static boolean crossesPlane​(Shape3D b, Plane3D p)
    Determines whether plane p crosses box b.
    static org.jogamp.vecmath.Vector3f flipVector​(org.jogamp.vecmath.Vector3f v)
    Flips v.
    static double getAngle​(org.jogamp.vecmath.Point2d p1, org.jogamp.vecmath.Point2d p2)  
    static double getAngle​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2)  
    static double getAngle​(org.jogamp.vecmath.Point2f A, org.jogamp.vecmath.Point2f B, org.jogamp.vecmath.Point2f C)
    Determines the angle between vectors AB and BC.
    static double getAngle​(org.jogamp.vecmath.Point3f A, org.jogamp.vecmath.Point3f B, org.jogamp.vecmath.Point3f C, org.jogamp.vecmath.Point3f D)
    Returns the angle between two triangular faces, defined such that AB is a common edge.
    static double getAngleDiff​(double a1, double a2)  
    static double getAngleDiffCW​(double a1, double a2)  
    static double getAngleTangent​(double a1, double a2)
    Returns an angle tangent to the given node angles in a polygon
    static float getArea​(Polygon2D thisPoly)
    Determines the area of thisPoly.
    static float getArea​(Triangle3D tri)
    Determines the area of triangle tri.
    static float getArea​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, org.jogamp.vecmath.Point3f p3)
    Determines the area of triangle defined by three points.
    static org.jogamp.vecmath.Vector4f getAveragePlane​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
    Return a plane representing the average plane of a set of nodes note, in the degenerative case the average cross product will be zero; thus no plane will be defined.
    static Box3D getBoundingBox​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
    Returns the box (having standard axes) that bounds this set of points.
    static Box3D getBox3D​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
    Returns a Box3D defined by two points
    static org.jogamp.vecmath.Point3f getCenterOfGravity​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
    Returns the center of gravity of this shape, which is the mean of its coordinates.
    static org.jogamp.vecmath.Point3d getCenterOfGravity​(Cube3D thisCube)
    Returns the center of gravity of this shape, which is the mean of its coordinates.
    static org.jogamp.vecmath.Point2f getCenterOfGravity​(Shape2D s)  
    static int getClosestVertex​(Shape2D shape, org.jogamp.vecmath.Point2f point)
    Returns the vertex of shape which is closest to point.
    static int getClosestVertex​(Shape3D shape, org.jogamp.vecmath.Point3f point)
    Returns the vertex of shape which is closest to point.
    static Polygon2D getConvexHull​(java.util.ArrayList<org.jogamp.vecmath.Point2d> points)
    Returns the convex hull of points.
    static Polygon2D getConvexHull2f​(java.util.ArrayList<org.jogamp.vecmath.Point2f> points)
    Returns the convex hull of points.
    static org.jogamp.vecmath.Vector3f getCrossProduct​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, org.jogamp.vecmath.Point3f p3)  
    static org.jogamp.vecmath.Vector3d getCrossProduct​(org.jogamp.vecmath.Vector3d v1, org.jogamp.vecmath.Vector3d v2)  
    static org.jogamp.vecmath.Vector3f getCrossProduct​(org.jogamp.vecmath.Vector3f v1, org.jogamp.vecmath.Vector3f v2)  
    static double getCrossProductDist​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2, org.jogamp.vecmath.Point2f pt3)  
    static java.util.ArrayList<MguiFloat> getCrossProducts​(Polygon2D thisPoly)
    Returns a list of cross-products corresponding the the vertices of thisPoly.
    static org.jogamp.vecmath.Point2f getCubicSplinePt​(org.jogamp.vecmath.Point2f N1, org.jogamp.vecmath.Point2f C1, org.jogamp.vecmath.Point2f N2, org.jogamp.vecmath.Point2f C2, double t)
    Given two nodes N1 and N2 and their control points C1, C2, return a point along the cubic spline function defined by these points, at distance t (where t = 0 at N1 and t = 1 at N2) along the curve.
    static double getDegToRad​(double degAngle)
    Converts degrees to radians.
    static double getDistance​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2)  
    static double getDistance​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
    Calculates the distance from pt to plane, signed with respect to its normal.
    static float getDistance​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
    Calculates the absolute distance from pt to plane
    static double getDotProduct​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2, org.jogamp.vecmath.Point2f pt3)  
    static org.jogamp.vecmath.Point2f getEndpoint​(org.jogamp.vecmath.Point2f startPt, double angle, double length)  
    static org.jogamp.vecmath.Point3f getGeometricCenter​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
    Returns the geometric center of this list of points, which is the center of its bounding box.
    static org.jogamp.vecmath.Point3f getGeometricCenter​(Shape3D shape)
    Returns the geometric center of this list of points, which is the center of its bounding box.
    static org.jogamp.vecmath.Point2f[] getIntersectionEdge​(Triangle3D tri, Plane3D p)
    Returns the edge of intersection for triangle tri with plane p.
    static int[] getIntersectionEdge​(Triangle3D tri, Plane3D p, org.jogamp.vecmath.Point2f[] edge)
    Sets the edge of intersection for triangle tri with plane p.
    static double getIntersectionEdgeRatio​(org.jogamp.vecmath.Point3d pt1, org.jogamp.vecmath.Point3d pt2, Plane3D plane)
    Determines the ratio along the line segment pt1-pt2 at which it intersects plane.
    static float getIntersectionEdgeRatio​(org.jogamp.vecmath.Point3f pt1, org.jogamp.vecmath.Point3f pt2, Plane3D plane)
    Determines the ratio along the line segment pt1-pt2 at which it intersects plane.
    static float getIntersectionEdgeRatio​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D p)  
    static Vector2D getIntersectionLine​(Plane3D plane1, Plane3D plane2)
    Determines the line of intersection between two planes, and returns the result in the 2D coordinate system of plane2.
    static org.jogamp.vecmath.Point2f getIntersectionPoint​(LineSegment2D l1, LineSegment2D l2)  
    static org.jogamp.vecmath.Point2f getIntersectionPoint​(LineSegment2D l1, LineSegment2D l2, boolean test_crossing, boolean is_infinite)
    Returns the intersection point between two lines or line segments.
    static org.jogamp.vecmath.Point2d getIntersectionPoint​(org.jogamp.vecmath.Point3d p1, org.jogamp.vecmath.Point3d p2, Plane3D plane)
    Determine the point at which the line segment described by p1 and p2 intersects plane.
    static org.jogamp.vecmath.Point2d getIntersectionPoint​(org.jogamp.vecmath.Point3d pt, org.jogamp.vecmath.Vector3d v, Plane3D p)
    Determine the point at which the line segment described by pt and v intersects plane p.
    static org.jogamp.vecmath.Point2f getIntersectionPoint​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, Plane3D plane)
    Determine the point at which the line segment described by p1 and p2 intersects plane.
    static org.jogamp.vecmath.Point2f getIntersectionPoint​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f vector, Plane3D plane)
    Determine the point at which the line segment described by pt and v intersects plane p.
    static org.jogamp.vecmath.Point3d getIntersectionPoint3D​(org.jogamp.vecmath.Point3d pt1, org.jogamp.vecmath.Point3d pt2, Plane3D plane)
    Returns point at which the line segment pt1-pt2 intersects plane.
    static org.jogamp.vecmath.Point3f getIntersectionPoint3D​(org.jogamp.vecmath.Point3f pt1, org.jogamp.vecmath.Point3f pt2, Plane3D plane)
    Returns point at which the line segment pt1-pt2 intersects plane.
    static org.jogamp.vecmath.Point3f getIntersectionPoint3D​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D plane)
    Returns point at which the line segment defined by pt1 and v intersects plane.
    static org.jogamp.vecmath.Point3f getIntersectionPoint3D​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Triangle3D tri)
    Determines the point at which the line segment defined by pt and v intersects triangle tri.
    static org.jogamp.vecmath.Point3f[] getIntersectionPoints​(Triangle3D tri, Plane3D plane)
    Determines the points at which tri intersects plane.
    static org.jogamp.vecmath.Point3f[] getIntersectionPoints​(Triangle3D tri, Plane3D plane, boolean include_kiss)
    Determines the points at which tri intersects plane.
    static org.jogamp.vecmath.Point3f[] getIntersectionSegment​(Triangle3D tri1, Triangle3D tri2)
    Determines the line segment defining the seam of where tri1 and tri2 intersect.
    static LineSegment2D getIntersectionSegment​(Vector2D vector, Rect2D rect)
    Calculates a line segment where vector crosses rect.
    static Polygon2D getIsInternalConcavePoly​(Polygon2D poly, org.jogamp.vecmath.Point2f pt)  
    static org.jogamp.vecmath.Matrix4d getJamaMatrixAsMatrix4d​(Jama.Matrix matrix)  
    static org.jogamp.vecmath.Vector3f getMatrixProduct​(org.jogamp.vecmath.Vector3f v, org.jogamp.vecmath.Matrix4f M)
    Multiplies v by M, using only the first 3 x 3 subset of M.
    static org.jogamp.vecmath.Point3f getMaxPt​(Shape3D shape)
    Determines a maximum point max_x, max_y, max_z from shape.
    static org.jogamp.vecmath.Point3f getMaxPt​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
    Determines a maximum point max_x, max_y, max_z from two points.
    static org.jogamp.vecmath.Point2f getMidPoint​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2, double pos)
    Determines the mid-point of the line segment defined by pt1 and pt2, at the position pos, which must range from 0.0 (i.e., at pt1 to 1.0 (i.e., at pt2).
    static org.jogamp.vecmath.Point3f getMidPt​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
    Computes the mid-point of the line segment defined by p1 and p2.
    static double getMinimalAngle​(double thisAngle)  
    static org.jogamp.vecmath.Point3f getMinPt​(Shape3D shape)
    Determines a minimum point min_x, min_y, min_z from shape.
    static org.jogamp.vecmath.Point3f getMinPt​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
    Determines a minimum point min_x, min_y, min_z from two points.
    static int getNearestNeighbour​(org.jogamp.vecmath.Point2f p, java.util.ArrayList<org.jogamp.vecmath.Point2f> nodes)
    Determines the nearest neighbour of p in the list nodes.
    static float[] getNodeAngles​(Polygon2D polygon)
    Returns an array of angles made by each node of polygon
    static java.util.ArrayList<java.lang.Integer> getNodesInsideProjectionLimits​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes, Plane3D plane, float above_limit, float below_limit)
    Determines which points in nodes lie within the projection limits specified by plane, above_limit, and below_limit.
    static org.jogamp.vecmath.Vector2d getNormal​(org.jogamp.vecmath.Point2d p0, org.jogamp.vecmath.Point2d p, org.jogamp.vecmath.Point2d p1, boolean CW)
    Determines the vector normal to the 2D curve at point p, where p0 and p1 are the point before and after p, respectively.
    static org.jogamp.vecmath.Vector2f getNormal​(org.jogamp.vecmath.Point2f p0, org.jogamp.vecmath.Point2f p, org.jogamp.vecmath.Point2f p1, boolean CW)
    Determines the vector normal to the 2D curve at point p, where p0 and p1 are the point before and after p, respectively.
    static java.util.ArrayList<org.jogamp.vecmath.Vector2f> getNormals​(Polygon2D polygon, boolean CW)
    Returns a list of vectors which are the normals to the nodes of polygon, given a direction of normal, indicated by CW (clockwise if true, counterclockwise if false).
    Plane3D getOrthogonalPlane​(Plane3D plane, LineSegment3D line)
    Returns a plane which is orthogonal to plane, with a y-axis defined by line.
    static Plane3D getOrthogonalRegressionPlane​(java.util.ArrayList<org.jogamp.vecmath.Point3f> points)
    Calculates and returns the orthogonal distance regression ("best-fit") plane for a set of points in R3.
    static Plane3D getPlane​(Triangle3D tri)
    Returns a plane containing tri.
    static org.jogamp.vecmath.Vector4f getPlaneEquation​(org.jogamp.vecmath.Point3f p, org.jogamp.vecmath.Vector3f normal)
    Returns a plane equation as a vector {a, b, c, d}, given p, a point in the plane, and normal, its normal vector.
    static GeometryFunctions.Point3fComp getPoint3fComp()  
    static org.jogamp.vecmath.Point3f getPointFromPlane​(org.jogamp.vecmath.Point2f point, Plane3D plane)
    Return a 3D Cartesian coordinate for the specified 2D point in a plane parallel to plane.
    static org.jogamp.vecmath.Point3f getPointFromSection​(Plane3D refPlane, float dist, org.jogamp.vecmath.Point2f point)
    Return a 3D Cartesian coordinate for the specified 2D point in a plane parallel to refPlane, and separated from it by along its normal vector.
    static org.jogamp.vecmath.Point3f getPointFromSection​(org.jogamp.vecmath.Point2f point, Plane3D plane)
    Deprecated.
    Use getPointFromPlane
    static java.util.ArrayList<org.jogamp.vecmath.Point3f> getPointsFromPlane​(java.util.ArrayList<org.jogamp.vecmath.Point2f> points, Plane3D plane)
    Return a set of 3D Cartesian coordinates for the specified 2D points in a plane parallel to plane.
    static Polygon3D getPolygonFromPlane​(Polygon2D poly2d, Plane3D plane)
    Returns a 3D polygon which is the representation of a 2D polygon expressed on the given plane.
    static org.jogamp.vecmath.Point2d getProjectedPoint​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
    Project point pt onto plane plane, along plane's normal vector.
    static org.jogamp.vecmath.Point2f getProjectedPoint​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
    Project point pt onto plane plane, along plane's normal vector.
    static org.jogamp.vecmath.Point2f getProjectedPoint​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f proj, Plane3D plane)
    Project point pt onto plane plane, along plane's normal vector.
    static org.jogamp.vecmath.Point3f getProjectedPoint3D​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
    Project point pt onto plane plane, along plane's normal vector.
    static org.jogamp.vecmath.Point3f getProjectedPoint3D​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D plane)
    Project point pt onto plane plane, along vector v.
    static java.util.ArrayList<org.jogamp.vecmath.Point2f> getProjectedToPlane​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes, Plane3D plane)
    Projects nodes onto plane and returns the 2D points.
    static Triangle2D getProjectedToPlane​(Triangle3D tri, Plane3D plane)
    Projects tri onto plane and returns the 2D triangle.
    static org.jogamp.vecmath.Vector3f getProjectedToPlane​(org.jogamp.vecmath.Vector3f vector, org.jogamp.vecmath.Vector3f normal)
    Projects vector onto a plane with normal normal.
    static org.jogamp.vecmath.Vector2f getProjectedToPlane2D​(org.jogamp.vecmath.Vector3f vector, Plane3D plane)
    Projects vector onto plane plane along its normal.
    static org.jogamp.vecmath.Vector2f getProjectedToPlane2D​(org.jogamp.vecmath.Vector3f vector, org.jogamp.vecmath.Vector3f proj, Plane3D plane)
    Projects vector onto plane plane along its normal.
    static org.jogamp.vecmath.Vector3f getProjectedVector​(org.jogamp.vecmath.Vector3f v, org.jogamp.vecmath.Vector3f u)
    Returns the projection of v onto u.
    static org.jogamp.vecmath.Quat4d getQuaternion​(org.jogamp.vecmath.Vector3d axis, double angle)  
    static double getRadToDeg​(double radAngle)
    Converts radians to degrees.
    static Polygon2D getReversePolygon​(Polygon2D thisPoly)
    Reverses the direction of this polygon (CW -> CCW or vice versa)
    static org.jogamp.vecmath.Vector2d getRotatedVector2D​(org.jogamp.vecmath.Vector2d vector, double angle)
    Rotates vector by angle, specified in radians.
    static org.jogamp.vecmath.Vector2f getRotatedVector2D​(org.jogamp.vecmath.Vector2f vector, double angle)
    Rotates vector by angle, specified in radians.
    static org.jogamp.vecmath.Matrix4d getRotationTransform​(org.jogamp.vecmath.Vector3d axis, double angle)
    Creates a transformation matrix representing a rotation about axis by angle radians.
    static Rect2D getScaledShape​(org.jogamp.vecmath.Point2f scalePt, Rect2D thisRect, double scaleVal)  
    static float[] getSegmentLengths​(Polygon2D polygon)
    Returns a list of the lengths of each segment in polygon.
    static boolean getSegmentsIntersect​(LineSegment2D l1, LineSegment2D l2)
    Determines whether line segments l1 and l2 intersect.
    static boolean[][] getSegmentsIntersect​(Polygon2D poly1, Polygon2D poly2)  
    static double getSignedAngle​(org.jogamp.vecmath.Vector3d v1, org.jogamp.vecmath.Vector3d v2)
    Determines the signed angle that v1 makes with v2.
    static double getSignedDistance​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
    Determines distance from point pt to plane plane.
    static float getSignedDistance​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
    Determines distance from point pt to plane plane.
    static Box3D getUnionBounds​(Box3D b1, Box3D b2)  
    static Rect2D getUnionBounds​(Rect2D r1, Rect2D r2)  
    static Sphere3D getUnionSphere​(Sphere3D s1, Sphere3D s2)
    Returns a sphere that is the union of the two spheres s1 and s2
    static org.jogamp.vecmath.Vector2f getVector​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2)  
    static float getVectorAngle​(org.jogamp.vecmath.Vector2f vector)
    Returns the angle that a 2D vector makes with the x-axis.
    static org.jogamp.vecmath.Point2f getVectorEndpoint​(org.jogamp.vecmath.Point2f startPt, org.jogamp.vecmath.Vector2f vector)
    Returns the endpoint of a vector starting at startPt.
    static org.jogamp.vecmath.Vector3d getVectorFromAngles​(double angleX, double angleY)  
    static org.jogamp.java3d.Transform3D getVectorRotation​(Vector3D vector)
    Determines the rotation that converts [1, 0, 0] to vector.
    static void getVectorTransform​(org.jogamp.vecmath.Matrix4d M, org.jogamp.vecmath.Vector3d v)  
    static java.util.ArrayList<org.jogamp.vecmath.Point3f> getVerticesFromSection​(java.util.ArrayList<org.jogamp.vecmath.Point2f> vertices, Plane3D plane)  
    static double getXAngle​(org.jogamp.vecmath.Vector3d v)  
    static float getXAngle​(org.jogamp.vecmath.Vector3f vector)
    Returns angle of vector with x-axis.
    static org.jogamp.vecmath.Vector4f getXRotation​(org.jogamp.vecmath.Vector4f plane, float r)  
    static double getYAngle​(org.jogamp.vecmath.Vector3d v)  
    static float getYAngle​(org.jogamp.vecmath.Vector3f vector)
    Returns angle of vector with y-axis.
    static org.jogamp.vecmath.Vector4f getYRotation​(org.jogamp.vecmath.Vector4f plane)
    Rotate this plane about the Y axis
    static org.jogamp.vecmath.Vector4f getYRotation​(org.jogamp.vecmath.Vector4f plane, float r)  
    static double getZAngle​(org.jogamp.vecmath.Vector3d v)  
    static float getZAngle​(org.jogamp.vecmath.Vector3f vector)
    Returns angle of vector with z-axis.
    static org.jogamp.vecmath.Vector4f getZRotation​(org.jogamp.vecmath.Vector4f plane)
    Rotate this plane about the Z axis
    static org.jogamp.vecmath.Vector4f getZRotation​(org.jogamp.vecmath.Vector4f plane, float r)  
    static boolean intersects​(Triangle3D tri, Plane3D plane)
    Determines whether triangle intersects plane
    static boolean intersects​(Triangle3D tri1, Triangle3D tri2)
    Determines whether tri1 and tri2 intersect.
    static boolean intersects​(Vector3D vector, org.jogamp.vecmath.Point3f p)
    Determines whether p intersects vector, within the tolerance set for this session instance (GeometryFunctions.error).
    static boolean intersects​(Vector3D vector, org.jogamp.vecmath.Point3f p, double tolerance)
    Determines whether p intersects vector, within the given tolerance.
    static boolean intersects​(org.jogamp.vecmath.Point3f p, org.jogamp.vecmath.Vector3f v, Triangle3D tri)  
    static boolean isAbovePlane​(org.jogamp.vecmath.Point3f pt, Plane3D p)
    Deprecated.
    use compareToPlane
    static boolean isClockwise​(java.util.ArrayList<MguiFloat> crossProducts)
    Determines from a list of vertex-wise cross-products whether a polygon is clockwise or not (i.e., counter-clockwise).
    static boolean isClockwise​(Polygon2D thisPoly)
    Determines whether a polygon is clockwise or not (i.e., counter-clockwise).
    static boolean isClockwise​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2, org.jogamp.vecmath.Point2f p3)
    Determines whether a triangle defined by three 2D points is clockwise or not (i.e., counter-clockwise).
    static boolean isClockwise​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, org.jogamp.vecmath.Point3f p3)
    Determines whether a triangle defined by three 3D points is clockwise or not (i.e., counter-clockwise).
    static boolean isCoincident​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2)
    Determines whether p1 and p2 coincide, within the default tolerance distance GeometryFunctions.error.
    static boolean isCoincident​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2, float tolerance)
    Determines whether p1 and p2 coincide, within the given tolerance distance.
    static boolean isCoincident​(org.jogamp.vecmath.Point3d p1, org.jogamp.vecmath.Point3d p2)
    Determines whether p1 and p2 coincide, within the default tolerance distance GeometryFunctions.error.
    static boolean isCoincident​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
    Determines whether p1 and p2 coincide, within the default tolerance distance GeometryFunctions.error.
    static boolean isConvex​(java.util.ArrayList<MguiFloat> crossProducts)
    Determines from a list of vertex-wise cross-products whether a polygon is convex or not (i.e., concave).
    static boolean isInPlane​(Shape3D s, Plane3D p)
    Determines whether shape s lies in plane p
    static boolean isInPlane​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
    Determines whether point pt lies in plane
    static boolean isInPlane​(org.jogamp.vecmath.Point3d pt, org.jogamp.vecmath.Vector3d v, Plane3D plane)
    Determines whether the given line segment lies in plane.
    static boolean isInPlane​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
    Determines whether point pt lies in plane plane
    static boolean isInPlane​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D plane)
    Determines whether the given line segment lies in plane.
    static boolean isIntermediateAngleCW​(double a_i, double a_1, double a_2)  
    static boolean isInternalConcave​(Polygon2D poly, org.jogamp.vecmath.Point2f pt)
    Tests whether a point pt is contained within the boundary of a polygon poly.
    static boolean isInternalConvex​(Polygon2D poly, org.jogamp.vecmath.Point2f pt)
    Tests whether a point pt is contained within the boundary of a convex polygon poly.
    static boolean isNonZeroVector​(org.jogamp.vecmath.Vector3d v)  
    static boolean isNonZeroVector​(org.jogamp.vecmath.Vector3f v)  
    static boolean isOblique​(double thisAngle)  
    static boolean isObtuse​(Triangle3D tri)
    Determines whether tri is an obtuse triangle.
    static boolean isParallel​(Plane3D plane1, Plane3D plane2)
    Determines whether the two planes are parallel.
    static boolean isValidPoint​(org.jogamp.vecmath.Point2f p)  
    static boolean isValidPoint​(org.jogamp.vecmath.Point3f p)  
    static boolean isValidSphere​(Sphere3D s)  
    static boolean isValidTriangle​(Triangle3D t)  
    static boolean isValidVector​(org.jogamp.vecmath.Vector2f v)  
    static boolean isValidVector​(org.jogamp.vecmath.Vector3d v)  
    static boolean isValidVector​(org.jogamp.vecmath.Vector3f v)  
    static boolean isZero​(org.jogamp.vecmath.Tuple3f tuple)
    Determines whether tuple is of length zero.
    static void rotate​(Shape2D shape, org.jogamp.vecmath.Point2d base_point, double angle)
    Rotates shape about base_point by angle radians.
    static void rotate​(Shape2D shape, org.jogamp.vecmath.Point2f base_point, double angle)
    Rotates shape about base_point by angle radians.
    static void rotate​(Shape3D shape, org.jogamp.vecmath.Point3d base_point, org.jogamp.vecmath.Vector3d axis, double angle)
    Rotates this shape about a base point base_point and an axis axis by angle radians.
    static void rotate​(Shape3D shape, org.jogamp.vecmath.Point3f base_point, org.jogamp.vecmath.Vector3f axis, double angle)
    Rotates this shape about a base point base_point and an axis axis by angle radians.
    static boolean transform​(Shape shape, Jama.Matrix matrix)
    Transforms shape with the given affine transformation Jama matrix matrix.
    static boolean transform​(Shape shape, Jama.Matrix matrix, ProgressUpdater progress)
    Transforms shape with the given affine transformation Jama matrix matrix.
    static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4d matrix)
    Transforms shape with the given affine transformation matrix matrix.
    static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4d matrix, ProgressUpdater progress)
    Transforms shape with the given affine transformation matrix matrix.
    static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4f matrix)
    Transforms shape with the given affine transformation matrix matrix.
    static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4f matrix, ProgressUpdater progress)
    Transforms shape with the given affine transformation matrix matrix.
    static org.jogamp.vecmath.Vector3d transform​(org.jogamp.vecmath.Tuple3d vector, org.jogamp.vecmath.Matrix4d matrix)
    Transforms vector with the given affine transformation matrix matrix.
    static org.jogamp.vecmath.Vector3f transform​(org.jogamp.vecmath.Tuple3f tuple, org.jogamp.vecmath.Matrix4d matrix)
    Transforms vector with the given affine transformation matrix matrix.
    static org.jogamp.vecmath.Vector3f transform​(org.jogamp.vecmath.Tuple3f vector, org.jogamp.vecmath.Matrix4f matrix)
    Transforms vector with the given affine transformation matrix matrix.
    static void translate​(Shape3D shape, double x, double y, double z)
    Translates shape by the specified x, y, and z distances.
    static void translate​(Shape3D shape, org.jogamp.vecmath.Vector3d v)
    Translates shape by the specified vector.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • error

      public static double error
      Acceptable margin of error
  • Constructor Details

    • GeometryFunctions

      public GeometryFunctions()
  • Method Details

    • transform

      public static org.jogamp.vecmath.Vector3d transform​(org.jogamp.vecmath.Tuple3d vector, org.jogamp.vecmath.Matrix4d matrix)
      Transforms vector with the given affine transformation matrix matrix. Ignores the last column.
      Parameters:
      vector -
      matrix -
      Returns:
      the result
    • transform

      public static org.jogamp.vecmath.Vector3f transform​(org.jogamp.vecmath.Tuple3f tuple, org.jogamp.vecmath.Matrix4d matrix)
      Transforms vector with the given affine transformation matrix matrix.
      Parameters:
      vector -
      matrix -
      Returns:
      the result
    • transform

      public static org.jogamp.vecmath.Vector3f transform​(org.jogamp.vecmath.Tuple3f vector, org.jogamp.vecmath.Matrix4f matrix)
      Transforms vector with the given affine transformation matrix matrix.
      Parameters:
      vector -
      matrix -
      Returns:
      the result
    • transform

      public static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4d matrix)
      Transforms shape with the given affine transformation matrix matrix.
      Parameters:
      shape -
      matrix -
      Returns:
    • transform

      public static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4f matrix)
      Transforms shape with the given affine transformation matrix matrix.
      Parameters:
      shape -
      matrix -
      Returns:
    • transform

      public static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4f matrix, ProgressUpdater progress)
      Transforms shape with the given affine transformation matrix matrix. Updates progress_bar with its progress.
      Parameters:
      shape -
      matrix -
      progress_bar -
      Returns:
    • transform

      public static boolean transform​(Shape shape, org.jogamp.vecmath.Matrix4d matrix, ProgressUpdater progress)
      Transforms shape with the given affine transformation matrix matrix. Updates progress_bar with its progress.
      Parameters:
      shape -
      matrix -
      progress_bar -
      Returns:
    • transform

      public static boolean transform​(Shape shape, Jama.Matrix matrix)
      Transforms shape with the given affine transformation Jama matrix matrix.
      Parameters:
      shape -
      matrix -
      Returns:
    • transform

      public static boolean transform​(Shape shape, Jama.Matrix matrix, ProgressUpdater progress)
      Transforms shape with the given affine transformation Jama matrix matrix. Updates progress_bar with its progress.
      Parameters:
      shape -
      matrix -
      progress_bar -
      Returns:
    • getJamaMatrixAsMatrix4d

      public static org.jogamp.vecmath.Matrix4d getJamaMatrixAsMatrix4d​(Jama.Matrix matrix)
    • isZero

      public static boolean isZero​(org.jogamp.vecmath.Tuple3f tuple)
      Determines whether tuple is of length zero.
      Parameters:
      tuple -
      Returns:
    • getVectorAngle

      public static float getVectorAngle​(org.jogamp.vecmath.Vector2f vector)
      Returns the angle that a 2D vector makes with the x-axis. Angle will be expressed on the range [0, 2Pi].
      Parameters:
      vector - - 2D vector to test
      Returns:
      the angle that vector makes with the x-axis
    • getProjectedToPlane2D

      public static org.jogamp.vecmath.Vector2f getProjectedToPlane2D​(org.jogamp.vecmath.Vector3f vector, Plane3D plane)
      Projects vector onto plane plane along its normal. Returns a 2D point in the coordinate system of plane. See http://www.euclideanspace.com/maths/geometry/elements/plane/lineOnPlane/index.htm
      Parameters:
      vector -
      normal -
      Returns:
      the resulting projected vector 2D
    • getProjectedToPlane2D

      public static org.jogamp.vecmath.Vector2f getProjectedToPlane2D​(org.jogamp.vecmath.Vector3f vector, org.jogamp.vecmath.Vector3f proj, Plane3D plane)
      Projects vector onto plane plane along its normal. Returns a 2D point in the coordinate system of plane. See http://www.euclideanspace.com/maths/geometry/elements/plane/lineOnPlane/index.htm
      Parameters:
      vector -
      normal -
      Returns:
      the resulting projected vector 2D
    • getProjectedToPlane

      public static org.jogamp.vecmath.Vector3f getProjectedToPlane​(org.jogamp.vecmath.Vector3f vector, org.jogamp.vecmath.Vector3f normal)
      Projects vector onto a plane with normal normal. See http://www.euclideanspace.com/maths/geometry/elements/plane/lineOnPlane/index.htm
      Parameters:
      vector -
      normal -
      Returns:
      the resulting projection
    • getProjectedToPlane

      public static java.util.ArrayList<org.jogamp.vecmath.Point2f> getProjectedToPlane​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes, Plane3D plane)
      Projects nodes onto plane and returns the 2D points.
    • getProjectedToPlane

      public static Triangle2D getProjectedToPlane​(Triangle3D tri, Plane3D plane)
      Projects tri onto plane and returns the 2D triangle.
    • getMidPt

      public static org.jogamp.vecmath.Point3f getMidPt​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
      Computes the mid-point of the line segment defined by p1 and p2.
      Parameters:
      p1 -
      p2 -
      Returns:
      the mid-point
    • isObtuse

      public static boolean isObtuse​(Triangle3D tri)
      Determines whether tri is an obtuse triangle.
      Parameters:
      tri -
      Returns:
      true if tri is obtuse, false otherwise.
    • translate

      public static void translate​(Shape3D shape, org.jogamp.vecmath.Vector3d v)
      Translates shape by the specified vector.
      Parameters:
      shape -
      x -
      y -
      z -
    • translate

      public static void translate​(Shape3D shape, double x, double y, double z)
      Translates shape by the specified x, y, and z distances.
      Parameters:
      shape -
      x -
      y -
      z -
    • rotate

      public static void rotate​(Shape3D shape, org.jogamp.vecmath.Point3f base_point, org.jogamp.vecmath.Vector3f axis, double angle)
      Rotates this shape about a base point base_point and an axis axis by angle radians.
      Parameters:
      shape - Shape to rotate
      base_point - Point about which to rotate
      axis - Rotation axis
      angle - Angle, in radians
    • rotate

      public static void rotate​(Shape3D shape, org.jogamp.vecmath.Point3d base_point, org.jogamp.vecmath.Vector3d axis, double angle)
      Rotates this shape about a base point base_point and an axis axis by angle radians.
      Parameters:
      shape - Shape to rotate
      base_point - Point about which to rotate
      axis - Rotation axis
      angle - Angle, in radians
    • rotate

      public static void rotate​(Shape2D shape, org.jogamp.vecmath.Point2f base_point, double angle)
      Rotates shape about base_point by angle radians.
      Parameters:
      shape -
      base_point -
      angle -
    • rotate

      public static void rotate​(Shape2D shape, org.jogamp.vecmath.Point2d base_point, double angle)
      Rotates shape about base_point by angle radians.
      Parameters:
      shape -
      base_point -
      angle -
    • getVectorEndpoint

      public static org.jogamp.vecmath.Point2f getVectorEndpoint​(org.jogamp.vecmath.Point2f startPt, org.jogamp.vecmath.Vector2f vector)
      Returns the endpoint of a vector starting at startPt.
      Parameters:
      startPt -
      vector -
      Returns:
      the calculated endpoint.
    • flipVector

      public static org.jogamp.vecmath.Vector3f flipVector​(org.jogamp.vecmath.Vector3f v)
      Flips v.
      Parameters:
      v -
      Returns:
      the flipped vector
    • getSignedAngle

      public static double getSignedAngle​(org.jogamp.vecmath.Vector3d v1, org.jogamp.vecmath.Vector3d v2)
      Determines the signed angle that v1 makes with v2.
      Parameters:
      v1 -
      v2 -
      Returns:
      the signed angle.
    • getQuaternion

      public static org.jogamp.vecmath.Quat4d getQuaternion​(org.jogamp.vecmath.Vector3d axis, double angle)
    • getCrossProducts

      public static java.util.ArrayList<MguiFloat> getCrossProducts​(Polygon2D thisPoly)
      Returns a list of cross-products corresponding the the vertices of thisPoly.
      Parameters:
      thisPoly -
      Returns:
      list of cross-products
    • getProjectedVector

      public static org.jogamp.vecmath.Vector3f getProjectedVector​(org.jogamp.vecmath.Vector3f v, org.jogamp.vecmath.Vector3f u)
      Returns the projection of v onto u. Result is a scalar multiple of u.

      See http://everything2.com/index.pl?node_id=1390247

      Parameters:
      u -
      v -
      Returns:
      the projected vector.
    • getMaxPt

      public static org.jogamp.vecmath.Point3f getMaxPt​(Shape3D shape)
      Determines a maximum point max_x, max_y, max_z from shape.
      Parameters:
      shape -
      Returns:
      the maximum point
    • getMinPt

      public static org.jogamp.vecmath.Point3f getMinPt​(Shape3D shape)
      Determines a minimum point min_x, min_y, min_z from shape.
      Parameters:
      shape -
      Returns:
      the minimum point
    • getMinPt

      public static org.jogamp.vecmath.Point3f getMinPt​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
      Determines a minimum point min_x, min_y, min_z from two points.
      Parameters:
      p1 -
      p2 -
      Returns:
      the minimum point
    • getMaxPt

      public static org.jogamp.vecmath.Point3f getMaxPt​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
      Determines a maximum point max_x, max_y, max_z from two points.
      Parameters:
      p1 -
      p2 -
      Returns:
      the maximum point
    • getArea

      public static float getArea​(Triangle3D tri)
      Determines the area of triangle tri.
      Parameters:
      tri -
      Returns:
      the computed area.
    • getArea

      public static float getArea​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, org.jogamp.vecmath.Point3f p3)
      Determines the area of triangle defined by three points.
      Parameters:
      p1 -
      p2 -
      p3 -
      Returns:
      the computed area.
    • isConvex

      public static boolean isConvex​(java.util.ArrayList<MguiFloat> crossProducts)
      Determines from a list of vertex-wise cross-products whether a polygon is convex or not (i.e., concave).
      Parameters:
      experimental -
      crossProducts -
      Returns:
      true if polygon is convex, false if it is concave.
    • isClockwise

      public static boolean isClockwise​(java.util.ArrayList<MguiFloat> crossProducts)
      Determines from a list of vertex-wise cross-products whether a polygon is clockwise or not (i.e., counter-clockwise).
      Parameters:
      crossProducts -
      Returns:
      true if polygon is clockwise, false if it is counter-clockwise.
    • isClockwise

      public static boolean isClockwise​(Polygon2D thisPoly)
      Determines whether a polygon is clockwise or not (i.e., counter-clockwise).
      Parameters:
      thisPoly -
      Returns:
      true if polygon is clockwise, false if it is counter-clockwise.
    • isClockwise

      public static boolean isClockwise​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, org.jogamp.vecmath.Point3f p3)
      Determines whether a triangle defined by three 3D points is clockwise or not (i.e., counter-clockwise).

      NB --NOT YET IMPLEMENTED--

      Parameters:
      p1 -
      p2 -
      p3 -
      Returns:
      true if polygon is clockwise, false if it is counter-clockwise.
    • isClockwise

      public static boolean isClockwise​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2, org.jogamp.vecmath.Point2f p3)
      Determines whether a triangle defined by three 2D points is clockwise or not (i.e., counter-clockwise).
      Parameters:
      p1 -
      p2 -
      p3 -
      Returns:
      true if polygon is clockwise, false if it is counter-clockwise.
    • getArea

      public static float getArea​(Polygon2D thisPoly)
      Determines the area of thisPoly. Area will be signed, depending on whether polygon is clockwise or not.
      Parameters:
      thisPoly -
      Returns:
      the signed area of polygon
    • getReversePolygon

      public static Polygon2D getReversePolygon​(Polygon2D thisPoly)
      Reverses the direction of this polygon (CW -> CCW or vice versa)
      Parameters:
      thisPoly - polygon to reverse
      Returns:
      new Polygon2D object which is the reversed version of thisPoly
    • getNearestNeighbour

      public static int getNearestNeighbour​(org.jogamp.vecmath.Point2f p, java.util.ArrayList<org.jogamp.vecmath.Point2f> nodes)
      Determines the nearest neighbour of p in the list nodes.
      Parameters:
      p -
      nodes -
      Returns:
      the index of the nearest neighbour
    • getDistance

      public static double getDistance​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2)
    • getAngle

      public static double getAngle​(org.jogamp.vecmath.Point2f A, org.jogamp.vecmath.Point2f B, org.jogamp.vecmath.Point2f C)
      Determines the angle between vectors AB and BC.
      Parameters:
      approved -
      A -
      B -
      C -
      Returns:
      the calculated angle
    • getCrossProductDist

      public static double getCrossProductDist​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2, org.jogamp.vecmath.Point2f pt3)
    • getDotProduct

      public static double getDotProduct​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2, org.jogamp.vecmath.Point2f pt3)
    • isOblique

      public static boolean isOblique​(double thisAngle)
    • getMinimalAngle

      public static double getMinimalAngle​(double thisAngle)
    • getCrossProduct

      public static org.jogamp.vecmath.Vector3d getCrossProduct​(org.jogamp.vecmath.Vector3d v1, org.jogamp.vecmath.Vector3d v2)
    • getCrossProduct

      public static org.jogamp.vecmath.Vector3f getCrossProduct​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, org.jogamp.vecmath.Point3f p3)
    • getCrossProduct

      public static org.jogamp.vecmath.Vector3f getCrossProduct​(org.jogamp.vecmath.Vector3f v1, org.jogamp.vecmath.Vector3f v2)
    • getScaledShape

      public static Rect2D getScaledShape​(org.jogamp.vecmath.Point2f scalePt, Rect2D thisRect, double scaleVal)
    • getAngleDiff

      public static double getAngleDiff​(double a1, double a2)
    • getCenterOfGravity

      public static org.jogamp.vecmath.Point2f getCenterOfGravity​(Shape2D s)
    • getAngleTangent

      public static double getAngleTangent​(double a1, double a2)
      Returns an angle tangent to the given node angles in a polygon
      Parameters:
      a1 - angle at previous node
      a2 - angle at this node
      Returns:
      tangential angle
    • getMidPoint

      public static org.jogamp.vecmath.Point2f getMidPoint​(org.jogamp.vecmath.Point2f pt1, org.jogamp.vecmath.Point2f pt2, double pos)
      Determines the mid-point of the line segment defined by pt1 and pt2, at the position pos, which must range from 0.0 (i.e., at pt1 to 1.0 (i.e., at pt2).
      Parameters:
      pt1 -
      pt2 -
      pos -
      Returns:
      null if pos is not in the range [0,1]; the mid-point otherwise.
    • getEndpoint

      public static org.jogamp.vecmath.Point2f getEndpoint​(org.jogamp.vecmath.Point2f startPt, double angle, double length)
    • getCubicSplinePt

      public static org.jogamp.vecmath.Point2f getCubicSplinePt​(org.jogamp.vecmath.Point2f N1, org.jogamp.vecmath.Point2f C1, org.jogamp.vecmath.Point2f N2, org.jogamp.vecmath.Point2f C2, double t)
      Given two nodes N1 and N2 and their control points C1, C2, return a point along the cubic spline function defined by these points, at distance t (where t = 0 at N1 and t = 1 at N2) along the curve.
      Parameters:
      N1 - first node
      C1 - first control point
      N2 - second node
      C2 - second control point
      t - distance parameter
      Returns:
      Point2f representing the point on the cubic spline curve defined by these parameters.
    • getAngle

      public static double getAngle​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2)
    • getAngle

      public static double getAngle​(org.jogamp.vecmath.Point3f A, org.jogamp.vecmath.Point3f B, org.jogamp.vecmath.Point3f C, org.jogamp.vecmath.Point3f D)
      Returns the angle between two triangular faces, defined such that AB is a common edge.
      Parameters:
      A -
      B -
      C -
      D -
      Returns:
      angle between faces ABC and ABD
    • getVectorFromAngles

      public static org.jogamp.vecmath.Vector3d getVectorFromAngles​(double angleX, double angleY)
    • getXAngle

      public static double getXAngle​(org.jogamp.vecmath.Vector3d v)
    • getYAngle

      public static double getYAngle​(org.jogamp.vecmath.Vector3d v)
    • getZAngle

      public static double getZAngle​(org.jogamp.vecmath.Vector3d v)
    • getXAngle

      public static float getXAngle​(org.jogamp.vecmath.Vector3f vector)
      Returns angle of vector with x-axis.
      Parameters:
      vector -
      Returns:
    • getYAngle

      public static float getYAngle​(org.jogamp.vecmath.Vector3f vector)
      Returns angle of vector with y-axis.
      Parameters:
      vector -
      Returns:
    • getZAngle

      public static float getZAngle​(org.jogamp.vecmath.Vector3f vector)
      Returns angle of vector with z-axis.
      Parameters:
      vector -
      Returns:
    • getSegmentLengths

      public static float[] getSegmentLengths​(Polygon2D polygon)
      Returns a list of the lengths of each segment in polygon.
      Parameters:
      polygon -
      Returns:
      a list of segment lengths, starting with segment [0,1]
    • getVectorTransform

      public static void getVectorTransform​(org.jogamp.vecmath.Matrix4d M, org.jogamp.vecmath.Vector3d v)
    • getRotationTransform

      public static org.jogamp.vecmath.Matrix4d getRotationTransform​(org.jogamp.vecmath.Vector3d axis, double angle)
      Creates a transformation matrix representing a rotation about axis by angle radians.

      See http://en.wikipedia.org/wiki/Rotation_matrix

      Parameters:
      axis -
      angle -
      Returns:
    • getVectorRotation

      public static org.jogamp.java3d.Transform3D getVectorRotation​(Vector3D vector)
      Determines the rotation that converts [1, 0, 0] to vector.
      Parameters:
      v -
      Returns:
    • getNodeAngles

      public static float[] getNodeAngles​(Polygon2D polygon)
      Returns an array of angles made by each node of polygon
      Parameters:
      polygon - The polygon for which to determine angles
      Returns:
      a list of angles, starting at the angle made for node 0
    • getSegmentsIntersect

      public static boolean getSegmentsIntersect​(LineSegment2D l1, LineSegment2D l2)
      Determines whether line segments l1 and l2 intersect.
      Parameters:
      l1 -
      l2 -
      Returns:
      true if they intersect, false if not.
    • getDegToRad

      public static double getDegToRad​(double degAngle)
      Converts degrees to radians.
      Parameters:
      degAngle -
      Returns:
      the converted value.
    • getRadToDeg

      public static double getRadToDeg​(double radAngle)
      Converts radians to degrees.
      Parameters:
      radAngle -
      Returns:
      the converted value.
    • getRotatedVector2D

      public static org.jogamp.vecmath.Vector2f getRotatedVector2D​(org.jogamp.vecmath.Vector2f vector, double angle)
      Rotates vector by angle, specified in radians.
      Parameters:
      vector - vector to rotate
      angle - in radians
      Returns:
      rotated vector
    • getRotatedVector2D

      public static org.jogamp.vecmath.Vector2d getRotatedVector2D​(org.jogamp.vecmath.Vector2d vector, double angle)
      Rotates vector by angle, specified in radians.
      Parameters:
      vector - vector to rotate
      angle - in radians
      Returns:
      rotated vector
    • isCoincident

      public static boolean isCoincident​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2, float tolerance)
      Determines whether p1 and p2 coincide, within the given tolerance distance.
      Parameters:
      p1 -
      p2 -
      tolerance -
      Returns:
    • isCoincident

      public static boolean isCoincident​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2)
      Determines whether p1 and p2 coincide, within the default tolerance distance GeometryFunctions.error.
      Parameters:
      p1 -
      p2 -
      tolerance -
      Returns:
    • isCoincident

      public static boolean isCoincident​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
      Determines whether p1 and p2 coincide, within the default tolerance distance GeometryFunctions.error.
      Parameters:
      p1 -
      p2 -
      tolerance -
      Returns:
    • isCoincident

      public static boolean isCoincident​(org.jogamp.vecmath.Point3d p1, org.jogamp.vecmath.Point3d p2)
      Determines whether p1 and p2 coincide, within the default tolerance distance GeometryFunctions.error.
      Parameters:
      p1 -
      p2 -
      tolerance -
      Returns:
    • isIntermediateAngleCW

      public static boolean isIntermediateAngleCW​(double a_i, double a_1, double a_2)
    • getAngleDiffCW

      public static double getAngleDiffCW​(double a1, double a2)
    • getUnionBounds

      public static Box3D getUnionBounds​(Box3D b1, Box3D b2)
    • getUnionBounds

      public static Rect2D getUnionBounds​(Rect2D r1, Rect2D r2)
    • getPointFromSection

      public static org.jogamp.vecmath.Point3f getPointFromSection​(Plane3D refPlane, float dist, org.jogamp.vecmath.Point2f point)
      Return a 3D Cartesian coordinate for the specified 2D point in a plane parallel to refPlane, and separated from it by along its normal vector.
      Parameters:
      refPlane - reference plane
      dist - distance of this point's plane from reference plane
      point - 2D point to determine 3D coordinates for
      Returns:
      Point3d representing the location of this 2D point in 3D space
    • getPointFromSection

      @Deprecated public static org.jogamp.vecmath.Point3f getPointFromSection​(org.jogamp.vecmath.Point2f point, Plane3D plane)
      Deprecated.
      Use getPointFromPlane
      Parameters:
      point -
      plane -
      Returns:
    • getPointsFromPlane

      public static java.util.ArrayList<org.jogamp.vecmath.Point3f> getPointsFromPlane​(java.util.ArrayList<org.jogamp.vecmath.Point2f> points, Plane3D plane)
      Return a set of 3D Cartesian coordinates for the specified 2D points in a plane parallel to plane.
      Parameters:
      plane - reference plane
      points - 2D points to determine 3D coordinates for
      Returns:
      array of Point3f representing the location of this 2D point in R3
    • getPolygonFromPlane

      public static Polygon3D getPolygonFromPlane​(Polygon2D poly2d, Plane3D plane)
      Returns a 3D polygon which is the representation of a 2D polygon expressed on the given plane.
      Parameters:
      poly2d -
      plane -
      Returns:
    • getPointFromPlane

      public static org.jogamp.vecmath.Point3f getPointFromPlane​(org.jogamp.vecmath.Point2f point, Plane3D plane)
      Return a 3D Cartesian coordinate for the specified 2D point in a plane parallel to plane.
      Parameters:
      plane - reference plane
      point - 2D point to determine 3D coordinates for
      Returns:
      Point3f representing the location of this 2D point in R3
    • getVerticesFromSection

      public static java.util.ArrayList<org.jogamp.vecmath.Point3f> getVerticesFromSection​(java.util.ArrayList<org.jogamp.vecmath.Point2f> vertices, Plane3D plane)
    • getCenterOfGravity

      public static org.jogamp.vecmath.Point3d getCenterOfGravity​(Cube3D thisCube)
      Returns the center of gravity of this shape, which is the mean of its coordinates. Compare to getGeometricCenter(java.util.ArrayList<org.jogamp.vecmath.Point3f>).
      Parameters:
      vertices -
      Returns:
    • getCenterOfGravity

      public static org.jogamp.vecmath.Point3f getCenterOfGravity​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
      Returns the center of gravity of this shape, which is the mean of its coordinates. Compare to getGeometricCenter(java.util.ArrayList<org.jogamp.vecmath.Point3f>).
      Parameters:
      nodes -
      Returns:
    • getGeometricCenter

      public static org.jogamp.vecmath.Point3f getGeometricCenter​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
      Returns the geometric center of this list of points, which is the center of its bounding box.
      Parameters:
      nodes -
      Returns:
    • getGeometricCenter

      public static org.jogamp.vecmath.Point3f getGeometricCenter​(Shape3D shape)
      Returns the geometric center of this list of points, which is the center of its bounding box.
      Parameters:
      shape -
      Returns:
    • getBoundingBox

      public static Box3D getBoundingBox​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
      Returns the box (having standard axes) that bounds this set of points.
      Parameters:
      nodes -
      Returns:
      the box, or null if nodes has less than two nodes.
    • getUnionSphere

      public static Sphere3D getUnionSphere​(Sphere3D s1, Sphere3D s2)
      Returns a sphere that is the union of the two spheres s1 and s2
      Parameters:
      s1 -
      s2 -
      Returns:
    • isValidPoint

      public static boolean isValidPoint​(org.jogamp.vecmath.Point3f p)
    • isValidPoint

      public static boolean isValidPoint​(org.jogamp.vecmath.Point2f p)
    • isValidVector

      public static boolean isValidVector​(org.jogamp.vecmath.Vector3d v)
    • isValidVector

      public static boolean isValidVector​(org.jogamp.vecmath.Vector3f v)
    • isValidVector

      public static boolean isValidVector​(org.jogamp.vecmath.Vector2f v)
    • isNonZeroVector

      public static boolean isNonZeroVector​(org.jogamp.vecmath.Vector3d v)
    • isNonZeroVector

      public static boolean isNonZeroVector​(org.jogamp.vecmath.Vector3f v)
    • isValidSphere

      public static boolean isValidSphere​(Sphere3D s)
    • isValidTriangle

      public static boolean isValidTriangle​(Triangle3D t)
    • getAveragePlane

      public static org.jogamp.vecmath.Vector4f getAveragePlane​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
      Return a plane representing the average plane of a set of nodes note, in the degenerative case the average cross product will be zero; thus no plane will be defined. This should be handled.
      Parameters:
      nodes - an ArrayList of Point3f nodes for which to calculate the plane
      Returns:
      the average plane specified as a Vector4f
    • getZRotation

      public static org.jogamp.vecmath.Vector4f getZRotation​(org.jogamp.vecmath.Vector4f plane)
      Rotate this plane about the Z axis
      Parameters:
      plane - to be rotated
      Returns:
      Vector4f representing rotated plane
    • getYRotation

      public static org.jogamp.vecmath.Vector4f getYRotation​(org.jogamp.vecmath.Vector4f plane)
      Rotate this plane about the Y axis
      Parameters:
      plane - to be rotated
      Returns:
      Vector4f representing rotated plane
    • getYRotation

      public static org.jogamp.vecmath.Vector4f getYRotation​(org.jogamp.vecmath.Vector4f plane, float r)
    • getXRotation

      public static org.jogamp.vecmath.Vector4f getXRotation​(org.jogamp.vecmath.Vector4f plane, float r)
    • getZRotation

      public static org.jogamp.vecmath.Vector4f getZRotation​(org.jogamp.vecmath.Vector4f plane, float r)
    • crossesPlane

      public static boolean crossesPlane​(Shape3D b, Plane3D p)
      Determines whether plane p crosses box b.
      Parameters:
      s -
      p -
      Returns:
      true if it crosses, false otherwise
    • isAbovePlane

      @Deprecated public static boolean isAbovePlane​(org.jogamp.vecmath.Point3f pt, Plane3D p)
      Deprecated.
      use compareToPlane
      Determines whether point pt is located above plane p.
      Parameters:
      pt -
      p -
      Returns:
    • compareToPlane

      public static int compareToPlane​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
      Determines the position of pt with respect to plane.
      Parameters:
      pt -
      plane -
      Returns:
      -1 if pt is below plane, 0 if it is on plane (within the error limits), and 1 if it is above plane
    • compareToPlane

      public static int compareToPlane​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
      Determines the position of pt with respect to plane.
      Parameters:
      pt -
      plane -
      Returns:
      -1 if pt is below plane, 0 if it is on plane, and 1 if it is above plane
    • getMatrixProduct

      public static org.jogamp.vecmath.Vector3f getMatrixProduct​(org.jogamp.vecmath.Vector3f v, org.jogamp.vecmath.Matrix4f M)
      Multiplies v by M, using only the first 3 x 3 subset of M.
      Parameters:
      v -
      M -
      Returns:
    • getOrthogonalPlane

      public Plane3D getOrthogonalPlane​(Plane3D plane, LineSegment3D line)
      Returns a plane which is orthogonal to plane, with a y-axis defined by line.
      Parameters:
      plane -
      line -
      Returns:
    • isInPlane

      public static boolean isInPlane​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D plane)
      Determines whether the given line segment lies in plane.
      Parameters:
      pt -
      v -
      p -
      Returns:
    • isInPlane

      public static boolean isInPlane​(org.jogamp.vecmath.Point3d pt, org.jogamp.vecmath.Vector3d v, Plane3D plane)
      Determines whether the given line segment lies in plane.
      Parameters:
      pt -
      v -
      p -
      Returns:
    • isInPlane

      public static boolean isInPlane​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
      Determines whether point pt lies in plane plane
      Parameters:
      pt -
      plane -
      Returns:
      true if pt lies in plane, false otherwise.
    • isInPlane

      public static boolean isInPlane​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
      Determines whether point pt lies in plane
      Parameters:
      pt -
      plane -
      Returns:
      true if pt lies in plane, false otherwise.
    • isInPlane

      public static boolean isInPlane​(Shape3D s, Plane3D p)
      Determines whether shape s lies in plane p
      Parameters:
      pt -
      p -
      Returns:
    • getSignedDistance

      public static float getSignedDistance​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
      Determines distance from point pt to plane plane. The sign of the result specifies on which side of the plane the point is located; i.e., with respect to the direction of its normal vector.
      Parameters:
      pt -
      plane -
      Returns:
      the calculated distance.
    • getSignedDistance

      public static double getSignedDistance​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
      Determines distance from point pt to plane plane.
      Parameters:
      pt -
      plane -
      Returns:
      the calculated distance.
    • getDistance

      public static float getDistance​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
      Calculates the absolute distance from pt to plane
      Parameters:
      pt -
      plane -
      Returns:
    • getDistance

      public static double getDistance​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
      Calculates the distance from pt to plane, signed with respect to its normal.
      Parameters:
      pt -
      plane -
      Returns:
    • getProjectedPoint

      public static org.jogamp.vecmath.Point2f getProjectedPoint​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
      Project point pt onto plane plane, along plane's normal vector. Return a Point2f whose coordinates are relative to plane's base point and x- and y-axes.
      Parameters:
      pt -
      plane -
      Returns:
    • getProjectedPoint

      public static org.jogamp.vecmath.Point2d getProjectedPoint​(org.jogamp.vecmath.Point3d pt, Plane3D plane)
      Project point pt onto plane plane, along plane's normal vector. Return a Point2f whose coordinates are relative to plane's base point and x- and y-axes.
      Parameters:
      pt -
      plane -
      Returns:
    • getProjectedPoint

      public static org.jogamp.vecmath.Point2f getProjectedPoint​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f proj, Plane3D plane)
      Project point pt onto plane plane, along plane's normal vector. Return a Point2f whose coordinates are relative to plane's base point and x- and y-axes.
      Parameters:
      pt -
      plane -
      Returns:
    • getProjectedPoint3D

      public static org.jogamp.vecmath.Point3f getProjectedPoint3D​(org.jogamp.vecmath.Point3f pt, Plane3D plane)
      Project point pt onto plane plane, along plane's normal vector.
      Parameters:
      pt -
      plane -
      Returns:
      Point3f
    • getProjectedPoint3D

      public static org.jogamp.vecmath.Point3f getProjectedPoint3D​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D plane)
      Project point pt onto plane plane, along vector v.
      Parameters:
      pt -
      plane -
      Returns:
      Point3f
    • compareFloat

      public static int compareFloat​(float a, float b)
      Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
      Parameters:
      a -
      b -
      Returns:
    • compareFloat

      public static int compareFloat​(float a, float b, double error)
      Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
      Parameters:
      a -
      b -
      Returns:
    • compareDouble

      public static int compareDouble​(double a, double b)
      Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
      Parameters:
      a -
      b -
      Returns:
    • compareDouble

      public static int compareDouble​(double a, double b, double error)
      Returns -1 if a < b, 0 if a = b, +1 if a > b, within the limits of error.
      Parameters:
      a -
      b -
      Returns:
    • getSegmentsIntersect

      public static boolean[][] getSegmentsIntersect​(Polygon2D poly1, Polygon2D poly2)
    • getIntersectionSegment

      public static LineSegment2D getIntersectionSegment​(Vector2D vector, Rect2D rect)
      Calculates a line segment where vector crosses rect. Treats vector as an infinite line. Returns null if vector does not cross rect.
      Parameters:
      vector -
      rect -
      Returns:
    • crosses

      public static boolean crosses​(Vector2D vector, Rect2D rect)
      Determines whether vector crosses rect. Vector is treated as a line segment.
      Parameters:
      vector -
      rect -
      Returns:
    • crosses

      public static boolean crosses​(Vector2D vector, Rect2D rect, boolean is_infinite)
      Determines whether vector crosses rect. The is_infinite flag indicates whether vector should be treated as a line or a segment.
      Parameters:
      vector -
      rect -
      Returns:
    • crosses

      public static boolean crosses​(LineSegment2D segment, Rect2D rect)
    • crosses

      public static boolean crosses​(Box3D box1, Box3D box2)
      Determines whether the spaces defined by these boxes intersect.
      Parameters:
      box1 -
      box2 -
      Returns:
    • isParallel

      public static boolean isParallel​(Plane3D plane1, Plane3D plane2)
      Determines whether the two planes are parallel.
      Parameters:
      plane1 -
      plane2 -
      Returns:
    • getIntersectionLine

      public static Vector2D getIntersectionLine​(Plane3D plane1, Plane3D plane2)
      Determines the line of intersection between two planes, and returns the result in the 2D coordinate system of plane2. If the planes are parallel, returns null.
      Parameters:
      plane1 -
      plane2 -
      Returns:
    • getIntersectionPoint

      public static org.jogamp.vecmath.Point2f getIntersectionPoint​(LineSegment2D l1, LineSegment2D l2)
    • getIntersectionPoint

      public static org.jogamp.vecmath.Point2f getIntersectionPoint​(LineSegment2D l1, LineSegment2D l2, boolean test_crossing, boolean is_infinite)
      Returns the intersection point between two lines or line segments.

      See http://en.wikipedia.org/wiki/Line-line_intersection

      Parameters:
      l1 -
      l2 -
      test_crossing -
      is_infinite -
      Returns:
    • getClosestVertex

      public static int getClosestVertex​(Shape2D shape, org.jogamp.vecmath.Point2f point)
      Returns the vertex of shape which is closest to point.
      Parameters:
      shape -
      point -
      Returns:
    • getClosestVertex

      public static int getClosestVertex​(Shape3D shape, org.jogamp.vecmath.Point3f point)
      Returns the vertex of shape which is closest to point.
      Parameters:
      shape -
      point -
      Returns:
    • getIntersectionPoint

      public static org.jogamp.vecmath.Point2f getIntersectionPoint​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f vector, Plane3D plane)
      Determine the point at which the line segment described by pt and v intersects plane p. Return intersection point, or null if segment does not intersect plane.
      Parameters:
      pt -
      v -
      p -
      Returns:
    • getIntersectionPoint

      public static org.jogamp.vecmath.Point2f getIntersectionPoint​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2, Plane3D plane)
      Determine the point at which the line segment described by p1 and p2 intersects plane. Returns intersection point in plane coordinates, or null if segment does not intersect plane.
      Parameters:
      pt -
      v -
      p -
      Returns:
    • getIntersectionPoint

      public static org.jogamp.vecmath.Point2d getIntersectionPoint​(org.jogamp.vecmath.Point3d p1, org.jogamp.vecmath.Point3d p2, Plane3D plane)
      Determine the point at which the line segment described by p1 and p2 intersects plane. Returns intersection point in plane coordinates, or null if segment does not intersect plane.
      Parameters:
      pt -
      v -
      p -
      Returns:
    • getIntersectionPoint

      public static org.jogamp.vecmath.Point2d getIntersectionPoint​(org.jogamp.vecmath.Point3d pt, org.jogamp.vecmath.Vector3d v, Plane3D p)
      Determine the point at which the line segment described by pt and v intersects plane p. Return intersection point, or null if segment does not intersect plane.
      Parameters:
      pt -
      v -
      p -
      Returns:
    • getIntersectionPoint3D

      public static org.jogamp.vecmath.Point3f getIntersectionPoint3D​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Triangle3D tri)
      Determines the point at which the line segment defined by pt and v intersects triangle tri. Returns null if there is no intersection.
      Parameters:
      pt -
      v -
      tri -
      Returns:
      point of intersection, or null if there is no intersection
    • getIntersectionPoint3D

      public static org.jogamp.vecmath.Point3f getIntersectionPoint3D​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D plane)
      Returns point at which the line segment defined by pt1 and v intersects plane. Returns null if segment does not intersect the plane.
      Parameters:
      pt1 -
      pt2 -
      plane -
      Returns:
    • getIntersectionPoint3D

      public static org.jogamp.vecmath.Point3f getIntersectionPoint3D​(org.jogamp.vecmath.Point3f pt1, org.jogamp.vecmath.Point3f pt2, Plane3D plane)
      Returns point at which the line segment pt1-pt2 intersects plane. Returns null if segment does not intersect the plane.
      Parameters:
      pt1 -
      pt2 -
      plane -
      Returns:
    • getIntersectionPoint3D

      public static org.jogamp.vecmath.Point3d getIntersectionPoint3D​(org.jogamp.vecmath.Point3d pt1, org.jogamp.vecmath.Point3d pt2, Plane3D plane)
      Returns point at which the line segment pt1-pt2 intersects plane. Returns null if segment does not intersect the plane.
      Parameters:
      pt1 -
      pt2 -
      plane -
      Returns:
    • getIntersectionEdgeRatio

      public static float getIntersectionEdgeRatio​(org.jogamp.vecmath.Point3f pt, org.jogamp.vecmath.Vector3f v, Plane3D p)
    • getIntersectionEdgeRatio

      public static float getIntersectionEdgeRatio​(org.jogamp.vecmath.Point3f pt1, org.jogamp.vecmath.Point3f pt2, Plane3D plane)
      Determines the ratio along the line segment pt1-pt2 at which it intersects plane. Returns -1 if this segment does not cross plane.
      Parameters:
      pt1 -
      pt2 -
      plane -
      Returns:
      the ratio along the line segment pt1-pt2 at which it intersects plane. Returns -1 if this segment does not cross plane.
    • getIntersectionEdgeRatio

      public static double getIntersectionEdgeRatio​(org.jogamp.vecmath.Point3d pt1, org.jogamp.vecmath.Point3d pt2, Plane3D plane)
      Determines the ratio along the line segment pt1-pt2 at which it intersects plane. Returns -1 if this segment does not cross plane.
      Parameters:
      pt1 -
      pt2 -
      plane -
      Returns:
      the ratio along the line segment pt1-pt2 at which it intersects plane. Returns -1 if this segment does not cross plane.
    • getIntersectionEdge

      public static int[] getIntersectionEdge​(Triangle3D tri, Plane3D p, org.jogamp.vecmath.Point2f[] edge)
      Sets the edge of intersection for triangle tri with plane p. Returns a two-element integer array indicating which sides intersected the plane, and sets the edge parameter to the 2D planar coordinates of the intersection
      Parameters:
      tri -
      p -
      edge -
      Returns:
      two-element integer array indicating which sides intersected the plane
    • isInternalConvex

      public static boolean isInternalConvex​(Polygon2D poly, org.jogamp.vecmath.Point2f pt)
      Tests whether a point pt is contained within the boundary of a convex polygon poly. If polygon is concave, or its concavity is unknown, the method isInternalConcave() should be used.
      Parameters:
      poly -
      pt -
      Returns:
    • getVector

      public static org.jogamp.vecmath.Vector2f getVector​(org.jogamp.vecmath.Point2f p1, org.jogamp.vecmath.Point2f p2)
    • isInternalConcave

      public static boolean isInternalConcave​(Polygon2D poly, org.jogamp.vecmath.Point2f pt)
      Tests whether a point pt is contained within the boundary of a polygon poly. Polygon may be convex or concave; if it is known to be convex, the method isInternalConvex() should be used.
      Parameters:
      poly -
      pt -
      Returns:
    • getIsInternalConcavePoly

      public static Polygon2D getIsInternalConcavePoly​(Polygon2D poly, org.jogamp.vecmath.Point2f pt)
    • getIntersectionEdge

      public static org.jogamp.vecmath.Point2f[] getIntersectionEdge​(Triangle3D tri, Plane3D p)
      Returns the edge of intersection for triangle tri with plane p. Returns null if triangle does not intersect the plane.
      Parameters:
      tri -
      p -
      Returns:
      array of two Point2f objects representing the planar coordinates of the edge
    • getPoint3fComp

      public static GeometryFunctions.Point3fComp getPoint3fComp()
    • intersects

      public static boolean intersects​(Triangle3D tri, Plane3D plane)
      Determines whether triangle intersects plane
      Parameters:
      tri -
      plane -
      Returns:
      true if it does, false otherwise
    • intersects

      public static boolean intersects​(Triangle3D tri1, Triangle3D tri2)
      Determines whether tri1 and tri2 intersect.
      Parameters:
      tri1 -
      tri2 -
      Returns:
    • getIntersectionSegment

      public static org.jogamp.vecmath.Point3f[] getIntersectionSegment​(Triangle3D tri1, Triangle3D tri2)
      Determines the line segment defining the seam of where tri1 and tri2 intersect. Returns null if they do not intersect.
      Parameters:
      tri1 -
      tri2 -
      Returns:
    • getBox3D

      public static Box3D getBox3D​(org.jogamp.vecmath.Point3f p1, org.jogamp.vecmath.Point3f p2)
      Returns a Box3D defined by two points
      Parameters:
      p1 -
      p2 -
      Returns:
    • getIntersectionPoints

      public static org.jogamp.vecmath.Point3f[] getIntersectionPoints​(Triangle3D tri, Plane3D plane)
      Determines the points at which tri intersects plane. Returns null if it does not intersect; this includes the case where an edge of one triangle is exactly on the plane of (kissing) the other.
      Parameters:
      tri -
      plane -
      Returns:
    • getIntersectionPoints

      public static org.jogamp.vecmath.Point3f[] getIntersectionPoints​(Triangle3D tri, Plane3D plane, boolean include_kiss)
      Determines the points at which tri intersects plane. Returns null if it does not intersect; include_kiss specifies whether to include the case where an edge of one triangle is exactly on the plane of (kissing) the other.
      Parameters:
      tri -
      plane -
      Returns:
    • intersects

      public static boolean intersects​(org.jogamp.vecmath.Point3f p, org.jogamp.vecmath.Vector3f v, Triangle3D tri)
    • intersects

      public static boolean intersects​(Vector3D vector, org.jogamp.vecmath.Point3f p)
      Determines whether p intersects vector, within the tolerance set for this session instance (GeometryFunctions.error).
      Parameters:
      vector -
      p -
      Returns:
    • intersects

      public static boolean intersects​(Vector3D vector, org.jogamp.vecmath.Point3f p, double tolerance)
      Determines whether p intersects vector, within the given tolerance.
      Parameters:
      vector -
      p -
      tolerance -
      Returns:
    • getPlaneEquation

      public static org.jogamp.vecmath.Vector4f getPlaneEquation​(org.jogamp.vecmath.Point3f p, org.jogamp.vecmath.Vector3f normal)
      Returns a plane equation as a vector {a, b, c, d}, given p, a point in the plane, and normal, its normal vector.

      See also the Wolfram definition.

      Parameters:
      p -
      normal -
      Returns:
    • getConvexHull2f

      public static Polygon2D getConvexHull2f​(java.util.ArrayList<org.jogamp.vecmath.Point2f> points)
      Returns the convex hull of points.
      Parameters:
      points -
      Returns:
    • getConvexHull

      public static Polygon2D getConvexHull​(java.util.ArrayList<org.jogamp.vecmath.Point2d> points)
      Returns the convex hull of points.
      Parameters:
      points - the points from which to construct a convex hull
      Returns:
      the 2D convex hull
    • getAngle

      public static double getAngle​(org.jogamp.vecmath.Point2d p1, org.jogamp.vecmath.Point2d p2)
    • getPlane

      public static Plane3D getPlane​(Triangle3D tri)
      Returns a plane containing tri.
      Parameters:
      tri -
      Returns:
    • crosses

      public static boolean crosses​(LineSegment2D l1, LineSegment2D l2)
      Determines whether the line segments l1 and l2 cross.
      Parameters:
      l1 -
      l2 -
      Returns:
    • crosses

      public static boolean crosses​(Rect2D rect1, Rect2D rect2)
    • getOrthogonalRegressionPlane

      public static Plane3D getOrthogonalRegressionPlane​(java.util.ArrayList<org.jogamp.vecmath.Point3f> points)
      Calculates and returns the orthogonal distance regression ("best-fit") plane for a set of points in R3. See http://mathforum.org/library/drmath/view/63765.html for a description of this algorithm.
      Parameters:
      points - Array of points, where n > 1 (otherwise returns null)
      Returns:
      Plane3D corresponding to the regression plane
    • getNodesInsideProjectionLimits

      public static java.util.ArrayList<java.lang.Integer> getNodesInsideProjectionLimits​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes, Plane3D plane, float above_limit, float below_limit)
      Determines which points in nodes lie within the projection limits specified by plane, above_limit, and below_limit. Vectors are normalized to unit vectors.
      Parameters:
      nodes -
      plane -
      above_limit - distance along this plane's normal
      below_limit - distance along the flipped normal
      Returns:
      list of Integers specifying which nodes are inside the limits (0), above the limits (1), or below the limits (-1)
    • getNormals

      public static java.util.ArrayList<org.jogamp.vecmath.Vector2f> getNormals​(Polygon2D polygon, boolean CW)
      Returns a list of vectors which are the normals to the nodes of polygon, given a direction of normal, indicated by CW (clockwise if true, counterclockwise if false). Vectors are normalized to unit vectors.
      Parameters:
      polygon - polygon for which to determine normals
      CW - direction of normal (clockwise if true, counterclockwise if false)
      Returns:
      list of normals
    • getNormal

      public static org.jogamp.vecmath.Vector2f getNormal​(org.jogamp.vecmath.Point2f p0, org.jogamp.vecmath.Point2f p, org.jogamp.vecmath.Point2f p1, boolean CW)
      Determines the vector normal to the 2D curve at point p, where p0 and p1 are the point before and after p, respectively. One of p0 or p1 (but not both) can be null, indicating the start or end of a curve; the remaining point will be used to determine the normal. Vector is normalized to a unit vector.
      Parameters:
      p0 - point in curve before p
      p - point in curve at which to determine normal
      p1 - point in curve after p
      CW - indicates direction of normal (clockwise if true, counterclockwise if false)
      Returns:
      the normal at p
    • getNormal

      public static org.jogamp.vecmath.Vector2d getNormal​(org.jogamp.vecmath.Point2d p0, org.jogamp.vecmath.Point2d p, org.jogamp.vecmath.Point2d p1, boolean CW)
      Determines the vector normal to the 2D curve at point p, where p0 and p1 are the point before and after p, respectively. One of p0 or p1 (but not both) can be null, indicating the start or end of a curve; the remaining point will be used to determine the normal. Vector is normalized to a unit vector.
      Parameters:
      p0 - point in curve before p
      p - point in curve at which to determine normal
      p1 - point in curve after p
      CW - indicates direction of normal (clockwise if true, counterclockwise if false)
      Returns:
      the normal at p