# ShapeContour

@Serializable
data class ShapeContour constructor(val segments: List<Segment>, val closed: Boolean, val polarity: YPolarity = YPolarity.CW_NEGATIVE_Y) : ShapeContourProvider(source)

A List for managing a collection of Segments.

## Constructors

constructor(segments: List<Segment>, closed: Boolean, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y)

object Companion

## Functions

fun adaptivePositions(distanceTolerance: Double = 0.5): List<Vector2>

Recursively subdivides linear Segments to approximate Bézier curves.

fun adaptivePositionsAndCorners(distanceTolerance: Double = 0.5): Pair<List<Vector2>, List<Boolean>>

Recursively subdivides linear Segments to approximate Bézier curves.

fun adaptivePositionsWithT(distanceTolerance: Double = 0.5): List<Pair<Vector2, Double>>

Closes the path of the ShapeContour.

operator fun ShapeContour.contains(point: Vector2): Boolean

Returns true if given point lies inside the ShapeContour.

Applies a boolean difference operation between the ShapeContour and another Shape.

fun equidistantPositions(pointCount: Int, distanceTolerance: Double = 0.5): List<Vector2>

Returns specified amount of points of equal distance from each other.

fun equidistantPositionsWithT(pointCount: Int, distanceTolerance: Double = 0.5): List<Pair<Vector2, Double>>

Applies a boolean intersection operation between the ShapeContour and a Shape.

Calculates a List of all intersections between the ShapeContour and a Segment.

Calculates a List of all intersections between the ShapeContour and a Shape.

Calculates a List of all intersections between the ShapeContour and another ShapeContour.

Projects a point on the ShapeContour

Calculates the normal for the given ut.

fun ShapeContour.offset(distance: Double, joinType: SegmentJoin = SegmentJoin.ROUND): ShapeContour

Offsets a ShapeContour's Segments by given distance.

fun on(point: Vector2, error: Double = 5.0): Double?

Checks if given point lies on the path of the ShapeContour.

operator fun plus(other: ShapeContour): ShapeContour
fun pointAtLength(length: Double, distanceTolerance: Double = 0.5): Vector2

Calculates the point at a given distance along this ShapeContour.

Calculates the pose Matrix44 (i.e. translation and rotation) that describes an orthonormal basis formed by normal and tangent of the contour at t.

Returns a point on the path of the ShapeContour.

Samples the ShapeContour into equidistant linear Segments.

fun sampleLinear(distanceTolerance: Double = 0.5): ShapeContour

Adaptively samples the contour into a new ShapeContour of linear Segments while still approximating the original contour.

Returns segment number and segment offset in a ShapeContour for the given ut.

fun sub(t0: Double, t1: Double): ShapeContour

Samples a new ShapeContour from the current ShapeContour starting at t0 and ending at t1.

fun tForLength(length: Double): Double

Estimates the t value for a given length.

Applies linear transformation to ShapeContour.

Applies a boolean org.openrndr.shape.union operation between the ShapeContour and a Shape.

## Properties

Calculates the bounding box of the contour as Rectangle.

Returns the ShapeContour, but with a clockwise winding.

open override val contour: ShapeContour

the provided contour

Returns the ShapeContour, but with a counterclockwise winding.

Returns true if ShapeContour doesn't contain any Segments.

Converts to a List of single Segments.

Calculates approximate Euclidean length of the contour.

Opens the path of the ShapeContour.