Cubic
public class Cubic
MutableCubic |
This is a Mutable version of |
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 methods |
|
|---|---|
static final @NonNull Cubic |
circularArc(Generates a bezier curve that approximates a circular arc, with p0 and p1 as the starting and ending anchor points. |
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 |
|
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 |
hashCode() |
final @NonNull Cubic |
Operator overload to enable adding Cubic objects together, like "c0 + c1" |
final @NonNull Cubic |
reverse()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 |
static final @NonNull Cubic |
straightLine(float x0, float y0, float x1, float y1)Generates a bezier curve that is a straight line between the given 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 |
toString() |
final @NonNull Cubic |
Transforms the points in this |
Public methods
circularArc
public static final @NonNull Cubic circularArc(
float centerX,
float centerY,
float x0,
float y0,
float x1,
float y1
)
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.
div
public final @NonNull Cubic div(float x)
Operator overload to enable dividing Cubics by a scalar value x, like "c0 / x"
div
public final @NonNull Cubic div(int x)
Operator overload to enable dividing Cubics by a scalar value x, like "c0 / x"
plus
public final @NonNull Cubic plus(@NonNull Cubic o)
Operator overload to enable adding Cubic objects together, like "c0 + c1"
reverse
public final @NonNull Cubic reverse()
Utility function to reverse the control/anchor points for this curve.
split
public 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.
straightLine
public static final @NonNull Cubic straightLine(float x0, float y0, float x1, float y1)
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.
times
public final @NonNull Cubic times(float x)
Operator overload to enable multiplying Cubics by a scalar value x, like "c0 * x"
times
public final @NonNull Cubic times(int x)
Operator overload to enable multiplying Cubics by an Int scalar value x, like "c0 * x"
transformed
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 |