Table of Contents

Class BufferParameters

Namespace
NetTopologySuite.Operation.Buffer
Assembly
NetTopologySuite.dll

A value class containing the parameters which specify how a buffer should be constructed.

The parameters allow control over:
  • Quadrant segments (accuracy of approximation for circular arcs)
  • End Cap style
  • Join style
  • Mitre limit
  • whether the buffer is single-sided
public class BufferParameters
Inheritance
BufferParameters
Inherited Members

Constructors

BufferParameters()

Creates a default set of parameters

public BufferParameters()

BufferParameters(int)

Creates a set of parameters with the given quadrantSegments value.

public BufferParameters(int quadrantSegments)

Parameters

quadrantSegments int

The number of quadrant segments to use

BufferParameters(int, EndCapStyle)

Creates a set of parameters with the given quadrantSegments and endCapStyle values.

public BufferParameters(int quadrantSegments, EndCapStyle endCapStyle)

Parameters

quadrantSegments int

the number of quadrant segments to use

endCapStyle EndCapStyle

the end cap style to use

BufferParameters(int, EndCapStyle, JoinStyle, double)

Creates a set of parameters with the given parameter values.

public BufferParameters(int quadrantSegments, EndCapStyle endCapStyle, JoinStyle joinStyle, double mitreLimit)

Parameters

quadrantSegments int

the number of quadrant segments to use

endCapStyle EndCapStyle

the end cap style to use

joinStyle JoinStyle

the join style to use

mitreLimit double

the mitre limit to use

Fields

DefaultJoinStyle

The default number of facets into which to divide a fillet of 90 degrees.
A value of 8 gives less than 2% max error in the buffer distance.

For a max error of < 1%, use QS = 12.

For a max error of < 0.1%, use QS = 18.
public const JoinStyle DefaultJoinStyle = Round

Field Value

JoinStyle

DefaultMitreLimit

The default mitre limit Allows fairly pointy mitres.

public const double DefaultMitreLimit = 5

Field Value

double

DefaultQuadrantSegments

The default number of facets into which to divide a fillet of 90 degrees.
A value of 8 gives less than 2% max error in the buffer distance.

For a max error of < 1%, use QS = 12.

For a max error of < 0.1%, use QS = 18.
public const int DefaultQuadrantSegments = 8

Field Value

int

DefaultSimplifyFactor

The default simplify factor. Provides an accuracy of about 1%, which matches the accuracy of the DefaultQuadrantSegments parameter.

public const double DefaultSimplifyFactor = 0.01

Field Value

double

Properties

EndCapStyle

Gets or sets the end cap style of the generated buffer.

public EndCapStyle EndCapStyle { get; set; }

Property Value

EndCapStyle

Remarks

The styles supported are Round, Flat, and Square.

The default is Round.

IsSingleSided

Gets or sets whether the computed buffer should be single-sided. A single-sided buffer is constructed on only one side of each input line.

The side used is determined by the sign of the buffer distance:

  • a positive distance indicates the left-hand side
  • a negative distance indicates the right-hand side
The single-sided buffer of point geometries is the same as the regular buffer.

The End Cap Style for single-sided buffers is always ignored, and forced to the equivalent of Flat.

public bool IsSingleSided { get; set; }

Property Value

bool

JoinStyle

Gets/Sets the join style for outside (reflex) corners between line segments.

public JoinStyle JoinStyle { get; set; }

Property Value

JoinStyle

Remarks

The styles supported are Round, Mitre and Bevel

The default is Round

MitreLimit

Sets the limit on the mitre ratio used for very sharp corners.

public double MitreLimit { get; set; }

Property Value

double

Remarks

The mitre ratio is the ratio of the distance from the corner to the end of the mitred offset corner. When two line segments meet at a sharp angle, a miter join will extend far beyond the original geometry. (and in the extreme case will be infinitely far.) To prevent unreasonable geometry, the mitre limit allows controlling the maximum length of the join corner. Corners with a ratio which exceed the limit will be beveled.

QuadrantSegments

Gets or sets the number of line segments in a quarter-circle used to approximate angle fillets in round endcaps and joins. The value should be at least 1.

This determines the error in the approximation to the true buffer curve.
The default value of 8 gives less than 2% error in the buffer distance.

For an error of < 1%, use QS = 12.

For an error of < 0.1%, use QS = 18.

The error is always less than the buffer distance (in other words, the computed buffer curve is always inside the true curve).
public int QuadrantSegments { get; set; }

Property Value

int

SimplifyFactor

Factor used to determine the simplify distance tolerance for input simplification. Simplifying can increase the performance of computing buffers. Generally the simplify factor should be greater than 0. Values between 0.01 and .1 produce relatively good accuracy for the generate buffer. Larger values sacrifice accuracy in return for performance.

public double SimplifyFactor { get; set; }

Property Value

double

Methods

BufferDistanceError(int)

Computes the maximum distance error due to a given level of approximation to a true arc.

public static double BufferDistanceError(int quadSegs)

Parameters

quadSegs int

The number of segments used to approximate a quarter-circle

Returns

double

The error of approximation

Copy()

Creates a copy

public BufferParameters Copy()

Returns

BufferParameters