APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.math

public Class Bezier<T extends Vector<T>>

extends Object
implements Path<T extends Vector<T>>
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.math.Path
Imports
com.badlogic.gdx.utils.Array, .GdxRuntimeException

Implementation of the Bezier curve.
Author
Xoppa

Field Summary

Modifier and TypeField and Description
public Array<T>
private T
private T
private T

Constructor Summary

AccessConstructor and Description
public
public
Bezier(final T... points)

public
Bezier(final T[] points, final int offset, final int length)

public
Bezier(final Array<T> points, final int offset, final int length)

Method Summary

Modifier and TypeMethod and Description
public float
public float
public static <T extends Vector<T>> T

Returns:

The value specified by out for chaining
cubic
(final T
The Vector to set to the result.
out
,
final float
The location (ranging 0..1) on the curve.
t
,
final T
The first bezier point.
p0
,
final T
The second bezier point.
p1
,
final T
The third bezier point.
p2
,
final T
The fourth bezier point.
p3
,
final T
A temporary vector to be used by the calculation.
tmp
)

Cubic Bezier curve

public static <T extends Vector<T>> T

Returns:

The value specified by out for chaining
cubic_derivative
(final T
The Vector to set to the result.
out
,
final float
The location (ranging 0..1) on the curve.
t
,
final T
The first bezier point.
p0
,
final T
The second bezier point.
p1
,
final T
The third bezier point.
p2
,
final T
The fourth bezier point.
p3
,
final T
A temporary vector to be used by the calculation.
tmp
)

Cubic Bezier curve derivative

public T
derivativeAt(final T out, final float t)

Implements com.badlogic.gdx.math.Path.derivativeAt.

public static <T extends Vector<T>> T

Returns:

The value specified by out for chaining
linear
(final T
The Vector to set to the result.
out
,
final float
The location (ranging 0..1) on the line.
t
,
final T
The start point.
p0
,
final T
The end point.
p1
,
final T
A temporary vector to be used by the calculation.
tmp
)

Simple linear interpolation

public static <T extends Vector<T>> T

Returns:

The value specified by out for chaining
linear_derivative
(final T
The Vector to set to the result.
out
,
final float
The location (ranging 0..1) on the line.
t
,
final T
The start point.
p0
,
final T
The end point.
p1
,
final T
A temporary vector to be used by the calculation.
tmp
)

Simple linear interpolation derivative

public float
public static <T extends Vector<T>> T

Returns:

The value specified by out for chaining
quadratic
(final T
The Vector to set to the result.
out
,
final float
The location (ranging 0..1) on the curve.
t
,
final T
The first bezier point.
p0
,
final T
The second bezier point.
p1
,
final T
The third bezier point.
p2
,
final T
A temporary vector to be used by the calculation.
tmp
)

Quadratic Bezier curve

public static <T extends Vector<T>> T

Returns:

The value specified by out for chaining
quadratic_derivative
(final T
The Vector to set to the result.
out
,
final float
The location (ranging 0..1) on the curve.
t
,
final T
The first bezier point.
p0
,
final T
The second bezier point.
p1
,
final T
The third bezier point.
p2
,
final T
A temporary vector to be used by the calculation.
tmp
)

Quadratic Bezier curve derivative

public Bezier<T extends Vector<T>>
set(final T... points)

public Bezier<T extends Vector<T>>
set(final T[] points, final int offset, final int length)

public Bezier<T extends Vector<T>>
set(final Array<T> points, final int offset, final int length)

public T
valueAt(final T out, final float t)

Implements com.badlogic.gdx.math.Path.valueAt.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pointsback to summary
public Array<T> points
tmpback to summary
private T tmp
tmp2back to summary
private T tmp2
tmp3back to summary
private T tmp3

Constructor Detail

Bezierback to summary
public Bezier()
Bezierback to summary
public Bezier(final T... points)
Bezierback to summary
public Bezier(final T[] points, final int offset, final int length)
Bezierback to summary
public Bezier(final Array<T> points, final int offset, final int length)

Method Detail

approximateback to summary
public float approximate(final T v)

Implements com.badlogic.gdx.math.Path.approximate.

Annotations
@Override
approxLengthback to summary
public float approxLength(int samples)

Implements com.badlogic.gdx.math.Path.approxLength.

Annotations
@Override
cubicback to summary
public static <T extends Vector<T>> T cubic(final T out, final float t, final T p0, final T p1, final T p2, final T p3, final T tmp)

Cubic Bezier curve

Parameters
out:T

The Vector to set to the result.

t:float

The location (ranging 0..1) on the curve.

p0:T

The first bezier point.

p1:T

The second bezier point.

p2:T

The third bezier point.

p3:T

The fourth bezier point.

tmp:T

A temporary vector to be used by the calculation.

Returns:T

The value specified by out for chaining

cubic_derivativeback to summary
public static <T extends Vector<T>> T cubic_derivative(final T out, final float t, final T p0, final T p1, final T p2, final T p3, final T tmp)

Cubic Bezier curve derivative

Parameters
out:T

The Vector to set to the result.

t:float

The location (ranging 0..1) on the curve.

p0:T

The first bezier point.

p1:T

The second bezier point.

p2:T

The third bezier point.

p3:T

The fourth bezier point.

tmp:T

A temporary vector to be used by the calculation.

Returns:T

The value specified by out for chaining

derivativeAtback to summary
public T derivativeAt(final T out, final float t)

Implements com.badlogic.gdx.math.Path.derivativeAt.

Annotations
@Override
linearback to summary
public static <T extends Vector<T>> T linear(final T out, final float t, final T p0, final T p1, final T tmp)

Simple linear interpolation

Parameters
out:T

The Vector to set to the result.

t:float

The location (ranging 0..1) on the line.

p0:T

The start point.

p1:T

The end point.

tmp:T

A temporary vector to be used by the calculation.

Returns:T

The value specified by out for chaining

linear_derivativeback to summary
public static <T extends Vector<T>> T linear_derivative(final T out, final float t, final T p0, final T p1, final T tmp)

Simple linear interpolation derivative

Parameters
out:T

The Vector to set to the result.

t:float

The location (ranging 0..1) on the line.

p0:T

The start point.

p1:T

The end point.

tmp:T

A temporary vector to be used by the calculation.

Returns:T

The value specified by out for chaining

locateback to summary
public float locate(T v)

Implements com.badlogic.gdx.math.Path.locate.

Annotations
@Override
quadraticback to summary
public static <T extends Vector<T>> T quadratic(final T out, final float t, final T p0, final T p1, final T p2, final T tmp)

Quadratic Bezier curve

Parameters
out:T

The Vector to set to the result.

t:float

The location (ranging 0..1) on the curve.

p0:T

The first bezier point.

p1:T

The second bezier point.

p2:T

The third bezier point.

tmp:T

A temporary vector to be used by the calculation.

Returns:T

The value specified by out for chaining

quadratic_derivativeback to summary
public static <T extends Vector<T>> T quadratic_derivative(final T out, final float t, final T p0, final T p1, final T p2, final T tmp)

Quadratic Bezier curve derivative

Parameters
out:T

The Vector to set to the result.

t:float

The location (ranging 0..1) on the curve.

p0:T

The first bezier point.

p1:T

The second bezier point.

p2:T

The third bezier point.

tmp:T

A temporary vector to be used by the calculation.

Returns:T

The value specified by out for chaining

setback to summary
public Bezier<T extends Vector<T>> set(final T... points)
setback to summary
public Bezier<T extends Vector<T>> set(final T[] points, final int offset, final int length)
setback to summary
public Bezier<T extends Vector<T>> set(final Array<T> points, final int offset, final int length)
valueAtback to summary
public T valueAt(final T out, final float t)

Implements com.badlogic.gdx.math.Path.valueAt.

Annotations
@Override