GeometryHelper 6.0.0
See the version list below for details.
dotnet add package GeometryHelper --version 6.0.0
NuGet\Install-Package GeometryHelper -Version 6.0.0
<PackageReference Include="GeometryHelper" Version="6.0.0" />
<PackageVersion Include="GeometryHelper" Version="6.0.0" />
<PackageReference Include="GeometryHelper" />
paket add GeometryHelper --version 6.0.0
#r "nuget: GeometryHelper, 6.0.0"
#:package GeometryHelper@6.0.0
#addin nuget:?package=GeometryHelper&version=6.0.0
#tool nuget:?package=GeometryHelper&version=6.0.0
GeometryHelper
Geometry for engineering drawings and models, in two dimensions and in three, with the label placement
algorithms that run on the 2D half. Written in C# and targeting netstandard2.0, so it loads into the
.NET Framework hosts that Tekla Structures and AutoCAD provide as well as into modern .NET.
Every comparison that floating point error can affect takes a Tolerance, because coordinates that come
out of a BIM model are never exact.
Installation
dotnet add package GeometryHelper
Quick start
using GeometryHelper; // Tolerance, Angle, OffsetOptions
using GeometryHelper.Enums; // LineEnd, OffsetJoin, PointLocation
using GeometryHelper.Geometry; // every Geo type, 2D and 3D
using GeometryHelper.Core; // every operation
// In the plane: grow a slab, then cut an opening out of it.
var slab = new GeoPolygon2(new GeoPoint2(0, 0), new GeoPoint2(4000, 0),
new GeoPoint2(4000, 2000), new GeoPoint2(0, 2000));
var duct = new GeoPolygon2(new GeoPoint2(1000, 500), new GeoPoint2(1400, 500),
new GeoPoint2(1400, 900), new GeoPoint2(1000, 900));
GeoPolygon2 grown = slab.Offset(50.0)[0]; // 4100 x 2100
GeoFace2 pierced = Boolean2.Subtract(grown, duct)[0]; // one face, one hole
// In space: a beam trimmed where it runs into a wall.
var beam = new GeoLine3(new GeoPoint3(0, 0, 0), new GeoPoint3(3000, 0, 0));
var wall = new GeoPlane3(new GeoPoint3(2500, 0, 0), GeoVector3.XAxis);
beam.TryTrimTo(wall, LineEnd.End, out GeoLine3 cut); // (0,0,0) -> (2500,0,0)
What is inside
| Namespace | Holds |
|---|---|
GeometryHelper |
Tolerance, Angle, OffsetOptions, GeometryHelperLog |
GeometryHelper.Enums |
PointLocation, PlaneSide, LineSide, LineEnd, LineExtension, OffsetJoin |
GeometryHelper.Geometry |
30 immutable shapes: GeoPoint2 … GeoFace2 in the plane, GeoPoint3 … GeoSolid3 in space, arcs and the chains that carry them, and a transformation and a local coordinate system for each dimension |
GeometryHelper.Core |
28 operation classes, each dimension mirroring the other: Boolean2/Boolean3, Offset2/Offset3, Distance2/Distance3, … plus Arc2, Corner2 for chamfering and rounding, and PlanarMap, which carries flat shapes between the two |
GeometryHelper.Spatial |
GeoBvh2 and GeoBvh3, the bounding volume hierarchies for large chains and meshes |
GeometryHelper.Extension |
turning raw point lists into geometry |
GeometryHelper.Arranging |
label placement: Arranger, ArrangeItem, ArrangeResult, ArrangeOptions, five algorithms |
Every operation is reachable both ways: the static form names the larger shape first, and the instance form sits on whichever of the two reads better where you are calling from.
Because both dimensions are one assembly, a flat shape in space can be laid out in its own plane, worked on with the whole 2D half of the library, and put back:
GeoCoordinateSystem3 frame = plate.GetFrame();
GeoFace2 flat = plate.ProjectToFace2(frame);
GeoFace3 back = flat.Subtract(openings)[0].ToFace3(frame);
Guides
The whole of it, searchable, with every type and member: https://nguyenthanguth.github.io/GeometryHelper/.
| Guide | Covers |
|---|---|
| Shared types | Tolerance, Angle, the enumerations, OffsetOptions, GeometryHelperLog |
| Geometry in the plane | points to polygons and faces; extending, trimming, offsetting, combining regions |
| Geometry in space | points to solids; splitting, boolean bodies, meshes, local frames |
| Label placement | five algorithms behind one entry point |
Coverage
dotnet test tests/GeometryHelper.UnitTest --collect:"XPlat Code Coverage"
writes a Cobertura file under TestResults. Only this library is counted.
Build and Test
dotnet build src/GeometryHelper/GeometryHelper.csproj
dotnet test tests/GeometryHelper.UnitTest/GeometryHelper.UnitTest.csproj
Warnings are errors in CI, and every public member is documented, so a missing XML comment or a stale
cref fails the build rather than landing quietly. Every example printed in the guides is also a test.
Licence
MIT. Clipper2, which this package references and which resolves regions in the plane, is under the Boost Software License 1.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Clipper2 (>= 2.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on GeometryHelper:
| Package | Downloads |
|---|---|
|
GeometryHelper.IfcConvert
Converts geometry between IFC (via xBIM) and GeometryHelper: points, vectors, matrices, faces, and solids. |
|
|
GeometryHelper.CadConvert
Converts geometry between AutoCAD and GeometryHelper: points, vectors, lines, polylines, polygons, circles, and bounding boxes. |
|
|
GeometryHelper.TeklaConvert.2026
Converts geometry between Tekla Structures 2026 and GeometryHelper: points, vectors, segments, planes, coordinate systems, bounding boxes, transformation matrices, and the faces and loops of a Tekla solid. Also reads the objects of IFC reference models into solids placed where Tekla shows them, through GeometryHelper.IfcConvert. Built for Tekla Structures 2026; install the package whose year matches your Tekla. |
|
|
GeometryHelper.TeklaConvert.2025
Converts geometry between Tekla Structures 2025 and GeometryHelper: points, vectors, segments, planes, coordinate systems, bounding boxes, transformation matrices, and the faces and loops of a Tekla solid. Also reads the objects of IFC reference models into solids placed where Tekla shows them, through GeometryHelper.IfcConvert. Built for Tekla Structures 2025; install the package whose year matches your Tekla. |
|
|
GeometryHelper.TeklaConvert.2020
Converts geometry between Tekla Structures 2020 and GeometryHelper: points, vectors, segments, planes, coordinate systems, bounding boxes, transformation matrices, and the faces and loops of a Tekla solid. Also reads the objects of IFC reference models into solids placed where Tekla shows them, through GeometryHelper.IfcConvert. Built for Tekla Structures 2020; install the package whose year matches your Tekla. |
GitHub repositories
This package is not used by any popular GitHub repositories.
NEW IN 6.0.0
A summary. The full notes, with the reason and the measurement behind each item, and those of every
earlier version: https://github.com/nguyenthanguth/GeometryHelper/blob/main/CHANGELOG.md
BREAKING. Three changes, and no [Obsolete] forwarders left behind.
- RENAMED. GetClosestOnBoundary(other) is GetShortestLineTo(other) on GeoLine2, GeoCircle2,
GeoRectangle2, GeoPolygon2, GeoPolyline2 and GeoLine3, and Projection2.GetClosestSegment and
Projection3.GetClosestSegment are GetShortestLineTo. On GeoPolygonArc2 and GeoPolylineArc2 the old
method is GetClosestEdge, returning the GeoEdge2 it always meant.
- MEASURED DIFFERENTLY. Whether an arc reaches a point of its own circle is judged as a distance, no
longer within a whole degree of angle: DistanceTo no longer finds an arc nearer than its own points
allow, and GetIntersections no longer finds crossings off the end of an arc.
- RESHAPED. Label placement (GeometryHelper.Arranging): Arrange is ArrangeItem (Box, Leader, Offset),
and Arrange.Run is Arranger.Run, which returns an ArrangeResult (Translation, Placed) per item
instead of writing into the items. ArrangeOptions.Default is a new instance each time it is read.
NEW
- Nearest things from both sides: GetClosestEdge on the straight shapes, exact GetShortestLineTo on
the curved ones, and GeoSolid3 measured against every shape in space.
- SignedDistanceTo on the eight closed shapes: negative inside, nought on the boundary, positive
outside, as Locate answers.
- Arcs in space: GeoEdge3, GeoPolylineArc3 (a reinforcing bar), GeoPolygonArc3, Corner3.Fillet and
arcs through PlanarMap; in GeometryHelper.TeklaConvert, ReinforcementConvert and
RebarGeometryConvert. Crossings, collisions and cutting are exact; a curved chain is measured in
space through ToPolyline3(chordTolerance).
- Whichever of two shapes is in hand can be asked about the other: some fifty-five operations Core
worked out and no type offered are now on the types, both ways round, GeoFace2 and GeoEdge2
included.
- The families that change geometry: regions in the plane cut by a line or a chain; arcs, chains,
loops and edges extended and trimmed; fillets and chamfers for the straight shapes and in space;
booleans on GeoPolygon3, GeoFace3 and GeoObb3; GeoPolylineArc3.OffsetInPlane; GeoObb3.TryExpand;
GeoTriangle3.ToPolygon3 and ToFace3.
- Chains in space answer CollidesWith, GetIntersections and TryIntersectWith; GeoFace2 and
GeoRectangle2 gained TryIntersectWith; GeoLine3, GeoPolyline3, GeoRay3 and GeoEdge2 gained Locate.
- Solid against solid: TryCutOpenings, TriangulateSurface, Intersect (one body per shared region),
SplitShells and TryGetContact.
- GeoSolid3.Prepare() and GeoPreparedSolid3, for a body asked many questions; Clash3.Find with
ClashOptions, ClashResult and ClashKind.
- Making bodies: Extrude, Cylinder, Pipe, Sweep and Revolve.
- GetMassProperties, Section, ConvexHull2 and ConvexHull3, GeoRectangle2.Fit and GeoObb3.Fit.
- IsValid on every value type, MakeValid for a polygon crossing itself, and Tolerance.Use scopes.
- GeometryHelper.Export: ObjWriter, SvgWriter and Wkt.
- StartPoint, EndPoint, MidPoint and TrySplitAtDistance across the four chains.
FIXED
- A body's openings are read as material everywhere: fifteen GeoSolid3 queries read the faces
running across a hole, so a pin through a bolt hole was a clash.
- Intersecting a bent bar took tens of seconds and could be wrong or throw; eight bent bars against a
beam went from 57 s to 12 ms.
- The solid booleans were wrong on about one pair in 250 where a body passed a few thousandths from a
corner of the other, and could throw; they could also leave a sheet of no thickness inside their
result, on which SplitShells threw.
- Ear clipping meshed across the gaps of an I section's end and across the holes of a face carrying
a row of points along an edge.
- Two shapes lay in one plane when turned half a degree apart, and crossings under a degree were
taken as parallel.
- An arc or an edge was measured to a GeoCircle2's rim instead of its disc; two arcs are weighed all
four ways round; a concave GeoPolygon3 is measured by triangles inside it, not by its fan.
- NaN and infinity are refused wherever a negative size was.
- IsClosed accepts watertight bodies whose edges are split, or shared by four faces.
- GeometryHelperLog.Writer is called one message at a time.
FASTER
- The clash check: a steel frame of 789 parts with 400 bolt holes, prepared and checked, 9.7 s to
2.0 s (7.3 s to 0.65 s under the server garbage collector); 80 crossing bars 3.0 s to 0.04 s; 2000
boxes 39 ms to 3 ms. Every pair and kind of clash found is the same.
EARLIER. 5.1.0 rounds each corner by its own radius; 5.0.0 made four packages one and brought arcs,
chamfers, fillets and GeoTransform2. Both in full in the same file.