public class Cubic

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

Nested types

public static class Cubic.Companion

Public methods

final @NonNull Cubic
div(float x)

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

final @NonNull Cubic
div(int x)

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

boolean
equals(Object other)
final float

The first anchor point x coordinate

final float

The first anchor point y coordinate

final float

The second anchor point x coordinate

final float

The second anchor point y coordinate

final float

The first control point x coordinate

final float

The first control point y coordinate

final float

The second control point x coordinate

final float

The second control point y coordinate

int
final @NonNull Cubic

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

final @NonNull Cubic

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

final @NonNull Pair<@NonNull Cubic, @NonNull Cubic>
split(float t)

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

final @NonNull Cubic
times(float x)

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

final @NonNull Cubic
times(int x)

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

@NonNull String
final @NonNull Cubic

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

Public methods

div

Added in 1.0.0-alpha05
public final @NonNull Cubic div(float x)

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

div

Added in 1.0.0-alpha05
public final @NonNull Cubic div(int x)

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

equals

public boolean equals(Object other)

getAnchor0X

Added in 1.0.0-alpha05
public final float getAnchor0X()

The first anchor point x coordinate

getAnchor0Y

Added in 1.0.0-alpha05
public final float getAnchor0Y()

The first anchor point y coordinate

getAnchor1X

Added in 1.0.0-alpha05
public final float getAnchor1X()

The second anchor point x coordinate

getAnchor1Y

Added in 1.0.0-alpha05
public final float getAnchor1Y()

The second anchor point y coordinate

getControl0X

Added in 1.0.0-alpha05
public final float getControl0X()

The first control point x coordinate

getControl0Y

Added in 1.0.0-alpha05
public final float getControl0Y()

The first control point y coordinate

getControl1X

Added in 1.0.0-alpha05
public final float getControl1X()

The second control point x coordinate

getControl1Y

Added in 1.0.0-alpha05
public final float getControl1Y()

The second control point y coordinate

hashCode

public int hashCode()

plus

Added in 1.0.0-alpha05
public final @NonNull Cubic plus(@NonNull Cubic o)

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

reverse

Added in 1.0.0-alpha05
public final @NonNull Cubic reverse()

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

split

Added in 1.0.0-alpha05
public final @NonNull Pair<@NonNull Cubic, @NonNull Cubicsplit(float t)

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

times

Added in 1.0.0-alpha05
public final @NonNull Cubic times(float x)

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

times

Added in 1.0.0-alpha05
public final @NonNull Cubic times(int x)

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

toString

public @NonNull String toString()

transformed

Added in 1.0.0-alpha05
public final @NonNull Cubic transformed(@NonNull PointTransformer f)

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

Parameters
@NonNull PointTransformer f

The PointTransformer used to transform this Cubic