openrndr / org.openrndr.shape / Segment

Segment

class Segment (source)

Segment describes a linear or bezier path between two points

Constructors

<init>

Linear segment constructor

Segment(start: Vector2, end: Vector2)

Quadratic bezier segment constructor

Segment(start: Vector2, c0: Vector2, end: Vector2)

Cubic bezier segment constructor

Segment(start: Vector2, c0: Vector2, c1: Vector2, end: Vector2)Segment(start: Vector2, control: Array<Vector2>, end: Vector2)

Properties

bounds

val bounds: Rectangle

clockwise

val clockwise: Boolean

control

control points, zero-length iff the segment is linear

val control: Array<Vector2>

cubic

Cubic version of segment

val cubic: Segment

end

val end: Vector2

length

val length: Double

linear

val linear: Boolean

quadratic

val quadratic: Segment

reverse

val reverse: Segment

simple

val simple: Boolean

start

val start: Vector2

type

val type: SegmentType

Functions

adaptivePositions

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

adaptivePositionsAndNormals

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

copy

fun copy(start: Vector2 = this.start, control: Array<Vector2> = this.control, end: Vector2 = this.end): Segment

derivative

fun derivative(t: Double): Vector2

direction

fun direction(): Vector2
fun direction(t: Double): Vector2

equals

fun equals(other: Any?): Boolean

equidistantPositions

Sample pointCount points on the segment

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

extrema

fun extrema(): List<Double>

extremaPoints

fun extremaPoints(): List<Vector2>

hashCode

fun hashCode(): Int

isStraight

fun isStraight(epsilon: Double = 0.01): Boolean

lut

fun lut(size: Int = 100): List<Vector2>

normal

fun normal(ut: Double, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): Vector2

offset

fun offset(distance: Double, stepSize: Double = 0.01, yPolarity: YPolarity = YPolarity.CW_NEGATIVE_Y): List<Segment>

on

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

position

fun position(ut: Double): Vector2

project

fun project(point: Vector2): SegmentProjection

reduced

fun reduced(stepSize: Double = 0.01): List<Segment>

scale

fun scale(scale: Double, polarity: YPolarity): Segment
fun scale(polarity: YPolarity, scale: (Double) -> Double): Segment

split

Split the contour

fun split(t: Double): Array<Segment>

sub

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

toString

fun toString(): String

transform

fun transform(transform: Matrix44): Segment