Method SplitAtDistances
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
SplitAtDistances(GeoLine3, IEnumerable<double>)
Splits a line segment at several arc lengths at once, using the default tolerance.
public static GeoLine3[] SplitAtDistances(GeoLine3 line, IEnumerable<double> distances)
Parameters
lineGeoLine3distancesIEnumerable<double>
Returns
- GeoLine3[]
SplitAtDistances(GeoLine3, IEnumerable<double>, Tolerance)
Splits a line segment at several arc lengths at once, within a tolerance.
public static GeoLine3[] SplitAtDistances(GeoLine3 line, IEnumerable<double> distances, Tolerance tolerance)
Parameters
lineGeoLine3distancesIEnumerable<double>toleranceTolerance
Returns
- GeoLine3[]
Remarks
Positions outside the segment or on its endpoints are skipped, and positions closer together than the tolerance are merged, so no piece comes back shorter than the tolerance whatever is passed in.
SplitAtDistances(GeoPolyline3, IEnumerable<double>)
Splits a polyline at several arc lengths at once, using the default tolerance.
public static GeoPolyline3[] SplitAtDistances(GeoPolyline3 polyline, IEnumerable<double> distances)
Parameters
polylineGeoPolyline3distancesIEnumerable<double>
Returns
SplitAtDistances(GeoPolyline3, IEnumerable<double>, Tolerance)
Splits a polyline at several arc lengths at once, within a tolerance.
public static GeoPolyline3[] SplitAtDistances(GeoPolyline3 polyline, IEnumerable<double> distances, Tolerance tolerance)
Parameters
polylineGeoPolyline3distancesIEnumerable<double>toleranceTolerance
Returns
Remarks
A cut position that falls within tolerance of an existing vertex snaps onto it rather than adding a vertex beside it, so no edge comes back shorter than the tolerance either.
Every piece starts where the one before it ended, on the polyline: at a hundredth, the polyline from (0, 0, 0) to (10, 0, 0) and on to (10, 10, 0) cut at 9.995 comes back as two pieces meeting at the corner, where the second started at (10, -0.005, 0), the cut carried back along the next leg off the polyline, and cut at 10.005 the second started 0.005 past the corner the first ended at. A cut on a leg no longer than the tolerance is made where the piece before it ends. The pieces keep what the tolerance asked keeps, however much shorter than the global tolerance: at a billionth, the polyline from (0, 0, 0) to (10, 0, 0) cut at 5 and 5.0005 gives a piece 0.0005 long, where it threw.
The last piece ends where the polyline does. A last leg no longer than the tolerance takes the corner before it, as a first one is taken by the start: at a hundredth, the polyline from (0, 0, 0) to (10, 0, 0) and on to (10, 0.006, 0) cut at 5 gives the pieces from (0, 0, 0) to (5, 0, 0) and from there to (10, 0.006, 0), where the second ended at the corner (10, 0, 0) and the end was lost. Cut at 9.995, the cut lands on the corner and would leave only that leg, 0.006 long, after it, so it is not made and the polyline comes back whole, where it came back as one piece ending at the corner.