Skip to content

amastrobera/geom_sharp

Repository files navigation

GeomSharp

A 2D (and 3D) geometry library for C#, based on .Net Framework 4.8

build test deployment

How to install it

Download it from the Nuget repo and add it to your project.

Definition

Containment: one shape is completely contained inside another shape (including its borders). For example, a point is contained inside a triagle if it is picture

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. picture

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) picture

TODO: add definitions of "adjacency" and "touch" (one edge touches, now handled in Overlap).

Latest test run

picture

Data Structures

Legend: ✔️ done, ▶️ in progress, ❌ not done, 🧪 tested

2D 3D Utils
✔️ 🧪 Point ✔️ 🧪 Point ✔️ Angle
✔️ 🧪 Vector ✔️ 🧪 Vector ✔️ Rotation
✔️ 🧪 Line ✔️ 🧪 Line ✔️ Translation
✔️ 🧪 Ray ✔️ 🧪 Ray ❌ Transformation
✔️ 🧪 LineSegment ✔️ 🧪 LineSegment
▶️ PointSet ▶️ PointSet
✔️ LineSet ✔️ LineSet
✔️ Polyline ✔️ Polyline
✔️ 🧪 Triangle ✔️ 🧪 Triangle
✔️ Polygon ✔️ Polygon
✔️ 🧪 Plane
❌ Polyhedron

Algorithms

Legend: ✔️ done, ▶️ in progress, ❌ not done, 🧪 tested

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

About

Geometry library 2D and 3D for C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published