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, each running the way the one that made it ran.
Exceptions
- ArgumentNullException
Thrown when the loop or the options are null.
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.
Returns
- GeoPolylineArc2[]
The offset chains.
Exceptions
- ArgumentNullException
Thrown when the chain or the options are null.
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.
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.
Exceptions
- ArgumentNullException
Thrown when the polyline or the options are null.
- ArgumentOutOfRangeException
Thrown when the distance is not a finite number.