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

public Class CatmullRomSpline<T extends Vector<T>>

extends Object
implements Path<T extends Vector<T>>
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.math.Path

Author
Xoppa

Field Summary

Modifier and TypeField and Description
public boolean
public T[]
public int
private T
private T
private T

Constructor Summary

AccessConstructor and Description
public
public
CatmullRomSpline(final T[] controlPoints, final boolean continuous)

Method Summary

Modifier and TypeMethod and Description
public float
public float
approximate(final T in, int start, final int count)

public float
approximate(final T in, final int near)

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

Returns:

The value of out
calculate
(final T
The Vector to set to the result.
out
,
final float
The position (0<=t<=1) on the spline
t
,
final T[]
The control points
points
,
final boolean
If true the b-spline restarts at 0 when reaching 1
continuous
,
final T
A temporary vector used for the calculation
tmp
)

Calculates the catmullrom value for the given position (t).

public static <T extends Vector<T>> T

Returns:

The value of out
calculate
(final T
The Vector to set to the result.
out
,
final int
The span (0<=ii, final float
The position (0<=u<=1) on the span
u
,
final T[]
The control points
points
,
final boolean
If true the b-spline restarts at 0 when reaching 1
continuous
,
final T
A temporary vector used for the calculation
tmp
)

Calculates the catmullrom value for the given span (i) at the given position (u).

public static <T extends Vector<T>> T

Returns:

The value of out
derivative
(final T
The Vector to set to the result.
out
,
final float
The position (0<=t<=1) on the spline
t
,
final T[]
The control points
points
,
final boolean
If true the b-spline restarts at 0 when reaching 1
continuous
,
final T
A temporary vector used for the calculation
tmp
)

Calculates the derivative of the catmullrom spline for the given position (t).

public static <T extends Vector<T>> T

Returns:

The value of out
derivative
(final T
The Vector to set to the result.
out
,
final int
The span (0<=ii, final float
The position (0<=u<=1) on the span
u
,
final T[]
The control points
points
,
final boolean
If true the b-spline restarts at 0 when reaching 1
continuous
,
final T
A temporary vector used for the calculation
tmp
)

Calculates the derivative of the catmullrom spline for the given span (i) at the given position (u).

public T
public T
derivativeAt(final T out, final int span, final float u)

Returns: The derivative of the spline at position u of the specified span

public float
public int
nearest(final T in)

Returns: The span closest to the specified value

public int
nearest(final T in, int start, final int count)

Returns: The span closest to the specified value, restricting to the specified spans.

public CatmullRomSpline<T extends Vector<T>>
set(final T[] controlPoints, final boolean continuous)

public T
valueAt(T out, float t)

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

public T
valueAt(final T out, final int span, final float u)

Returns: The value of the spline at position u of the specified span

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

continuousback to summary
public boolean continuous
controlPointsback to summary
public T[] controlPoints
spanCountback to summary
public int spanCount
tmpback to summary
private T tmp
tmp2back to summary
private T tmp2
tmp3back to summary
private T tmp3

Constructor Detail

CatmullRomSplineback to summary
public CatmullRomSpline()
CatmullRomSplineback to summary
public CatmullRomSpline(final T[] controlPoints, final boolean continuous)

Method Detail

approximateback to summary
public float approximate(T v)

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

Annotations
@Override
approximateback to summary
public float approximate(final T in, int start, final int count)
approximateback to summary
public float approximate(final T in, final int near)
approxLengthback to summary
public float approxLength(int samples)

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

Annotations
@Override
calculateback to summary
public static <T extends Vector<T>> T calculate(final T out, final float t, final T[] points, final boolean continuous, final T tmp)

Calculates the catmullrom value for the given position (t).

Parameters
out:T

The Vector to set to the result.

t:float

The position (0<=t<=1) on the spline

points:T[]

The control points

continuous:boolean

If true the b-spline restarts at 0 when reaching 1

tmp:T

A temporary vector used for the calculation

Returns:T

The value of out

calculateback to summary
public static <T extends Vector<T>> T calculate(final T out, final int i, final float u, final T[] points, final boolean continuous, final T tmp)

Calculates the catmullrom value for the given span (i) at the given position (u).

Parameters
out:T

The Vector to set to the result.

i:int

The span (0<=iu:float

The position (0<=u<=1) on the span

points:T[]

The control points

continuous:boolean

If true the b-spline restarts at 0 when reaching 1

tmp:T

A temporary vector used for the calculation

Returns:T

The value of out

derivativeback to summary
public static <T extends Vector<T>> T derivative(final T out, final float t, final T[] points, final boolean continuous, final T tmp)

Calculates the derivative of the catmullrom spline for the given position (t).

Parameters
out:T

The Vector to set to the result.

t:float

The position (0<=t<=1) on the spline

points:T[]

The control points

continuous:boolean

If true the b-spline restarts at 0 when reaching 1

tmp:T

A temporary vector used for the calculation

Returns:T

The value of out

derivativeback to summary
public static <T extends Vector<T>> T derivative(final T out, final int i, final float u, final T[] points, final boolean continuous, final T tmp)

Calculates the derivative of the catmullrom spline for the given span (i) at the given position (u).

Parameters
out:T

The Vector to set to the result.

i:int

The span (0<=iu:float

The position (0<=u<=1) on the span

points:T[]

The control points

continuous:boolean

If true the b-spline restarts at 0 when reaching 1

tmp:T

A temporary vector used for the calculation

Returns:T

The value of out

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

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

Annotations
@Override
derivativeAtback to summary
public T derivativeAt(final T out, final int span, final float u)
Returns:T

The derivative of the spline at position u of the specified span

locateback to summary
public float locate(T v)

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

Annotations
@Override
nearestback to summary
public int nearest(final T in)
Returns:int

The span closest to the specified value

nearestback to summary
public int nearest(final T in, int start, final int count)
Returns:int

The span closest to the specified value, restricting to the specified spans.

setback to summary
public CatmullRomSpline<T extends Vector<T>> set(final T[] controlPoints, final boolean continuous)
valueAtback to summary
public T valueAt(T out, float t)

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

Annotations
@Override
valueAtback to summary
public T valueAt(final T out, final int span, final float u)
Returns:T

The value of the spline at position u of the specified span