Namespace GeometryHelper.Core
Classes
- Arc2
What can be asked of an arc: where a point falls on it, how far a shape is from it, and where it meets a segment, a circle or another arc.
An arc is part of a circle, so every answer here is the circle's answer kept only where the arc actually reaches. A crossing beyond the ends of the arc belongs to the circle, not to the arc, and is left out; a point off the ends is measured to whichever end is nearer.
- Arc3
Where an arc in space crosses the surface of a box or a body, and whether it touches one.
- Boolean2
The boolean operations over the loops that may curve.
These flatten first, and say so by what they give back: Clipper resolves every region operation in this library and knows only straight edges, so there is no form of a boolean that keeps arcs. The straight result is the honest one — an answer of the curved type would be a promise that the arcs had survived, and they have not.
Offset2 is the exception, and the reason is worth knowing: offsetting is done piece by piece, so an arc can be offset exactly and stay an arc. A boolean cannot be done piece by piece.
- Boolean3
Where two bodies lie against each other, face to face.
- ClosestEdge2
Picking the one piece of a shape that lies nearest something else.
- Collision2
Whether a straight shape touches or overlaps one that curves.
- Collision3
Provides static methods for deciding whether two 3D shapes overlap.
CollidesWithanswers yes or no and says nothing about where. Shapes that merely touch count as colliding, so the answer agrees withDistance3reporting zero for the same pair. Where the shapes meet isIntersection3, and how far apart they are when they do not isDistance3.
- Containment2
Provides static methods for spatial containment, inclusion, and boundary point tests.
- Containment3
Provides static methods for deciding where a point sits relative to a 3D shape.
IsPointOnasks about the boundary of a shape,Containsasks whether the shape holds the point at all, andLocatereturns which of the two — or neither — applies. Only shapes that enclose something offerContains; a curve has no interior, so asking it to contain a point would only restateIsPointOn.
- ConvexHull2
The smallest convex polygon holding a set of points in the plane.
- ConvexHull3
The smallest convex body holding a set of points in space.
- Corner2
Reshapes the corners of a chain or a polygon, as AutoCAD's CHAMFER does.
A chamfer replaces a corner with one straight cut across it, measured back along each of the two edges that meet there. What comes back is the kind of shape that went in, because cutting a corner square adds no curvature: a polygon gives a polygon, a chain gives a chain.
TryTrimExtendToCorner(GeoLine2, GeoLine2, out GeoLine2, out GeoLine2) is the other end of the same family: it builds a corner where two loose segments would meet, rather than cutting one that already exists.
- Corner3
Rounding the corners of a chain in space.
- Distance2
Measuring a straight shape against one that curves.
- Distance3
Provides static methods for distance calculations in 3D space.
Every distance here is the shortest gap between the two shapes, and is zero when they touch or overlap. A bounded shape is measured as the set of points it actually occupies: a segment ends at its endpoints, a triangle includes its interior, and a plane is infinite in every direction.
- Face2
What a face meets, and how far off it is.
- Intersection2
Where a straight shape meets one that curves.
- Intersection3
Provides static methods for finding where 3D shapes meet.
Each
TryIntersectWithoverload returns a single result and reports false when there is not exactly one. Two shapes that overlap along a whole line or a whole area — a segment lying in a plane, two coincident planes, two collinear segments — have no single crossing to name, so they come back false rather than picking an arbitrary point out of the overlap. AskDistance3orCollision3when the question is whether they touch at all.
- Lengthen2
Provides static methods that change how long a line segment is while keeping it on the line that carries it: lengthening or shortening it by a distance, extending an end out to a boundary, trimming an end back to one, and trimming or extending two segments until they meet in a corner.
The operations follow AutoCAD's LENGTHEN, EXTEND and TRIM commands, and FILLET with a radius of zero. A segment has no picked point to say which end is meant, so every method that moves one end takes a LineEnd; the other end never moves, and the direction of the segment never reverses.
TryExtendToonly ever lengthens: the end moves outward to the nearest place where the line meets the boundary.TryTrimToonly ever shortens: the end moves back to the nearest place, still within the segment, where the boundary crosses it. An end that already lies on the boundary, within tolerance, satisfies both and is left there, so either call can be repeated without moving the end again, andTryExtendTo(...) || TryTrimTo(...)fits an end to a boundary whichever side of it the end starts on.A boundary is met where the infinite line carrying the segment crosses it. A boundary segment, polyline or polygon edge running parallel to the line is not a crossing, since it is either missed or shared along a whole stretch. A point is met where the line passes closest to it, at the foot of the perpendicular, so a point to one side of the line still pulls the end level with it.
- Lengthen3
Provides static methods that change how long a line segment is while keeping it on the line that carries it: lengthening or shortening it by a distance, extending an end out to a boundary, trimming an end back to one, and trimming or extending two segments until they meet in a corner.
This is the 3D counterpart of
Lengthen2and follows the same rules. Every method that moves one end takes a LineEnd; the other end never moves, and the segment never reverses.TryExtendToonly ever lengthens,TryTrimToonly ever shortens, and an end already on the boundary satisfies both, soTryExtendTo(...) || TryTrimTo(...)fits an end to a boundary from either side the way Tekla Structures fits a part end to a plane.A boundary is met where the infinite line carrying the segment reaches it. A plane is met where the line pierces it. A polygon, face or solid is met where the line pierces its surface; a line lying in the plane of a polygon or face meets it at its edges instead, and one running parallel beside it never does. Another segment is met only where the line passes within the point tolerance of it: two lines in space usually pass each other, and then there is no crossing to extend to. A point is met at the foot of the perpendicular from it.
- Merge2
Provides utility methods to merge consecutive collinear line segments and adjacent polylines.
- Merge3
Provides static methods for combining 3D curves that meet end to end.
Consecutive...takes the pieces in the order given and only ever joins a piece to the one after it, so a break in the sequence starts a new run.Joinignores the order and the direction of each piece and reassembles whatever chains the set actually forms, which is what a bag of edges out of a model needs.
- Offset2
Offsetting the chains and loops that may curve.
- Offset3
Offsetting a curved chain in space within its own plane.
- Parallel2
Provides static calculation methods for checking parallelism and perpendicularity between geometric entities.
- Parallel3
Provides static methods for checking parallelism, perpendicularity and coplanarity between 3D entities.
Every method takes degenerate input to mean "no answer" and returns false for it. A zero-length vector has no direction, so it is neither parallel nor perpendicular to anything, and saying so keeps a caller from reading a confident true out of geometry that carries no information.
- Parametrization2
Provides static methods for locating positions along a curve, either by a normalized parameter or by an arc length measured from the start of the curve.
The parameter is normalized: 0 is the start of the curve and 1 is its end, whatever the curve actually measures. The distance is a true arc length from the start, running from 0 to the total length. The two are proportional, so
distance = parameter * length.Each curve starts where its own geometry says it does: a line at its StartPoint, a polyline or polygon at its first vertex, a rectangle at its LowerLeft corner, and a circle at angle zero, that is the point directly right of its centre. All of them run in the direction their vertices are ordered, and a circle runs counter-clockwise.
Values outside the natural range follow the shape of the curve. A closed curve — a polygon, a rectangle, a circle — wraps around, so a parameter of 1.25 is the same position as 0.25. A polyline clamps, because it is an open chain with no natural extension. A line segment extrapolates along the infinite line that carries it, which is the behaviour
GeoLine2.GetPointAtParameterhas always had.
- Parametrization3
Provides static methods for locating positions along a 3D curve, either by a normalized parameter or by an arc length measured from the start of the curve.
The parameter is normalized: 0 is the start of the curve and 1 is its end, whatever the curve actually measures. The distance is a true arc length from the start, running from 0 to the total length. The two are proportional, so
distance = parameter * length.Values outside the natural range follow the shape of the curve. A line segment extrapolates along the infinite line that carries it, and so does a ray, which likewise has a well defined carrier. A polyline clamps, because it is an open chain of segments with no single direction to extend along. A closed curve — a polygon, a circle — wraps, so a parameter of 1.25 is the same position as 0.25.
- PlanarMap
Carries geometry that curves between the plane and space.
- Projection2
The shortest segment joining a chain or loop that may curve to something else.
- Projection3
Provides static methods for geometric projections in 3D space.
Every
ProjectTo...method answers the same question: which point of the target shape is closest to the supplied point. For a bounded shape the answer is clamped to the shape, so projecting onto a segment never returns a point past its endpoints, and projecting onto a triangle never returns a point outside its edges.
- Splition2
Cutting a chain or a loop that may curve, along the arcs rather than across them.
- Splition3
Provides static methods for cutting 3D geometry into pieces.
A curve is cut at a position along it or wherever a plane crosses it, and the pieces come back in order along the subject, so the first piece always holds its start point and the last holds its end point. A region or a body is cut by a plane and the pieces come back sorted by side.
Every overload reports
falsewhen there was nothing to cut — the cutter missed, or it only grazed an endpoint — and in that case still hands back the subject as a single piece rather than a null array, so a caller can use the result either way.
- Triangle2
What a triangle of the plane meets, how far off it is, and the rest of what the shapes of the plane ask each other.