Known direct subclasses
MutableCubic

This is a Mutable version of Cubic, used mostly for performance critical paths so we can avoid creating new Cubics


This class holds the anchor and control point data for a single cubic Bézier curve, with anchor points (anchor0X, anchor0Y) and (anchor1X, anchor1Y) at either end and control points (control0X, control0Y) and (control1X, control1Y) determining the slope of the curve between the anchor points.

Summary

Public companion functions

Cubic
circularArc(
    centerX: Float,
    centerY: Float,
    x0: Float,
    y0: Float,
    x1: Float,
    y1: Float
)

Generates a bezier curve that approximates a circular arc, with p0 and p1 as the starting and ending anchor points.

Cmn
Cubic
straightLine(x0: Float, y0: Float, x1: Float, y1: Float)

Generates a bezier curve that is a straight line between the given anchor points.

Cmn

Public functions

operator Cubic
div(x: Float)

Operator overload to enable dividing Cubics by a scalar value x, like "c0 / x"

Cmn
operator Cubic
div(x: Int)

Operator overload to enable dividing Cubics by a scalar value x, like "c0 / x"

Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
operator Cubic
plus(o: Cubic)

Operator overload to enable adding Cubic objects together, like "c0 + c1"

Cmn
Cubic

Utility function to reverse the control/anchor points for this curve.

Cmn
Pair<CubicCubic>

Returns two Cubics, created by splitting this curve at the given distance of t between the original starting and ending anchor points.

Cmn
operator Cubic

Operator overload to enable multiplying Cubics by a scalar value x, like "c0 * x"

Cmn
operator Cubic
times(x: Int)

Operator overload to enable multiplying Cubics by an Int scalar value x, like "c0 * x"

Cmn
open String
Cmn
Cubic

Transforms the points in this Cubic with the given PointTransformer and returns a new Cubic

Cmn

Public properties

Float

The first anchor point x coordinate

Cmn
Float

The first anchor point y coordinate

Cmn
Float

The second anchor point x coordinate

Cmn
Float

The second anchor point y coordinate

Cmn
Float

The first control point x coordinate

Cmn
Float

The first control point y coordinate

Cmn
Float

The second control point x coordinate

Cmn
Float

The second control point y coordinate

Cmn

Public companion functions

circularArc

fun circularArc(
    centerX: Float,
    centerY: Float,
    x0: Float,
    y0: Float,
    x1: Float,
    y1: Float
): Cubic

Generates a bezier curve that approximates a circular arc, with p0 and p1 as the starting and ending anchor points. The curve generated is the smallest of the two possible arcs around the entire 360-degree circle. Arcs of greater than 180 degrees should use more than one arc together. Note that p0 and p1 should be equidistant from the center.

straightLine

fun straightLine(x0: Float, y0: Float, x1: Float, y1: Float): Cubic

Generates a bezier curve that is a straight line between the given anchor points. The control points lie 1/3 of the distance from their respective anchor points.

Public functions

div

operator fun div(x: Float): Cubic

Operator overload to enable dividing Cubics by a scalar value x, like "c0 / x"

div

operator fun div(x: Int): Cubic

Operator overload to enable dividing Cubics by a scalar value x, like "c0 / x"

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

plus

operator fun plus(o: Cubic): Cubic

Operator overload to enable adding Cubic objects together, like "c0 + c1"

reverse

fun reverse(): Cubic

Utility function to reverse the control/anchor points for this curve.

split

fun split(t: Float): Pair<CubicCubic>

Returns two Cubics, created by splitting this curve at the given distance of t between the original starting and ending anchor points.

times

operator fun times(x: Float): Cubic

Operator overload to enable multiplying Cubics by a scalar value x, like "c0 * x"

times

operator fun times(x: Int): Cubic

Operator overload to enable multiplying Cubics by an Int scalar value x, like "c0 * x"

toString

open fun toString(): String

transformed

fun transformed(f: PointTransformer): Cubic

Transforms the points in this Cubic with the given PointTransformer and returns a new Cubic

Parameters
f: PointTransformer

The PointTransformer used to transform this Cubic

Public properties

anchor0X

val anchor0XFloat

The first anchor point x coordinate

anchor0Y

val anchor0YFloat

The first anchor point y coordinate

anchor1X

val anchor1XFloat

The second anchor point x coordinate

anchor1Y

val anchor1YFloat

The second anchor point y coordinate

control0X

val control0XFloat

The first control point x coordinate

control0Y

val control0YFloat

The first control point y coordinate

control1X

val control1XFloat

The second control point x coordinate

control1Y

val control1YFloat

The second control point y coordinate