Logo Euclid

Offset3D Module

A module containing the core algorithms for offsetting 3D polylines. For a simpler interface, prefer the offset functions in the Polyline3D module. Each point gets its own offset direction: a local plane, with an in-plane direction perpendicular to each adjacent segment, and the direction perpendicular to that plane. At a corner the local plane contains both adjacent segments. A collinear point takes the plane interpolated between the neighboring corners.

Types

Type Description

OffsetDirection

The offset directions at a point of a polyline. At a corner, the local plane contains both adjacent segments. At a collinear point, it is interpolated between the planes of the neighboring corners.

VarDistParallel

An Enum for describing what to do at collinear points where the two segments have different in-plane offset distances. Collinear segments can only be offset parallel to themselves if their distances are the same. A point is collinear here if it turns by less than considerCollinearBelow, and if the polyline also turns by less than that from the last point that was offset exactly. This Enum describes the options: 1: Fail 2: just skip the point. 3: add a point at the same proportional distance on the oblique segment, non parallel offsets. 4: add a point perpendicular from here intersecting the oblique segment, non parallel offsets.

Functions and values

Function or value Description

getOffsetDirections (xyzs, uvs, refNormal, considerCollinearBelow, failAtUTurnAbove)

Full Usage: getOffsetDirections (xyzs, uvs, refNormal, considerCollinearBelow, failAtUTurnAbove)

Parameters:
    xyzs : ResizeArray<float> - The X, Y and Z interleaved coordinates of the polyline. It is closed if the first and last point are within 1e-6.
    uvs : ResizeArray<float> - The X, Y and Z interleaved segment unit vectors, as from getSegmentUnitVectors.
    refNormal : UnitVec - The reference normal that orients the corners, or defines all directions if there is no corner. Fails if it is within half a degree of perpendicular to every corner normal, because then it cannot orient them.
    considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>> - Points where the segments turn by less than this angle are collinear, unless the polyline turned by more than this angle since the previous corner.
    failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>> - Fails at points where the segments turn by more than this angle. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<OffsetDirection> One offset direction per point.

Computes the offset direction at each point of a polyline.

A point is a corner if it turns by at least the angle of considerCollinearBelow, or if the angle between the first segment after the previous corner and the segment after the point reaches it. So a finely sampled arc still gets a corner at least every few points. For an open polyline, the run before the first corner starts with the first segment. At a corner the local plane contains both adjacent segments, and its normal is their cross product. The corner normal that is most aligned with refNormal is flipped to match it, the first one if several are aligned equally within 1e-6. From there, each corner normal is flipped to match its neighbor corner, so that the inside stays on the same side along the polyline. If the two normals are within half a degree of perpendicular, it is flipped to match the in-plane direction of the neighbor corner on the segment towards it instead. So the result does not depend on rounding, and rotating the polyline rotates the result. Every other point takes the normal interpolated between the neighboring corners at its position, made perpendicular to the polyline. The points before the first and after the last corner of an open polyline, including its end points, take the normal of that corner. If no point is a corner, as on a straight polyline, every point takes refNormal made perpendicular to the polyline. The in-plane directions are perpendicular to the normal and to each adjacent segment. The end points of an open polyline only have one segment, so both of their in-plane directions are the same. For a closed polyline the last direction is the first.

xyzs : ResizeArray<float>

The X, Y and Z interleaved coordinates of the polyline. It is closed if the first and last point are within 1e-6.

uvs : ResizeArray<float>

The X, Y and Z interleaved segment unit vectors, as from getSegmentUnitVectors.

refNormal : UnitVec

The reference normal that orients the corners, or defines all directions if there is no corner. Fails if it is within half a degree of perpendicular to every corner normal, because then it cannot orient them.

considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>>

Points where the segments turn by less than this angle are collinear, unless the polyline turned by more than this angle since the previous corner.

failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>>

Fails at points where the segments turn by more than this angle. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<OffsetDirection>

One offset direction per point.

getSegmentUnitVectors xyzs

Full Usage: getSegmentUnitVectors xyzs

Parameters:
    xyzs : ResizeArray<float> - The X, Y and Z interleaved coordinates of the polyline (x0, y0, z0, x1, y1, z1, ...).

Returns: ResizeArray<float> An X, Y and Z interleaved ResizeArray of the segment unit vectors, with one vector less than the number of points. Fails if two consecutive points are closer than 1e-6 or if there are less than two points.

Computes the unit vectors of the segments of a polyline.

xyzs : ResizeArray<float>

The X, Y and Z interleaved coordinates of the polyline (x0, y0, z0, x1, y1, z1, ...).

Returns: ResizeArray<float>

An X, Y and Z interleaved ResizeArray of the segment unit vectors, with one vector less than the number of points. Fails if two consecutive points are closer than 1e-6 or if there are less than two points.

offset distanceInPlane distancePerpendicular xyzs

Full Usage: offset distanceInPlane distancePerpendicular xyzs

Parameters:
    distanceInPlane : float - The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of the polyline. A negative distance offsets to the outside. No matter how the polyline is oriented.
    distancePerpendicular : float - The offset distance perpendicular to the local plane. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards. A negative distance offsets in the opposite direction.
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates.

A constant-distance offset algorithm for closed or open polylines in 3D. The reference normal is the average normal of the polyline. Uses default angles: collinear below 2.5 degrees, fails at U-turns above 175 degrees.

distanceInPlane : float

The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of the polyline. A negative distance offsets to the outside. No matter how the polyline is oriented.

distancePerpendicular : float

The offset distance perpendicular to the local plane. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards. A negative distance offsets in the opposite direction.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates.

offsetByNormal refNormal distanceInPlane distancePerpendicular xyzs

Full Usage: offsetByNormal refNormal distanceInPlane distancePerpendicular xyzs

Parameters:
    refNormal : UnitVec - The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.
    distanceInPlane : float - The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal, and to the outside of one that turns clockwise. A negative distance offsets the other way.
    distancePerpendicular : float - The offset distance perpendicular to the local plane. A positive distance offsets to the side of refNormal, a negative distance to the opposite side.
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates.

A constant-distance offset algorithm for closed or open polylines in 3D. Uses default angles: collinear below 2.5 degrees, fails at U-turns above 175 degrees.

refNormal : UnitVec

The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.

distanceInPlane : float

The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal, and to the outside of one that turns clockwise. A negative distance offsets the other way.

distancePerpendicular : float

The offset distance perpendicular to the local plane. A positive distance offsets to the side of refNormal, a negative distance to the opposite side.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates.

offsetByNormalCustom (xyzs, distanceInPlane, distancePerpendicular, refNormal, considerCollinearBelow, failAtUTurnAbove)

Full Usage: offsetByNormalCustom (xyzs, distanceInPlane, distancePerpendicular, refNormal, considerCollinearBelow, failAtUTurnAbove)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.
    distanceInPlane : float - The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal, and to the outside of one that turns clockwise. A negative distance offsets the other way.
    distancePerpendicular : float - The offset distance perpendicular to the local plane. A positive distance offsets to the side of refNormal, a negative distance to the opposite side.
    refNormal : UnitVec - The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.
    considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees. A collinear point takes the plane interpolated between the neighboring corners.
    failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates.

A constant-distance offset algorithm for closed or open polylines in 3D, with all settings given explicitly. Note that considerCollinearBelow comes before failAtUTurnAbove, both are cosine measures.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

distanceInPlane : float

The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal, and to the outside of one that turns clockwise. A negative distance offsets the other way.

distancePerpendicular : float

The offset distance perpendicular to the local plane. A positive distance offsets to the side of refNormal, a negative distance to the opposite side.

refNormal : UnitVec

The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.

considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees. A collinear point takes the plane interpolated between the neighboring corners.

failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates.

offsetCustom (xyzs, distanceInPlane, distancePerpendicular, considerCollinearBelow, failAtUTurnAbove)

Full Usage: offsetCustom (xyzs, distanceInPlane, distancePerpendicular, considerCollinearBelow, failAtUTurnAbove)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.
    distanceInPlane : float - The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of the polyline, a negative distance to the outside, no matter how the polyline is oriented.
    distancePerpendicular : float - The offset distance perpendicular to the local plane. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards. A negative distance offsets in the opposite direction.
    considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees. A collinear point takes the plane interpolated between the neighboring corners.
    failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates.

A constant-distance offset algorithm for closed or open polylines in 3D, with all settings given explicitly. The reference normal is the average normal of the polyline. Note that considerCollinearBelow comes before failAtUTurnAbove, both are cosine measures.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

distanceInPlane : float

The offset distance in the local plane defined by two segments. A positive distance offsets to the inside of the polyline, a negative distance to the outside, no matter how the polyline is oriented.

distancePerpendicular : float

The offset distance perpendicular to the local plane. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards. A negative distance offsets in the opposite direction.

considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees. A collinear point takes the plane interpolated between the neighboring corners.

failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates.

offsetVariable distancesInPlane distancesPerpendicular xyzs

Full Usage: offsetVariable distancesInPlane distancesPerpendicular xyzs

Parameters:
    distancesInPlane : IList<float> - The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of the polyline. A negative distance offsets to the outside. No matter how the polyline is oriented.
    distancesPerpendicular : IList<float> - The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards. A negative distance offsets in the opposite direction.
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates.

Offsetting each segment by its own distance. For closed or open polylines in 3D. The reference normal is the average normal of the polyline. Fails at collinear points where the two segments have different in-plane distances (uses VarDistParallel.Fail). Uses default angles: collinear below 2.5 degrees, fails at U-turns above 175 degrees.

distancesInPlane : IList<float>

The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of the polyline. A negative distance offsets to the outside. No matter how the polyline is oriented.

distancesPerpendicular : IList<float>

The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards. A negative distance offsets in the opposite direction.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates.

offsetVariableByNormal refNormal distancesInPlane distancesPerpendicular xyzs

Full Usage: offsetVariableByNormal refNormal distancesInPlane distancesPerpendicular xyzs

Parameters:
    refNormal : UnitVec - The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.
    distancesInPlane : IList<float> - The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal.
    distancesPerpendicular : IList<float> - The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point.
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates.

Offsetting each segment by its own distance. For closed or open polylines in 3D. Fails at collinear points where the two segments have different in-plane distances (uses VarDistParallel.Fail). Uses default angles: collinear below 2.5 degrees, fails at U-turns above 175 degrees.

refNormal : UnitVec

The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.

distancesInPlane : IList<float>

The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal.

distancesPerpendicular : IList<float>

The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates.

offsetVariableByNormalCustom (xyzs, distancesInPlane, distancesPerpendicular, refNormal, varDistParallelBehavior, considerCollinearBelow, failAtUTurnAbove)

Full Usage: offsetVariableByNormalCustom (xyzs, distancesInPlane, distancesPerpendicular, refNormal, varDistParallelBehavior, considerCollinearBelow, failAtUTurnAbove)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.
    distancesInPlane : IList<float> - The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal, and to the outside of one that turns clockwise. A negative distance offsets the other way.
    distancesPerpendicular : IList<float> - The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point. A positive distance offsets to the side of refNormal, a negative distance to the opposite side.
    refNormal : UnitVec - The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.
    varDistParallelBehavior : VarDistParallel - The behavior to use at collinear points where the two segments have different in-plane distances.
    considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees.
    failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates. If collinear segment handling is set to Skip the point count may differ from input.

Offsetting each segment by its own distance. For closed or open polylines in 3D, with all settings given explicitly. Note that considerCollinearBelow comes before failAtUTurnAbove, both are cosine measures.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

distancesInPlane : IList<float>

The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of a polyline that turns counter-clockwise around refNormal, and to the outside of one that turns clockwise. A negative distance offsets the other way.

distancesPerpendicular : IList<float>

The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point. A positive distance offsets to the side of refNormal, a negative distance to the opposite side.

refNormal : UnitVec

The reference normal vector to use for orienting the local planes. For a counter-clockwise polyline in the XY plane this is upwards. If it points down, the offset direction is flipped.

varDistParallelBehavior : VarDistParallel

The behavior to use at collinear points where the two segments have different in-plane distances.

considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees.

failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates. If collinear segment handling is set to Skip the point count may differ from input.

offsetVariableCustom (xyzs, distancesInPlane, distancesPerpendicular, varDistParallelBehavior, considerCollinearBelow, failAtUTurnAbove)

Full Usage: offsetVariableCustom (xyzs, distancesInPlane, distancesPerpendicular, varDistParallelBehavior, considerCollinearBelow, failAtUTurnAbove)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.
    distancesInPlane : IList<float> - The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of the polyline, a negative distance to the outside, no matter how the polyline is oriented.
    distancesPerpendicular : IList<float> - The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards.
    varDistParallelBehavior : VarDistParallel - The behavior to use at collinear points where the two segments have different in-plane distances.
    considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees.
    failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>> - The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float> A new ResizeArray of interleaved coordinates. If collinear segment handling is set to Skip the point count may differ from input.

Offsetting each segment by its own distance. For closed or open polylines in 3D, with all settings given explicitly. The reference normal is the average normal of the polyline. Note that considerCollinearBelow comes before failAtUTurnAbove, both are cosine measures.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset.

distancesInPlane : IList<float>

The offset distances in the local plane defined by two segments, one per segment. A positive distance offsets to the inside of the polyline, a negative distance to the outside, no matter how the polyline is oriented.

distancesPerpendicular : IList<float>

The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point. A positive distance offsets in the direction of the computed normal. For a counter-clockwise polyline in xy-plane this is Upwards.

varDistParallelBehavior : VarDistParallel

The behavior to use at collinear points where the two segments have different in-plane distances.

considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle below which segments are considered collinear, the other functions use 2.5 degrees.

failAtUTurnAbove : float<MeasureProduct<cosine, MeasureOne>>

The cosine of the angle above which a U-turn is considered to fail, the other functions use 175 degrees. There is no U-turn behavior like Offset2D.UTurn, on purpose: two almost opposite segments span no reliable plane in 3D, so a chamfer or threshold point has no defined direction. Remove U-turns first, for example with Polyline3D.removeUTurns.

Returns: ResizeArray<float>

A new ResizeArray of interleaved coordinates. If collinear segment handling is set to Skip the point count may differ from input.

offsetVariableWithDirections (xyzs, uvs, dirs, distancesInPlane, distancesPerpendicular, varDistParallelBehavior, considerCollinearBelow)

Full Usage: offsetVariableWithDirections (xyzs, uvs, dirs, distancesInPlane, distancesPerpendicular, varDistParallelBehavior, considerCollinearBelow)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset. It is closed if the first and last point are within 1e-6, then the last offset point is the first.
    uvs : ResizeArray<float> - The X, Y and Z interleaved segment unit vectors, as from getSegmentUnitVectors.
    dirs : ResizeArray<OffsetDirection> - The offset directions at each point of the polyline, as from getOffsetDirections.
    distancesInPlane : IList<float> - The offset distances in the local plane, one per segment. Each segment is offset parallel to itself by its own distance.
    distancesPerpendicular : IList<float> - The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point.
    varDistParallelBehavior : VarDistParallel - The behavior to use at collinear points where the two segments have different in-plane distances.
    considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>> - Points where the segments turn by less than this angle are collinear, unless the polyline turned by more than this angle since the last point that was offset exactly.

Returns: ResizeArray<float> The offset points as a ResizeArray of interleaved coordinates. With VarDistParallel.Skip there may be fewer points than in the input.

Offsets a polyline by variable distances.

Each point is offset in its local plane where the in-plane offset lines of its two segments meet, and then by its own perpendicular distance along the perpendicular direction of its local plane. If the in-plane distances of the two segments differ at a collinear point, the offset lines meet far away or not at all, and varDistParallelBehavior decides. A point is collinear here if it turns by less than considerCollinearBelow, and the polyline also turns by less than that, from the segment after the last point that was offset exactly to the segment after this point. So a finely sampled arc still gets an exact point at least every few points. Proportional and Project place the collinear points on the line between the in-plane offsets of the nearest exact points.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset. It is closed if the first and last point are within 1e-6, then the last offset point is the first.

uvs : ResizeArray<float>

The X, Y and Z interleaved segment unit vectors, as from getSegmentUnitVectors.

dirs : ResizeArray<OffsetDirection>

The offset directions at each point of the polyline, as from getOffsetDirections.

distancesInPlane : IList<float>

The offset distances in the local plane, one per segment. Each segment is offset parallel to itself by its own distance.

distancesPerpendicular : IList<float>

The offset distances perpendicular to the local plane, one per point. For a closed polyline one less, because its last point is its first point.

varDistParallelBehavior : VarDistParallel

The behavior to use at collinear points where the two segments have different in-plane distances.

considerCollinearBelow : float<MeasureProduct<cosine, MeasureOne>>

Points where the segments turn by less than this angle are collinear, unless the polyline turned by more than this angle since the last point that was offset exactly.

Returns: ResizeArray<float>

The offset points as a ResizeArray of interleaved coordinates. With VarDistParallel.Skip there may be fewer points than in the input.

offsetWithDirections (xyzs, dirs, distanceInPlane, distancePerpendicular)

Full Usage: offsetWithDirections (xyzs, dirs, distanceInPlane, distancePerpendicular)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset. It is closed if the first and last point are within 1e-6, then the last offset point is the first.
    dirs : ResizeArray<OffsetDirection> - The offset directions at each point of the polyline, as from getOffsetDirections.
    distanceInPlane : float - The distance to offset in the local plane of each point.
    distancePerpendicular : float - The distance to offset perpendicular to the local plane of each point.

Returns: ResizeArray<float> The offset points as a ResizeArray of interleaved coordinates.

Offsets a polyline by a constant distance.

xyzs : ResizeArray<float>

The interleaved coordinates (x0, y0, z0, x1, y1, z1, ...) of the polyline to offset. It is closed if the first and last point are within 1e-6, then the last offset point is the first.

dirs : ResizeArray<OffsetDirection>

The offset directions at each point of the polyline, as from getOffsetDirections.

distanceInPlane : float

The distance to offset in the local plane of each point.

distancePerpendicular : float

The distance to offset perpendicular to the local plane of each point.

Returns: ResizeArray<float>

The offset points as a ResizeArray of interleaved coordinates.

removeUTurns (xyzs, uvs, minCos)

Full Usage: removeUTurns (xyzs, uvs, minCos)

Parameters:
    xyzs : ResizeArray<float> - The interleaved coordinates of the polyline.
    uvs : ResizeArray<float> - The precomputed X, Y and Z interleaved segment unit vectors (one per segment, as from getSegmentUnitVectors).
    minCos : float<MeasureProduct<cosine, MeasureOne>> - The minimum cosine value for detecting U-turns.

Returns: ResizeArray<float> If no U-turns are present, the original ResizeArray is returned. If U-turns are present, a new ResizeArray of coordinates is returned with the U-turns removed.

Removes Sharp U-Turns from an X, Y and Z interleaved ResizeArray, like Polyline3D is using.

xyzs : ResizeArray<float>

The interleaved coordinates of the polyline.

uvs : ResizeArray<float>

The precomputed X, Y and Z interleaved segment unit vectors (one per segment, as from getSegmentUnitVectors).

minCos : float<MeasureProduct<cosine, MeasureOne>>

The minimum cosine value for detecting U-turns.

Returns: ResizeArray<float>

If no U-turns are present, the original ResizeArray is returned. If U-turns are present, a new ResizeArray of coordinates is returned with the U-turns removed.

setOffCorner (res, x, y, z, distanceInPlane, distancePerpendicular, previousInPlane, nextInPlane, perpendicular, cosine)

Full Usage: setOffCorner (res, x, y, z, distanceInPlane, distancePerpendicular, previousInPlane, nextInPlane, perpendicular, cosine)

Parameters:
    res : ResizeArray<float> - The buffer to add the X, Y and Z coordinates of the offset point to.
    x : float - The X coordinate of the input point.
    y : float - The Y coordinate of the input point.
    z : float - The Z coordinate of the input point.
    distanceInPlane : float - The offset distance in the local plane.
    distancePerpendicular : float - The offset distance perpendicular to the local plane.
    previousInPlane : UnitVec - The in-plane unit direction perpendicular to the previous segment.
    nextInPlane : UnitVec - The in-plane unit direction perpendicular to the next segment.
    perpendicular : UnitVec - The unit direction perpendicular to the local plane.
    cosine : float - The precomputed dot product of previousInPlane and nextInPlane.

Modifiers: inline

The core offset algorithm. Adds the offset point to the result buffer.

Computes pt + (previousInPlane + nextInPlane) * (distanceInPlane / (1.0 + cosine)) + perpendicular * distancePerpendicular. At a 180 degree U-turn the cosine is -1.0 and the point is at infinity.

res : ResizeArray<float>

The buffer to add the X, Y and Z coordinates of the offset point to.

x : float

The X coordinate of the input point.

y : float

The Y coordinate of the input point.

z : float

The Z coordinate of the input point.

distanceInPlane : float

The offset distance in the local plane.

distancePerpendicular : float

The offset distance perpendicular to the local plane.

previousInPlane : UnitVec

The in-plane unit direction perpendicular to the previous segment.

nextInPlane : UnitVec

The in-plane unit direction perpendicular to the next segment.

perpendicular : UnitVec

The unit direction perpendicular to the local plane.

cosine : float

The precomputed dot product of previousInPlane and nextInPlane.

Type something to start searching.