offsetOrNull

fun offsetOrNull(geometry: Geometry, distance: Double, offsetType: GeometryOffsetType, bevelRatio: Double, flattenError: Double): Geometry?

Creates an offset version of the input geometry. The offset operation creates a geometry that is a constant distance from the input geometry. It is similar to buffering, but produces a one-sided result. If distance 0, then the offset geometry is constructed to the right of the input geometry, otherwise it is constructed to the left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counterclockwise. So the "right side" of a simple polygon is always its inside. The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.

Supports true curves as input, producing a densified curve as output where applicable.

Return

The offset geometry object, or null if a true curve geometry was used as input when it is not supported by this operator.

Since

200.1.0

Parameters

geometry

A geometry object.

distance

The offset distance for the new geometry.

offsetType

The offset type the resulting geometry.

bevelRatio

The ratio used to produce a bevel join instead of a miter join (used only when the offset type is Miter).

flattenError

The maximum distance of the resulting segments compared to the true circular arc (used only when the offset type if round).