Geometry in the plane

2D geometry for engineering drawings: points, vectors, lines, polylines, polygons, faces with holes, circles, ellipses and oriented rectangles, with distance, projection, containment, intersection, collision, parallelism, parametrization, merging and splitting over them, and the drafting operations on top: extending and trimming lines, offsetting curves and regions, and combining regions. Every comparison is tolerance-aware.

Geometry in space is the 3D counterpart, built to the same design, and the two are measured with the same shared types.

Namespaces

Namespace Holds
GeometryHelper.Geometry GeoPoint2, GeoVector2, GeoLine2, GeoRay2, GeoXLine2, GeoPolyline2, GeoPolygon2, GeoFace2, GeoCircle2, GeoEllipse2, GeoSpline2, GeoRectangle2, GeoTriangle2, GeoTransform2
GeometryHelper.Core Boolean2, Collision2, Containment2, Corner2, Distance2, Ellipse2, Intersection2, Lengthen2, Merge2, Offset2, Parallel2, Parametrization2, Projection2, Splition2, Triangle2, PlanarMap
GeometryHelper.Meshing GeoMesh2, Mesh2, MeshKind, MeshOptions, GridAlignment: see meshing the plane
GeometryHelper.Extension EnumerableExtension
GeometryHelper Tolerance, Angle, OffsetOptions, GeometryHelperLog
GeometryHelper.Enums PointLocation, LineSide, LineEnd, LineExtension, OffsetJoin

Every type carries a 2, matching the 3 on the solid types, so a program working in both dimensions imports one namespace and nothing collides.

The pages of this guide

Tolerance

Tolerance and Tolerance.Global are shared types: a program working in the plane and in space sets one tolerance, not two.

Tolerance.Global has a static setter, deliberately mirroring Autodesk.AutoCAD.Geometry.Tolerance.Global. Changing it affects the whole application, so set it once at startup.

Importing Autodesk.AutoCAD.Geometry alongside this library brings a second Tolerance into scope and the two tie, giving CS0104. Name the one you mean: using Tolerance = GeometryHelper.Tolerance;.

Build and Test

dotnet build src/GeometryHelper/GeometryHelper.csproj
dotnet test  tests/GeometryHelper.UnitTest/GeometryHelper.UnitTest.csproj

Licence

MIT. Clipper2, which this package carries compiled in, is under the Boost Software License 1.0.