ShapeContour

@Serializable
data class ShapeContour(val segments: List<Segment2D>, val closed: Boolean, val polarity: YPolarity = YPolarity.CW_NEGATIVE_Y) : ShapeProvider, ShapeContourProvider, Path<Vector2> (source)

A List for managing a collection of Segment2Ds.

Constructors

Link copied to clipboard
constructor(segments: List<Segment2D>, closed: Boolean, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun adaptivePositions(distanceTolerance: Double = 0.5): List<Vector2>

Recursively subdivides linear Segment2Ds to approximate Bézier curves.

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

Recursively subdivides linear Segment2Ds to approximate Bézier curves.

Link copied to clipboard
open fun adaptivePositionsWithT(distanceTolerance: Double = 0.5): List<Pair<Vector2, Double>>
Link copied to clipboard

Closes the path of the ShapeContour.

Link copied to clipboard
operator fun ShapeContour.contains(point: Vector2): Boolean

Returns true if given point lies inside the ShapeContour.

Link copied to clipboard

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

Link copied to clipboard
open fun direction(ut: Double): Vector2
Link copied to clipboard
open fun equidistantPositions(pointCount: Int, distanceTolerance: Double = 0.5): List<Vector2>

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

Link copied to clipboard
open fun equidistantPositionsWithT(pointCount: Int, distanceTolerance: Double = 0.5): List<Pair<Vector2, Double>>
Link copied to clipboard

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

Link copied to clipboard

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

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

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

Link copied to clipboard

Projects a point on the ShapeContour

Link copied to clipboard

Calculates the normal for the given ut.

Link copied to clipboard
fun on(point: Vector2, error: Double = 5.0): Double?

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

Link copied to clipboard
operator fun plus(other: ShapeContour): ShapeContour
Link copied to clipboard
open fun pointAtLength(length: Double, distanceTolerance: Double = 0.5): Vector2

Calculates the point at a given distance along this ShapeContour.

Link copied to clipboard

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

Link copied to clipboard
open fun position(ut: Double): Vector2

Returns a point on the path of the ShapeContour.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Samples the ShapeContour into equidistant linear Segment2Ds.

Link copied to clipboard
fun sampleLinear(distanceTolerance: Double = 0.5): ShapeContour

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

Link copied to clipboard
open fun segment(ut: Double): Pair<Int, Double>

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

Link copied to clipboard
Link copied to clipboard
open override fun sub(t0: Double, t1: Double): ShapeContour

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

Link copied to clipboard
open fun tForLength(length: Double): Double

Estimates the t value for a given length.

Link copied to clipboard

Applies linear transformation to ShapeContour.

Link copied to clipboard

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

Properties

Link copied to clipboard

Calculates the bounding box of the contour as Rectangle.

Link copied to clipboard

Returns the ShapeContour, but with a clockwise winding.

Link copied to clipboard
open override val closed: Boolean
Link copied to clipboard
open override val contour: ShapeContour

the provided contour

Link copied to clipboard

Returns the ShapeContour, but with a counterclockwise winding.

Link copied to clipboard
open override val empty: Boolean

Returns true if ShapeContour doesn't contain any Segment2Ds.

Link copied to clipboard

Converts to a List of single Segment2Ds.

Link copied to clipboard
open override val infinity: Vector2
Link copied to clipboard
open override val length: Double

Calculates approximate Euclidean length of the contour.

Link copied to clipboard

Opens the path of the ShapeContour.

Link copied to clipboard
Link copied to clipboard

Reverses the direction of Segment2Ds and their order.

Link copied to clipboard
open override val segments: List<Segment2D>
Link copied to clipboard
open override val shape: Shape

Returns Shape representation.

Link copied to clipboard

Determines the winding order of the ShapeContour.