Class ComputationalGeometry2D
java.lang.Object
org.episteme.core.mathematics.geometry.ComputationalGeometry2D
Computational geometry algorithms for 2D.
Includes: convex hull, closest pair, line segment intersection, etc.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionstatic Point2D[]closestPair(List<Point2D> points) Closest pair of points - O(n log n) divide and conquer.convexHull(List<Point2D> points) Convex Hull using Graham Scan - O(n log n).static RealintersectRayCircle(Ray2D ray, Point2D center, Real radius) Intersects a ray with a circle.static RealintersectRaySegment(Ray2D ray, Point2D p1, Point2D p2) Intersects a ray with a line segment.static intorientation(Point2D p, Point2D q, Point2D r) Computes the orientation of triplet (p, q, r).static booleanpointInPolygon(Point2D point, List<Point2D> polygon) Checks if a point is inside a polygon using ray casting.static RealpolygonArea(List<Point2D> vertices) Computes the area of a polygon defined by its vertices.static booleansegmentsIntersect(Point2D p1, Point2D q1, Point2D p2, Point2D q2) Check if two line segments intersect.
-
Method Details
-
convexHull
-
closestPair
-
segmentsIntersect
Check if two line segments intersect.- Parameters:
p1- first endpoint of segment 1q1- second endpoint of segment 1p2- first endpoint of segment 2q2- second endpoint of segment 2- Returns:
- true if segments intersect
-
orientation
-
polygonArea
-
pointInPolygon
-
intersectRaySegment
-
intersectRayCircle
-