openrndr / org.openrndr.shape / ShapeContour

ShapeContour

data class ShapeContour (source)

Constructors

<init>

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

Properties

bounds

calculate bounding box Rectangle of the contour

val bounds: Rectangle

clockwise

convert to contour with clock wise winding

val clockwise: ShapeContour

closed

val closed: Boolean

counterClockwise

convert to contour with contour-clockwise winding

val counterClockwise: ShapeContour

empty

val empty: Boolean

exploded

convert to list of single segment ShapeContours

val exploded: List<ShapeContour>

length

calculate approximate Euclidean length of the contour

val length: Double

opened

val opened: ShapeContour

polarity

val polarity: YPolarity

reversed

val reversed: ShapeContour

segments

val segments: List<Segment>

shape

convert to Shape

val shape: Shape

triangulation

val triangulation: List<Triangle>

winding

determine winding order of the contour

val winding: Winding

Functions

adaptivePositions

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

adaptivePositionsAndCorners

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

adaptivePositionsAndDirection

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

contains

operator fun contains(point: Vector2): Boolean

equidistantPositions

fun equidistantPositions(pointCount: Int): List<Vector2>

nearest

Project a point on the contour

fun nearest(point: Vector2): ContourPoint

normal

Evaluates the contour for the given position

fun normal(ut: Double): Vector2

offset

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

on

Checks if a give point lies on the contour

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

plus

operator fun plus(other: ShapeContour): ShapeContour

pose

fun pose(t: Double): Matrix44

position

fun position(ut: Double): Vector2

sampleEquidistant

Sample the shape contour into line segments

fun sampleEquidistant(pointCount: Int): ShapeContour

sampleLinear

Adaptively sample the contour into line segments while still approximating the original contour

fun sampleLinear(distanceTolerance: Double = 0.5): ShapeContour

sub

Sample a sub contour

fun sub(startT: Double, endT: Double): ShapeContour

tForLength

Estimate t parameter value for a given length

fun tForLength(length: Double): Double

transform

fun transform(transform: Matrix44): ShapeContour

Companion Object Properties

EMPTY

val EMPTY: ShapeContour

Companion Object Functions

fromPoints

fun fromPoints(points: List<Vector2>, closed: Boolean, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour