Table of Contents

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

loop GeoPolygonArc2

The loop.

distance double

How 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

loop GeoPolygonArc2
distance double
tolerance Tolerance

Returns

GeoPolygonArc2[]

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

loop GeoPolygonArc2
distance double
join OffsetJoin

Returns

GeoPolygonArc2[]

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

loop GeoPolygonArc2
distance double
join OffsetJoin
tolerance Tolerance

Returns

GeoPolygonArc2[]

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

loop GeoPolygonArc2
distance double
options OffsetOptions

Returns

GeoPolygonArc2[]

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

loop GeoPolygonArc2

The loop.

distance double

How far to move the boundary: outward when positive, inward when negative.

options OffsetOptions

How to fill a corner that opens up, and how far a miter may run.

tolerance Tolerance

The 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

chain GeoPolylineArc2

The chain.

distance double

How 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

chain GeoPolylineArc2
distance double
tolerance Tolerance

Returns

GeoPolylineArc2[]

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

chain GeoPolylineArc2
distance double
join OffsetJoin

Returns

GeoPolylineArc2[]

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

chain GeoPolylineArc2
distance double
join OffsetJoin
tolerance Tolerance

Returns

GeoPolylineArc2[]

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

chain GeoPolylineArc2
distance double
options OffsetOptions

Returns

GeoPolylineArc2[]

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

chain GeoPolylineArc2

The chain.

distance double

How far to move it, to the left of the way it runs when positive.

options OffsetOptions

How to fill a corner that opens up, and how far a miter may run.

tolerance Tolerance

The 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

line GeoLine2

The segment.

distance double

How 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

line GeoLine2

The segment.

distance double

How far to move it, to the left of its direction when positive.

tolerance Tolerance

The 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

polygon GeoPolygon2

The polygon.

distance double

How 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

polygon GeoPolygon2

The polygon.

distance double

How far the boundary moves: outward when positive, inward when negative.

tolerance Tolerance

The 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

polygon GeoPolygon2

The polygon.

distance double

How far the boundary moves: outward when positive, inward when negative.

join OffsetJoin

How 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

polygon GeoPolygon2

The polygon.

distance double

How far the boundary moves: outward when positive, inward when negative.

join OffsetJoin

How the corners that open up are closed.

tolerance Tolerance

The 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

polygon GeoPolygon2

The polygon.

distance double

How far the boundary moves: outward when positive, inward when negative.

options OffsetOptions

The 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

polygon GeoPolygon2

The polygon.

distance double

How far the boundary moves: outward when positive, inward when negative.

options OffsetOptions

The corner shape.

tolerance Tolerance

The 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

face GeoFace2
distance double

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

face GeoFace2
distance double
tolerance Tolerance

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

face GeoFace2
distance double
join OffsetJoin

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

face GeoFace2
distance double
join OffsetJoin
tolerance Tolerance

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

face GeoFace2
distance double
options OffsetOptions

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

face GeoFace2

The face.

distance double

How far the material grows: its boundary moves out and its holes shrink when positive.

options OffsetOptions

The corner shape.

tolerance Tolerance

The 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

polyline GeoPolyline2
distance double

Returns

GeoPolyline2[]

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

polyline GeoPolyline2
distance double
tolerance Tolerance

Returns

GeoPolyline2[]

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

polyline GeoPolyline2
distance double
join OffsetJoin

Returns

GeoPolyline2[]

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

polyline GeoPolyline2
distance double
join OffsetJoin
tolerance Tolerance

Returns

GeoPolyline2[]

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

polyline GeoPolyline2
distance double
options OffsetOptions

Returns

GeoPolyline2[]

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

polyline GeoPolyline2

The polyline.

distance double

How far to move it, to the left of its direction when positive.

options OffsetOptions

The shape of the corners on the outside of its turns.

tolerance Tolerance

The 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.