Package-level declarations

Types

Link copied to clipboard
class BSpline<T : LinearType<T>>(val controlPoints: List<T>, val degree: Int, val knots: List<Double>, val closed: Boolean = false)

A B-spline curve of degree p with controlPoints and a non-decreasing knots vector of length controlPoints.size + p + 1, after Piegl and Tiller, "The NURBS Book" (Springer, 1997). The curve is defined on the domain from knot p to knot controlPoints.size, is C^(p-k) where a knot has multiplicity k, and stays inside the convex hull of every p + 1 consecutive control points.

Link copied to clipboard
class CatmullRom1(val p0: Double, val p1: Double, val p2: Double, val p3: Double, val alpha: Double = 0.5)

Creates a 1D Catmull-Rom spline curve.

Link copied to clipboard
class CatmullRom2(val p0: Vector2, val p1: Vector2, val p2: Vector2, val p3: Vector2, val alpha: Double = 0.5)

Creates a 2D Catmull-Rom spline curve.

Link copied to clipboard
class CatmullRom3(val p0: Vector3, val p1: Vector3, val p2: Vector3, val p3: Vector3, val alpha: Double = 0.5)

Creates a 3D Catmull-Rom spline curve.

Link copied to clipboard
class CatmullRomChain1(points: List<Double>, alpha: Double = 0.5, val loop: Boolean = false)

Calculates the 1D Catmull–Rom spline for a chain of points and returns the combined curve.

Link copied to clipboard
class CatmullRomChain2(points: List<Vector2>, alpha: Double = 0.5, val loop: Boolean = false)

Calculates the 2D Catmull–Rom spline for a chain of points and returns the combined curve.

Link copied to clipboard
class CatmullRomChain3(points: List<Vector3>, alpha: Double = 0.5, val loop: Boolean = false)

Calculates the 3D Catmull–Rom spline for a chain of points and returns the combined curve.

Link copied to clipboard
data class TCB(val tension: Double = 0.0, val continuity: Double = 0.0, val bias: Double = 0.0)

The tension, continuity and bias of a kochanekBartels spline at a point.

Functions

Link copied to clipboard
fun <T : LinearType<T>> List<T>.bSpline(degree: Int = 3, closed: Boolean = false): BSpline<T>

The B-spline with this control polygon: BSpline.clamped for an open polygon, BSpline.periodic for a closed one. The degree is reduced where there are too few control points for it.

Link copied to clipboard
fun List<Vector2>.catmullRom(alpha: Double = 0.5, closed: Boolean): CatmullRomChain2
fun List<Vector3>.catmullRom(alpha: Double = 0.5, closed: Boolean): CatmullRomChain3
Link copied to clipboard
fun List<Vector2>.circleSpline(closed: Boolean, tolerance: Double = 0.01, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

Converts this polyline into a circle spline through all points, after Séquin, Lee and Yen, "Fair, G2- and C2-continuous circle splines for the interpolation of sparse data points" (Computer-Aided Design, 2005).

Link copied to clipboard
@JvmName(name = "interpolatingBSpline2D")
fun List<Vector2>.interpolatingBSpline(degree: Int = 3, closed: Boolean = false, alpha: Double = 0.5): BSpline<Vector2>

The B-spline of degree that passes through these 2D points, see interpolatingBSpline.

@JvmName(name = "interpolatingBSpline3D")
fun List<Vector3>.interpolatingBSpline(degree: Int = 3, closed: Boolean = false, alpha: Double = 0.5): BSpline<Vector3>

The B-spline of degree that passes through these 3D points, see interpolatingBSpline.

fun <T : LinearType<T>> List<T>.interpolatingBSpline(degree: Int = 3, closed: Boolean = false, alpha: Double = 0.5, distance: (T, T) -> Double): BSpline<T>

The B-spline of degree that passes through these points, after Piegl and Tiller, "The NURBS Book", algorithm A9.1.

Link copied to clipboard
fun List<Vector3>.kochanekBartels(closed: Boolean, parameters: List<TCB>): Path3D

Converts this 3D polyline into a Kochanek-Bartels spline with a tension, continuity and bias per point.

fun List<Vector2>.kochanekBartels(closed: Boolean, parameters: List<TCB>, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

Converts this polyline into a Kochanek-Bartels spline with a tension, continuity and bias per point, see List.kochanekBartels.

fun List<Vector3>.kochanekBartels(closed: Boolean, tension: Double = 0.0, continuity: Double = 0.0, bias: Double = 0.0): Path3D

Converts this 3D polyline into a Kochanek-Bartels spline, for instance for a camera path, see List.kochanekBartels.

fun List<Vector2>.kochanekBartels(closed: Boolean, tension: Double = 0.0, continuity: Double = 0.0, bias: Double = 0.0, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

Converts this polyline into a Kochanek-Bartels spline, after Kochanek and Bartels, "Interpolating splines with local tension, continuity, and bias control" (SIGGRAPH 1984): a cubic Hermite spline through all points whose tangents are shaped by a tension, continuity and bias, see TCB. With all three 0 it is the uniform Catmull-Rom spline.

Link copied to clipboard
fun CatmullRomChain2.toContour(): ShapeContour

Converts chain to a ShapeContour.

fun BSpline<Vector2>.toContour(tolerance: Double = 0.01, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

This spline as a ShapeContour: exactly, one Bézier segment per knot span, for degree 1 to 3, and approximated by cubic Béziers within tolerance for higher degrees.

Link copied to clipboard
fun BSpline<Vector3>.toPath3D(): Path3D

This spline as a Path3D, exactly for degree 1 to 3, see toContour; higher degrees are not supported.

Converts a 3D Catmull-Rom spline chain into a Path3D representation.

Link copied to clipboard
fun CatmullRom2.toSegment(): Segment2D

Converts spline to a Segment2D.

fun CatmullRom3.toSegment(): Segment3D

Converts the current 3D Catmull-Rom spline segment into a cubic Bézier curve representation.