Table of Contents

Class OffsetCurve

Namespace
NetTopologySuite.Operation.Buffer
Assembly
NetTopologySuite.dll

Computes an offset curve from a geometry. The offset curve is a linear geometry which is offset a specified distance from the input. If the offset distance is positive the curve lies on the left side of the input; if it is negative the curve is on the right side.

The offset curve is computed as a single contiguous section of the geometry buffer boundary. In some geometric situations this definition is ill-defined. This algorithm provides a "best-effort" interpretation. In particular:
  • For self-intersecting lines, the buffer boundary includes offset lines for both left and right sides of the input line. Only a single contiguous portion on the specified side is returned.
  • If the offset corresponds to buffer holes, only the largest hole is used.
Offset curves support setting the number of quadrant segments, the join style, and the mitre limit(if applicable) via the BufferParameters.
public class OffsetCurve
Inheritance
OffsetCurve
Inherited Members

Constructors

OffsetCurve(Geometry, double)

Creates a new instance for computing an offset curve for a geometryat a given distance. with default quadrant segments(DefaultQuadrantSegments and join style (DefaultJoinStyle).

public OffsetCurve(Geometry geom, double distance)

Parameters

geom Geometry

The geometry

distance double

A distance value

OffsetCurve(Geometry, double, BufferParameters)

public OffsetCurve(Geometry geom, double distance, BufferParameters bufParams)

Parameters

geom Geometry
distance double
bufParams BufferParameters

Methods

GetCurve()

Gets the computed offset curve.

public Geometry GetCurve()

Returns

Geometry

The offset curve geometry

GetCurve(Geometry, double)

Computes the offset curve of a geometry at a given distance.

public static Geometry GetCurve(Geometry geom, double distance)

Parameters

geom Geometry

A geometry

distance double

the offset distance (positive = left, negative = right)

Returns

Geometry

The offset curve

GetCurve(Geometry, double, int, JoinStyle, double)

Computes the offset curve of a geometry at a given distance, and for a specified quadrant segments, join style and mitre limit.

public static Geometry GetCurve(Geometry geom, double distance, int quadSegs = -1, JoinStyle joinStyle = JoinStyle.Round, double mitreLimit = -1)

Parameters

geom Geometry

A geometry

distance double

The offset distance (positive = left, negative = right)

quadSegs int

The quadrant segments

joinStyle JoinStyle

The join style

mitreLimit double

The mitre limit

Returns

Geometry

The offset curve

RawOffset(LineString, double)

Gets the raw offset line, with default buffer parameters.

public static Coordinate[] RawOffset(LineString geom, double distance)

Parameters

geom LineString

The LineString to offset

distance double

The offset distance

Returns

Coordinate[]

The raw offset line

RawOffset(LineString, double, BufferParameters)

Gets the raw offset line. The quadrant segments and join style and mitre limit to be set via BufferParameters.

The raw offset line may contain loops and other artifacts which are not present in the true offset curve. The raw offset line is matched to the buffer ring (which is clean) to extract the offset curve.
public static Coordinate[] RawOffset(LineString geom, double distance, BufferParameters bufParams)

Parameters

geom LineString

The LineString to offset

distance double

The offset distance

bufParams BufferParameters

The buffer parameters to use

Returns

Coordinate[]

The raw offset line