A 2D (and 3D) geometry library for C#, based on .Net Framework 4.8
Download it from the Nuget repo and add it to your project.
Containment: one shape is completely contained inside another shape (including its borders). For example, a point is contained inside a triagle if it is
Intersection: one shape crosses another, splitting it into two shapes. In 2D, two lines crossing each other, or having one point in common without being parallel. In 3D, the lines (or shapes) do not belong to the same plane, and cross each other.
Overlap: one shape shares a portion of its area with another. In 2D, two lines are parallel to each other, and have at least one point in common. In 3D, the two shapes are on the same plane, and one shape's surface lays on top of another - part of it (overlap) or completely (equality or containment). For triangles and polygons, the Overlap also include cases of adjacency (one+ edge in common) and touch (one point lying over the other shape's border)
TODO: add definitions of "adjacency" and "touch" (one edge touches, now handled in Overlap).
Legend: ✔️ done,
2D | 3D | Utils |
---|---|---|
✔️ 🧪 Point | ✔️ 🧪 Point | ✔️ Angle |
✔️ 🧪 Vector | ✔️ 🧪 Vector | ✔️ Rotation |
✔️ 🧪 Line | ✔️ 🧪 Line | ✔️ Translation |
✔️ 🧪 Ray | ✔️ 🧪 Ray | ❌ Transformation |
✔️ 🧪 LineSegment | ✔️ 🧪 LineSegment | |
✔️ LineSet | ✔️ LineSet | |
✔️ Polyline | ✔️ Polyline | |
✔️ 🧪 Triangle | ✔️ 🧪 Triangle | |
✔️ Polygon | ✔️ Polygon | |
✔️ 🧪 Plane | ||
❌ Polyhedron |
Legend: ✔️ done,
Category | SubCategory | Classes Involved |
---|---|---|
2D | ||
Containment | ||
✔️ 🧪 Line/Point | ||
✔️ 🧪 Ray/Point | ||
✔️ 🧪 Segment/Point | ||
✔️ 🧪 Triangle/Point | ||
❌ Polyline/Point | ||
✔️ 🧪 Polygon/Point | ||
Intersection | ||
✔️ 🧪 Line/Line | ||
✔️ 🧪 Line/Ray | ||
✔️ 🧪Line/Segment | ||
✔️ 🧪 Ray/Ray | ||
✔️ 🧪 Ray/Segment | ||
✔️ 🧪 Segment/Segment | ||
✔️ 🧪 Triangle/Triangle | ||
✔️ 🧪 Triangle/Line | ||
✔️ 🧪 Triangle/Ray | ||
✔️ 🧪 Triangle/Segment | ||
✔️ 🧪 Polyline/Line | ||
✔️ 🧪 Polyline/Ray | ||
✔️ 🧪 Polyline/Segment | ||
✔️ 🧪 Polyline/Polyline | ||
❌ Polyline/Triangle | ||
✔️ Polygon/Line | ||
✔️ Polygon/Ray | ||
✔️ Polygon/Segment | ||
✔️ Polygon/Polyline | ||
✔️ 🧪 Polygon/Polygon | ||
❌ Polygon/Triangle | ||
Overlap | ||
✔️ 🧪 Line/Line | ||
✔️ 🧪 Line/Ray | ||
✔️ 🧪 Line/Segment | ||
✔️ 🧪 Ray/Ray | ||
✔️ 🧪 Ray/Segment | ||
✔️ 🧪 Segment/Segment | ||
✔️ 🧪 Triangle/Triangle | ||
✔️ 🧪 Triangle/Line | ||
✔️ 🧪 Triangle/Ray | ||
✔️ 🧪 Triangle/Segment | ||
❌ Polyline/Line | ||
❌ Polyline/Ray | ||
❌ Polyline/Segment | ||
❌ Polyline/Polyline | ||
❌ Polyline/Triangle | ||
❌ Polygon/Line | ||
❌ Polygon/Ray | ||
❌ Polygon/Segment | ||
❌ Polygon/Polyline | ||
❌ Polygon/Polygon | ||
❌ Polygon/Triangle | ||
Touch | ||
✔️ 🧪 Triangle/Triangle | ||
Adjacency | ||
✔️ 🧪 Triangle/Triangle | ||
Convex Hull | ||
✔️ Polygon | ||
Triangulation | ||
❌ Polygon | ||
3D | ||
Containment | ||
✔️ 🧪 Line/Point | ||
✔️ 🧪 Ray/Point | ||
✔️ 🧪 Segment/Point | ||
✔️ 🧪 Plane/Point | ||
✔️ 🧪 Plane/Segment | ||
✔️ 🧪 Triangle/Point | ||
❌ Polyline/Point | ||
✔️ 🧪 Polygon/Point | ||
Projection | ||
✔️ 🧪 ProjectOnto (Point 3D -> 3D) | ||
✔️ 🧪 VerticalProjectOnto (Point 3D -> 3D) | ||
✔️ 🧪 Evaluate (Point 3D -> 3D along an axis) | ||
✔️ 🧪 ProjectInto (Point 3D -> 2D) | ||
Intersection | ||
✔️ 🧪 Line/Line | ||
✔️ 🧪 Line/Ray | ||
✔️ 🧪 Line/Segment | ||
✔️ 🧪 Ray/Ray | ||
✔️ 🧪 Ray/Segment | ||
✔️ 🧪 Segment/Segment | ||
✔️ 🧪 Plane/Plane | ||
✔️ 🧪 Plane/Line | ||
✔️ 🧪 Plane/Ray | ||
✔️ 🧪 Plane/Segment | ||
✔️ 🧪 Plane/Triangle | ||
✔️ Plane/Polyline | ||
✔️ 🧪 Plane/Polygon | ||
✔️ 🧪 Triangle/Triangle | ||
✔️ 🧪 Triangle/Line | ||
✔️ 🧪 Triangle/Ray | ||
✔️ 🧪 Triangle/Segment | ||
✔️ 🧪 Polyline/Line | ||
✔️ 🧪 Polyline/Ray | ||
✔️ 🧪 Polyline/Segment | ||
✔️ 🧪 Polyline/Polyline | ||
❌ Polyline/Triangle | ||
✔️ Polygon/Line | ||
✔️ Polygon/Ray | ||
✔️ Polygon/Segment | ||
✔️ Polygon/Polyline | ||
✔️ 🧪 Polygon/Polygon | ||
❌ Polygon/Triangle | ||
Overlap | ||
✔️ 🧪 Line/Line | ||
✔️ 🧪 Line/Ray | ||
✔️ 🧪 Line/Segment | ||
✔️ 🧪 Ray/Ray | ||
✔️ 🧪 Ray/Segment | ||
✔️ 🧪 Segment/Segment | ||
✔️ 🧪 Plane/Plane | ||
✔️ 🧪 Plane/Line | ||
✔️ 🧪 Plane/Ray | ||
✔️ 🧪 Plane/Segment | ||
✔️ 🧪 Plane/Triangle | ||
✔️ 🧪 Triangle/Triangle | ||
✔️ 🧪 Triangle/Line | ||
✔️ 🧪 Triangle/Ray | ||
✔️ 🧪 Triangle/Segment | ||
❌ Polyline/Line | ||
❌ Polyline/Ray | ||
❌ Polyline/Segment | ||
❌ Polyline/Polyline | ||
❌ Polyline/Triangle | ||
❌ Polygon/Line | ||
❌ Polygon/Ray | ||
❌ Polygon/Segment | ||
❌ Polygon/Polyline | ||
❌ Polygon/Polygon | ||
❌ Polygon/Triangle | ||
Touch | ||
✔️ 🧪 Triangle/Triangle | ||
Adjacency | ||
✔️ 🧪 Triangle/Triangle | ||
Convex Hull | ||
✔️ 🧪 Polygon | ||
Triangulation | ||
❌ Polygon |