Bezier

Port of the operations of the library Bezier.JS with some adjustments, Original library created by Pomax: https://github.com/Pomax/bezierjs Based on algorithms described here: https://pomax.github.io/bezierinfo/

Constructors

Link copied to clipboard
constructor()
constructor(p0: Point, p1: Point)
constructor(p0: Point, p1: Point, p2: Point)
constructor(p0: Point, p1: Point, p2: Point, p3: Point)
constructor(points: PointList)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Curvature(val k: Double = 0.0, val r: Double = 0.0, val dk: Double = 0.0, val adk: Double = 0.0)
Link copied to clipboard
class Extrema(val xt: DoubleArray, val yt: DoubleArray)
Link copied to clipboard
data class ProjectedPoint(var p: Point = Point(), var t: Ratio = Ratio.ZERO, var dSq: Double = 0.0) : IsAlmostEquals<Bezier.ProjectedPoint>

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val dims: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determines if this Bezier is simple.

Link copied to clipboard
open override val length: Double

Calculates the length of this curve .

Link copied to clipboard
Link copied to clipboard
open override val order: Int
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun calc(t: Ratio): Point
Link copied to clipboard
open fun calcOffset(t: Ratio, offset: Double): Point
Link copied to clipboard
fun clone(): Bezier
Link copied to clipboard

Computes the point of the curve at t

Link copied to clipboard
fun curvature(t: Ratio, kOnly: Boolean = false): Bezier.Curvature
Link copied to clipboard
fun derivative(t: Ratio, normalize: Boolean = false): Point

The derivate vector of the curve at t (normalized when normalize is set to true)

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(t: Ratio): Point

Computes the point of the curve at t

Link copied to clipboard
open override fun getBounds(): Rectangle
Link copied to clipboard
fun Curve.getEquidistantPoints(count: Int = this.recommendedDivisions(), out: PointArrayList = PointArrayList()): PointList
Link copied to clipboard
fun getLUT(steps: Int = 100, out: CurveLUT = CurveLUT(this, steps + 1)): CurveLUT
Link copied to clipboard
fun Curve.getPoints(count: Int = this.recommendedDivisions(), out: PointArrayList = PointArrayList()): PointList
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun hull(t: Ratio, out: PointArrayList = PointArrayList()): PointList
Link copied to clipboard
fun hullOrNull(t: Ratio, out: PointArrayList = PointArrayList()): PointList?
Link copied to clipboard

Returns the t values where the curve changes its sign

Link copied to clipboard
fun intersections(curve: Bezier, threshold: Double = 0.5): List<Pair<Ratio, Ratio>>
Link copied to clipboard
open override fun isAlmostEquals(other: Bezier, epsilon: Double): Boolean
Link copied to clipboard
open override fun normal(t: Ratio): Point

fun normal(t: Ratio, normalize: Boolean = true): Point

The normal vector of the curve at t (normalized when normalize is set to true)

Link copied to clipboard

This function creates a new curve, offset along the curve normals, at distance d. Note that deep magic lies here and the offset curve of a Bézier curve cannot ever be another Bézier curve.

fun offset(t: Ratio, d: Double): Point

A coordinate is returned, representing the point on the curve at t=..., offset along its normal by a distance d

Link copied to clipboard
fun outline(d1: Double, d2: Double = d1, d3: Double = d1, d4: Double = d2): Curves
Link copied to clipboard
fun overlaps(curve: Bezier): Boolean
Link copied to clipboard
fun project(point: Point, out: Bezier.ProjectedPoint = Bezier.ProjectedPoint()): Bezier.ProjectedPoint
Link copied to clipboard
open override fun ratioFromLength(length: Double): Ratio
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Scales a curve with respect to the intersection between the end point normals at a d distance.

Link copied to clipboard
fun selfIntersections(threshold: Double = 0.5, out: DoubleArrayList = DoubleArrayList()): DoubleArrayList
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun tangent(t: Ratio): Point
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun toLine(): Line
Link copied to clipboard
Link copied to clipboard
fun toQuad(): Bezier
Link copied to clipboard
Link copied to clipboard

Gets a list of isSimple bezier sub bezier curves.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun Curve.toVectorPath(out: VectorPath = VectorPath()): VectorPath
Link copied to clipboard
Link copied to clipboard
fun translate(dx: Double, dy: Double): Bezier