Method ClipTo
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
ClipTo(GeoAabb3)
Gets the part of this line inside an axis-aligned box, using the default tolerance.
public GeoLine3? ClipTo(GeoAabb3 box)
Parameters
boxGeoAabb3
Returns
- GeoLine3?
The segment where the line is inside the box, running along the direction of the line; null when it misses.
ClipTo(GeoAabb3, Tolerance)
Gets the part of this line inside an axis-aligned box, within a tolerance.
public GeoLine3? ClipTo(GeoAabb3 box, Tolerance tolerance)
Parameters
boxGeoAabb3The box.
toleranceToleranceThe tolerance: a line that misses the box by no more than the point tolerance is clipped to the box grown by it.
Returns
- GeoLine3?
The segment where the line is inside the box, running along the direction of the line; null when it misses or the box is empty.
Remarks
Meant for drawing: the line through (-50, 50, 10) along X, clipped to the box 100 by 100 by 20 with a corner at the origin, is the segment from (0, 50, 10) to (100, 50, 10); the line along Y through (150, 0, 10) misses it and gives null.
A line that crosses the box is clipped to it exactly. One that misses it by no more than the point tolerance, the line along X through (0, 50, 20.0005) over that box, touches it as CollidesWith(GeoAabb3) says, and is clipped to the box grown by the tolerance: from (-0.001, 50, 20.0005) to (100.001, 50, 20.0005), its ends no more than the tolerance outside the box on any axis. One that misses it by more gives null.