Method Offset
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
Offset(GeoPolygonArc2, double)
Offsets a loop that may curve, keeping its arcs as arcs.
public static GeoPolygonArc2[] Offset(GeoPolygonArc2 loop, double distance)
Parameters
loopGeoPolygonArc2The loop.
distancedoubleHow far to move the boundary: outward when positive, inward when negative.
Returns
- GeoPolygonArc2[]
The offset loops, which may be none when the loop is eaten away, or more than one when it is pinched in two.
Remarks
Nothing is flattened: an arc of radius R comes back an arc of radius R plus or minus the distance, about the same centre, and a corner that opens up is filled the way OffsetOptions says. This is the one region operation that does not go through Clipper, which is why it can keep the arcs at all.
Exceptions
- ArgumentNullException
Thrown when the loop is null.
Offset(GeoPolygonArc2, double, Tolerance)
Offsets a loop that may curve, within a tolerance.
public static GeoPolygonArc2[] Offset(GeoPolygonArc2 loop, double distance, Tolerance tolerance)
Parameters
loopGeoPolygonArc2distancedoubletoleranceTolerance
Returns
Exceptions
- ArgumentNullException
Thrown when the loop is null.
Offset(GeoPolygonArc2, double, OffsetJoin)
Offsets a loop that may curve, filling opened corners a given way.
public static GeoPolygonArc2[] Offset(GeoPolygonArc2 loop, double distance, OffsetJoin join)
Parameters
loopGeoPolygonArc2distancedoublejoinOffsetJoin
Returns
Exceptions
- ArgumentNullException
Thrown when the loop is null.
Offset(GeoPolygonArc2, double, OffsetJoin, Tolerance)
Offsets a loop that may curve, filling opened corners a given way, within a tolerance.
public static GeoPolygonArc2[] Offset(GeoPolygonArc2 loop, double distance, OffsetJoin join, Tolerance tolerance)
Parameters
loopGeoPolygonArc2distancedoublejoinOffsetJointoleranceTolerance
Returns
Exceptions
- ArgumentNullException
Thrown when the loop is null.
Offset(GeoPolygonArc2, double, OffsetOptions)
Offsets a loop that may curve, with options.
public static GeoPolygonArc2[] Offset(GeoPolygonArc2 loop, double distance, OffsetOptions options)
Parameters
loopGeoPolygonArc2distancedoubleoptionsOffsetOptions
Returns
Exceptions
- ArgumentNullException
Thrown when the loop or the options are null.
Offset(GeoPolygonArc2, double, OffsetOptions, Tolerance)
Offsets a loop that may curve, with options, within a tolerance.
public static GeoPolygonArc2[] Offset(GeoPolygonArc2 loop, double distance, OffsetOptions options, Tolerance tolerance)
Parameters
loopGeoPolygonArc2The loop.
distancedoubleHow far to move the boundary: outward when positive, inward when negative.
optionsOffsetOptionsHow to fill a corner that opens up, and how far a miter may run.
toleranceToleranceThe tolerance.
Returns
- GeoPolygonArc2[]
The offset loops, which may be none when the loop is eaten away, or more than one when it is pinched in two. Outer loops run the way the loop ran; where a growing loop closes a gap around empty space, that space comes back as a hole wound the other way, so that signed areas add up, as the straight offsets give it, whether the hole is a lens of two arcs or one of two a pinch leaves: the square of side 100 with a lens cut into it, tips (-20, 0) and a mouth 1 wide, sides of bulge -0.5, grown by 3, keeps the lens of radius 22.002 as a hole of 327.842.
Remarks
An arc whose radius runs out has no offset left, and the loop goes round its two ends instead, on the circle of the distance about each, whatever the join: that is what stands the distance from the shape there. The rectangle 100 by 30 with its right side bowed 6 in, a radius of 21.75, grown by 40 with round joins: the circles of 40 about (100, 0) and (100, 30) meet at (137.081, 15), and the loop encloses 18 397.80, the same whichever corner it starts from and whichever way it runs. A loop whose pieces meet out of the order they were cut in is put together where they meet, and a lens left between two arcs comes back as a loop of three corners.
A corner that opens is filled as the straight offsets fill it. A chamfer is cut square to the corner's bisector at the distance, touching the arc a round join would draw: the square of side 10 grown by 2 is cut at its corner (10, 0) from (8 + 2 sqrt 2, -2) to (12, 2 - 2 sqrt 2), and encloses 193.255. A miter that would reach further than MiterLimit times the distance is squared off there, its pieces run on as the miter runs them: the triangle with a tip of 10 degrees, grown by 1, is squared off 10 from the tip, from (-9.973, -0.743) to (-9.951, -1). Two straight edges a fraction of a degree off straight are mitered like any others. Where there is neither a miter nor a square to cut, because an arc and the piece next to it never meet and the miter has no limit, or an arc's circle never reaches the cut, the corner is rounded off at the distance.
A loop that crosses itself is read as the straight offsets read one, even-odd: a point is inside when it lies inside an odd number of the simple loops its crossings cut it into, and that region is what is offset, its arcs kept. The loop from (-7.818, 3.764) round an arc to the origin, round another to (-8.573, 2.412) and straight back crosses itself at (-1.980, 0.198), where its two arcs meet again beside their corner, and runs round a lens there the other way: grown by 0.1 with round joins it is one loop of 5.9555 and grown by 0.5 one of 14.5114 (the straight path, on the loop cut within 1E-5, 5.9555 and 14.5114); it was none. A gear of 642 teeth, whose arcs at each inner vertex cross again 0.0079 away and make a slit there, grown by 0.5 is one loop of 31 667.81, and shrunk by 0.5 one of 28 106.67, each slit holding its disc of 0.5 out of it. The loops come back wound as the signed area of the loop says it runs, outer ones that way and holes the other. Grown with miters or chamfers, each tip of the region where two lobes of it cross is a corner of its own and is mitered or cut as any corner is: the bow tie from (-10, 2) to (1, -0.2), (1, 0.2) and (-10, -2), its back an arc of bulge -0.25, grown by 1, keeps the miter of its long lobe out to (5.099, 0), past the small lobe, and encloses 54.460; the miter was cut off at x = 2, 52.539. A loop of four corners whose first and last edges cross 1.3 degrees apart, grown by 3 with chamfers, encloses 212.058, where it lost 0.83 beside the crossing. Where the two quarters of the region at a crossing are one lobe running round a hole, as the straight path reads them, they are no tips: the square 10 by 10 whose bottom edge curls up into a loop from (6, 2) to (4, 2), grown by 3, is 253.263. A loop that does not cross itself is offset as it always was. A vertex that lies on another edge is a crossing when the edge before it comes from one side of that edge and the edge after it leaves to the other: the loop from the origin to (10, 0), up to (10, 10) by an arc of bulge 0.2, back to (5, 0) and on to (3, -6) by an arc of bulge -0.2 crosses itself at (5, 0), and grown by 0.5 with round joins is one loop of 74.484 (the straight path 74.483), shrunk by 0.5 two of 21.342 and 10.017. A vertex that touches an edge with both its own edges on one side of it, or a hair off it, does not cross it. A spike the loop runs out to and straight back from, between two straight edges whose far ends lie within the point tolerance of each other, is dropped first, as the straight offsets drop it, the two ends of its foot one corner: the square 10 by 10 with a needle 0.0005 wide at its foot and 6 tall on its top, grown by 0.3 at a tolerance of 0.001, is the square grown, 112.283 with round joins, as the straight path gives it; it kept a strip 0.6 wide about the needle, 115.845. A region shrunk with miter corners can lose a small island that a miter wedge covers: the offset arcs run on round their own circles and are cut square at the miter limit times the distance, and what lies inside that wedge is not left. A loop of five vertices shrunk by 1 with the default limit of 10 has two loops where round corners give three, the third of 0.203 wholly in a wedge; with a limit of 2 it stays.
At a tolerance coarse beside the loop, two moved pieces can cross within the tolerance of where one of them ends and are not cut there. Where that leaves the offset open, the loop is offset again within a hundredth of the tolerance, and where a run is still open within a ten-thousandth: at each step cut at its crossings wherever it crosses itself there, and as a simple loop only where it crosses itself nowhere there. An answer is taken where it leaves fewer runs open and no fewer loops, with any loop of it finer than the tolerance, as the answer within the finer step has it. At a tolerance of 0.1 the loop of twelve straight corners in a box 7.9 by 5.1, grown by 4 with round joins, is one loop of 150.317, as the straight path gives it (150.320); it was none.
Crossings of a loop that crosses itself lying within the tolerance of each other, or linked through others that are, are one place, as long as each lies within the tolerance of the place, where the edges through it are cut: a row of forty crossings 0.09 apart is twenty places of two. A loop with two places too near along an edge to cut it at both is cut within a hundredth of the tolerance, or failing that a ten-thousandth, and offset within that: a loop of fifteen corners 1.2 across, grown by 1 at a tolerance of 0.1, is cut within 1E-5 and is one loop of 7.858. A loop that cannot be cut at any of the three is offset as a simple loop, as it always was. The loop whose three crossings lie 0.070, 0.084 and 0.101 apart, grown by 0.3 at a tolerance of 0.1, is an outline of 181.68 and three holes, as within 1E-3; it was none. A loop that crosses itself at more than 2 000 places within the tolerance is read within the tolerance only, cut where it can be and otherwise offset as a simple loop, since where its crossings bunch the work of a loop cut at them grows faster than their square: 60 diameters of a circle, 6 903 crossings, cut within 1E-5 took 21 s. The star {71/35} of radius 10, 2 414 crossings, grown by 0.3 at a tolerance of 0.1 is so the one loop of 302.631 round it.
Grown or shrunk with miters or chamfers, a loop is cut again within a hundredth of the tolerance, and then a ten-thousandth, where the tolerance does not tell a crossing from what lies beside it: within it two crossings made one place turn the blunt end of the sliver between them into a point, and a corner of the loop beside a crossing turns the tip there by its own turn, and a miter runs the error on. A step the loop cannot be cut at is passed over; one is taken where it is coarse at fewer places than the step before, until none is left, and the loop is offset within the last taken. A step coarse at as many places, as where three edges cross at one point, ends it, so a loop is cut at most twice more. A loop of the answer that is a point within the tolerance asked for is left out. The bow tie above with a corner on its first edge 0.005 past the crossing, where it turns by 1 degree, grown by 1 at a tolerance of 0.01, keeps the miter of its long lobe and encloses 54.419; the miter was left out, 52.501. A loop of four corners whose spike 2.4 degrees wide is crossed by an edge where it is 0.0057 wide, grown by 3 with miters at 0.01, is 386.351, as within 1E-4; it was 387.385.
A loop is put together edge for edge, its corners counted within the tolerance asked, not the global one: at a millionth, the rectangle 100 by 50 grown by 0.0004 with round joins keeps its four arcs, 0.00057 across, and encloses 5 000.12, where they were dropped within the global tolerance of a thousandth.
Exceptions
- ArgumentNullException
Thrown when the loop or the options are null.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.
Offset(GeoPolylineArc2, double)
Offsets a chain that may curve, keeping its arcs as arcs.
public static GeoPolylineArc2[] Offset(GeoPolylineArc2 chain, double distance)
Parameters
chainGeoPolylineArc2The chain.
distancedoubleHow far to move it, to the left of the way it runs when positive.
Returns
- GeoPolylineArc2[]
The offset chains, which may be none when nothing survives.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Offset(GeoPolylineArc2, double, Tolerance)
Offsets a chain that may curve, within a tolerance.
public static GeoPolylineArc2[] Offset(GeoPolylineArc2 chain, double distance, Tolerance tolerance)
Parameters
chainGeoPolylineArc2distancedoubletoleranceTolerance
Returns
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Offset(GeoPolylineArc2, double, OffsetJoin)
Offsets a chain that may curve, filling opened corners a given way.
public static GeoPolylineArc2[] Offset(GeoPolylineArc2 chain, double distance, OffsetJoin join)
Parameters
chainGeoPolylineArc2distancedoublejoinOffsetJoin
Returns
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Offset(GeoPolylineArc2, double, OffsetJoin, Tolerance)
Offsets a chain that may curve, filling opened corners a given way, within a tolerance.
public static GeoPolylineArc2[] Offset(GeoPolylineArc2 chain, double distance, OffsetJoin join, Tolerance tolerance)
Parameters
chainGeoPolylineArc2distancedoublejoinOffsetJointoleranceTolerance
Returns
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Offset(GeoPolylineArc2, double, OffsetOptions)
Offsets a chain that may curve, with options.
public static GeoPolylineArc2[] Offset(GeoPolylineArc2 chain, double distance, OffsetOptions options)
Parameters
chainGeoPolylineArc2distancedoubleoptionsOffsetOptions
Returns
Exceptions
- ArgumentNullException
Thrown when the chain or the options are null.
Offset(GeoPolylineArc2, double, OffsetOptions, Tolerance)
Offsets a chain that may curve, with options, within a tolerance.
public static GeoPolylineArc2[] Offset(GeoPolylineArc2 chain, double distance, OffsetOptions options, Tolerance tolerance)
Parameters
chainGeoPolylineArc2The chain.
distancedoubleHow far to move it, to the left of the way it runs when positive.
optionsOffsetOptionsHow to fill a corner that opens up, and how far a miter may run.
toleranceToleranceThe tolerance, which also says where two pieces of the offset meet.
Returns
- GeoPolylineArc2[]
The offset chains, which may be none when nothing survives.
Remarks
The pieces are joined within the tolerance given, and the chains are put together within it too, not within the global one: the chain from the origin to (-5, 0) and round an arc of bulge -0.5 to (-7, 5), offset by 0.3 with an unlimited miter at a tolerance of 0.1, is one chain from (0, -0.3) to (-7.256, 5.156). A curve that cannot stand the distance away anywhere gives nothing: the U from (10, 0) to the origin, round the half circle of radius 2 about (0, 2) and back to (10, 4), offset by -2.5 to its inside, which is 4 wide. A piece is cut where another part of the chain comes nearer than the distance, and what still stands the distance away stays: the hairpin 1 wide, 10 along x, 1 down and 9 back, offset by -0.6 into its inside, keeps the start of its first leg, from (0, -0.6) to (0.553, -0.6), short of the circle of 0.6 about the chain's end. An arc whose radius runs out has no offset left, and the chain goes round its two ends instead, on the circle of the distance about each, whatever the join: the chain 10 along x, a half turn of radius 5 below the axis to (20, 0) and 10 more, offset by 10 upwards, runs along y = 10 to (10, 10), round the circle of 10 about (10, 0) to (15, 8.660), round the circle about (20, 0) to (20, 10) and on to (30, 10), 30.472 long.
A corner that opens is filled as the straight offsets fill it: a chamfer square to the corner's bisector at the distance, and a miter past MiterLimit squared off at the limit. The chain (0, 0), (10, 0), (10, 10) offset by -2 with a chamfer runs along y = -2 to (8 + 2 sqrt 2, -2), across to (12, 2 - 2 sqrt 2) and on to (12, 10). Where there is neither a miter nor a square to cut, the corner is rounded off at the distance.
What a miter fills is read within the tolerance given, however small the miter: a chain of nine corners some 0.005 across, grown by 0.00137 with miters at a billionth, is one chain, as the same chain a million times larger is within a thousandth, where a miter smaller than the global tolerance went unread and a stray piece 0.00004 long inside it was kept.
Exceptions
- ArgumentNullException
Thrown when the chain or the options are null.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.
Offset(GeoLine2, double)
Gets the segment parallel to a segment at a distance to its left, using the default tolerance. A negative distance moves it to the right.
public static GeoLine2 Offset(GeoLine2 line, double distance)
Parameters
lineGeoLine2The segment.
distancedoubleHow far to move it, to the left of its direction when positive.
Returns
- GeoLine2
The parallel segment, of the same length and running the same way.
Exceptions
- InvalidOperationException
Thrown when the segment is too short to have a direction.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.
Offset(GeoLine2, double, Tolerance)
Gets the segment parallel to a segment at a distance to its left, within tolerance. A negative distance moves it to the right.
public static GeoLine2 Offset(GeoLine2 line, double distance, Tolerance tolerance)
Parameters
lineGeoLine2The segment.
distancedoubleHow far to move it, to the left of its direction when positive.
toleranceToleranceThe tolerance deciding when the segment is too short.
Returns
- GeoLine2
The parallel segment, of the same length and running the same way.
Exceptions
- InvalidOperationException
Thrown when the segment is too short to have a direction.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.
Offset(GeoPolygon2, double)
Grows a polygon by a distance, or shrinks it when the distance is negative, with sharp corners, using the default tolerance.
public static GeoPolygon2[] Offset(GeoPolygon2 polygon, double distance)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far the boundary moves: outward when positive, inward when negative.
Returns
- GeoPolygon2[]
The boundary loops of the offset region; see Offset(GeoPolygon2, double, OffsetOptions, Tolerance).
Offset(GeoPolygon2, double, Tolerance)
Grows a polygon by a distance, or shrinks it when the distance is negative, with sharp corners, within tolerance.
public static GeoPolygon2[] Offset(GeoPolygon2 polygon, double distance, Tolerance tolerance)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far the boundary moves: outward when positive, inward when negative.
toleranceToleranceThe tolerance.
Returns
- GeoPolygon2[]
The boundary loops of the offset region; see Offset(GeoPolygon2, double, OffsetOptions, Tolerance).
Offset(GeoPolygon2, double, OffsetJoin)
Grows a polygon by a distance, or shrinks it when the distance is negative, with the given corners, using the default tolerance.
public static GeoPolygon2[] Offset(GeoPolygon2 polygon, double distance, OffsetJoin join)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far the boundary moves: outward when positive, inward when negative.
joinOffsetJoinHow the corners that open up are closed.
Returns
- GeoPolygon2[]
The boundary loops of the offset region; see Offset(GeoPolygon2, double, OffsetOptions, Tolerance).
Offset(GeoPolygon2, double, OffsetJoin, Tolerance)
Grows a polygon by a distance, or shrinks it when the distance is negative, with the given corners, within tolerance.
public static GeoPolygon2[] Offset(GeoPolygon2 polygon, double distance, OffsetJoin join, Tolerance tolerance)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far the boundary moves: outward when positive, inward when negative.
joinOffsetJoinHow the corners that open up are closed.
toleranceToleranceThe tolerance.
Returns
- GeoPolygon2[]
The boundary loops of the offset region; see Offset(GeoPolygon2, double, OffsetOptions, Tolerance).
Offset(GeoPolygon2, double, OffsetOptions)
Grows a polygon by a distance, or shrinks it when the distance is negative, as the options say, using the default tolerance.
public static GeoPolygon2[] Offset(GeoPolygon2 polygon, double distance, OffsetOptions options)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far the boundary moves: outward when positive, inward when negative.
optionsOffsetOptionsThe corner shape.
Returns
- GeoPolygon2[]
The boundary loops of the offset region; see Offset(GeoPolygon2, double, OffsetOptions, Tolerance).
Offset(GeoPolygon2, double, OffsetOptions, Tolerance)
Grows a polygon by a distance, or shrinks it when the distance is negative, as the options say, within tolerance.
public static GeoPolygon2[] Offset(GeoPolygon2 polygon, double distance, OffsetOptions options, Tolerance tolerance)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far the boundary moves: outward when positive, inward when negative.
optionsOffsetOptionsThe corner shape.
toleranceToleranceThe tolerance.
Returns
- GeoPolygon2[]
The boundary loops of the offset region, as AutoCAD's OFFSET draws them. Most offsets give one polygon. A shrinking polygon that pinches off gives one per piece, largest first, and one that shrinks away gives none. A growing polygon that closes a gap around empty space also gives that space: each outer loop is followed by the holes inside it, and a hole is wound the other way round, so its signed area counts against the total. Outer loops run the same way round as the polygon. Use Offset(GeoFace2, double, OffsetOptions, Tolerance) on a face to get the holes attached to their boundary.
Remarks
A polygon whose edges cross is read under the even-odd rule first, as Containment2 reads it, and a spike doubling back on itself is dropped, since it encloses nothing.
Exceptions
- ArgumentNullException
Thrown when the polygon or the options are null.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.
Offset(GeoFace2, double)
Grows a face by a distance, or shrinks it when the distance is negative, with sharp corners, using the default tolerance.
public static GeoFace2[] Offset(GeoFace2 face, double distance)
Parameters
Returns
- GeoFace2[]
Offset(GeoFace2, double, Tolerance)
Grows a face by a distance, or shrinks it when the distance is negative, with sharp corners, within tolerance.
public static GeoFace2[] Offset(GeoFace2 face, double distance, Tolerance tolerance)
Parameters
Returns
- GeoFace2[]
Offset(GeoFace2, double, OffsetJoin)
Grows a face by a distance, or shrinks it when the distance is negative, with the given corners, using the default tolerance.
public static GeoFace2[] Offset(GeoFace2 face, double distance, OffsetJoin join)
Parameters
faceGeoFace2distancedoublejoinOffsetJoin
Returns
- GeoFace2[]
Offset(GeoFace2, double, OffsetJoin, Tolerance)
Grows a face by a distance, or shrinks it when the distance is negative, with the given corners, within tolerance.
public static GeoFace2[] Offset(GeoFace2 face, double distance, OffsetJoin join, Tolerance tolerance)
Parameters
faceGeoFace2distancedoublejoinOffsetJointoleranceTolerance
Returns
- GeoFace2[]
Offset(GeoFace2, double, OffsetOptions)
Grows a face by a distance, or shrinks it when the distance is negative, as the options say, using the default tolerance.
public static GeoFace2[] Offset(GeoFace2 face, double distance, OffsetOptions options)
Parameters
faceGeoFace2distancedoubleoptionsOffsetOptions
Returns
- GeoFace2[]
Offset(GeoFace2, double, OffsetOptions, Tolerance)
Grows a face by a distance, or shrinks it when the distance is negative, as the options say, within tolerance.
public static GeoFace2[] Offset(GeoFace2 face, double distance, OffsetOptions options, Tolerance tolerance)
Parameters
faceGeoFace2The face.
distancedoubleHow far the material grows: its boundary moves out and its holes shrink when positive.
optionsOffsetOptionsThe corner shape.
toleranceToleranceThe tolerance.
Returns
- GeoFace2[]
The faces of the offset region, largest first, each with the holes inside it. Growing can close holes and merge nothing, since a face is one piece; shrinking can split it, and holes grown into each other or into the boundary open it up. The boundaries run the same way round as the face's.
Remarks
The material is what lies inside the boundary and outside every hole, so holes that overlap or reach past the boundary take away only what they cover.
Exceptions
- ArgumentNullException
Thrown when the face or the options are null.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.
Offset(GeoPolyline2, double)
Gets the curve parallel to a polyline at a distance to its left, with sharp corners, using the default tolerance. A negative distance goes to the right.
public static GeoPolyline2[] Offset(GeoPolyline2 polyline, double distance)
Parameters
polylineGeoPolyline2distancedouble
Returns
Offset(GeoPolyline2, double, Tolerance)
Gets the curve parallel to a polyline at a distance to its left, with sharp corners, within tolerance. A negative distance goes to the right.
public static GeoPolyline2[] Offset(GeoPolyline2 polyline, double distance, Tolerance tolerance)
Parameters
polylineGeoPolyline2distancedoubletoleranceTolerance
Returns
Offset(GeoPolyline2, double, OffsetJoin)
Gets the curve parallel to a polyline at a distance to its left, with the given corners, using the default tolerance. A negative distance goes to the right.
public static GeoPolyline2[] Offset(GeoPolyline2 polyline, double distance, OffsetJoin join)
Parameters
polylineGeoPolyline2distancedoublejoinOffsetJoin
Returns
Offset(GeoPolyline2, double, OffsetJoin, Tolerance)
Gets the curve parallel to a polyline at a distance to its left, with the given corners, within tolerance. A negative distance goes to the right.
public static GeoPolyline2[] Offset(GeoPolyline2 polyline, double distance, OffsetJoin join, Tolerance tolerance)
Parameters
polylineGeoPolyline2distancedoublejoinOffsetJointoleranceTolerance
Returns
Offset(GeoPolyline2, double, OffsetOptions)
Gets the curve parallel to a polyline at a distance to its left, as the options say, using the default tolerance. A negative distance goes to the right.
public static GeoPolyline2[] Offset(GeoPolyline2 polyline, double distance, OffsetOptions options)
Parameters
polylineGeoPolyline2distancedoubleoptionsOffsetOptions
Returns
Offset(GeoPolyline2, double, OffsetOptions, Tolerance)
Gets the curve parallel to a polyline at a distance to its left, as the options say, within tolerance. A negative distance goes to the right.
public static GeoPolyline2[] Offset(GeoPolyline2 polyline, double distance, OffsetOptions options, Tolerance tolerance)
Parameters
polylineGeoPolyline2The polyline.
distancedoubleHow far to move it, to the left of its direction when positive.
optionsOffsetOptionsThe shape of the corners on the outside of its turns.
toleranceToleranceThe tolerance.
Returns
- GeoPolyline2[]
The pieces of the parallel curve, in order along the polyline and running the same way. Usually one. Where the polyline turns tighter than the distance, the parallel curve would loop back over itself; those loops are cut away, as AutoCAD does, and a curve cut clean through comes back in several pieces. Each piece takes its place by the middle of its longest edge, so a piece that runs on across a pinch, or one left closed, comes where most of it lies.
Remarks
The parallel curve is the edge of the band the polyline sweeps sideways, minus the polyline itself and the band's two ends. Its corners are joined on the outside of each turn, so it keeps the distance from every segment on the side it was offset to. At a turn on the inside sharper than a right angle, the stretch of each moved segment that runs on past the other leg is cut away with the loop: the chain (10, 10), (0, 0), (10, 0) offset by 1 is the one piece from (10.707, 9.293) through (2.414, 1) to (10, 1). Where the edge of the band lies along another part of the polyline, within the tolerance, it is the polyline itself and goes: the step (0, 0), (10, 0), (10, 1), (-5, 1) offset by 1 is the one piece from (0, 0) to (-5, 0).
Exceptions
- ArgumentNullException
Thrown when the polyline or the options are null.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.