Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzc_spline.h File Reference

Spline curves. More...

Functions

kzsError kzcSplineCreateEmpty (const struct KzcMemoryManager *memoryManager, struct KzcSpline **out_spline)
 Creates an empty spline with no data. More...
 
kzsError kzcSplineCreate (const struct KzcMemoryManager *memoryManager, kzUint dimension, kzUint degree, kzUint pointCount, kzFloat *controlPoints, kzBool loop, struct KzcSpline **out_spline)
 Creates an arbitrary spline with given control points. More...
 
kzsError kzcSplineCreateHermite (const struct KzcMemoryManager *memoryManager, kzUint dimension, kzUint pointCount, const kzFloat *const *points, const kzFloat *const *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points. More...
 
kzsError kzcSplineCreateHermiteVector2 (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector2 *points, const struct KzcVector2 *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points of 2-dimensional vectors. More...
 
kzsError kzcSplineCreateHermiteVector2Pointers (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector2 *const *points, const struct KzcVector2 *const *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points of 2-dimensional vector pointers. More...
 
kzsError kzcSplineCreateHermiteVector3 (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector3 *points, const struct KzcVector3 *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points of 3-dimensional vectors. More...
 
kzsError kzcSplineCreateHermiteVector3Pointers (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector3 *const *points, const struct KzcVector3 *const *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points of 3-dimensional vector pointers. More...
 
kzsError kzcSplineCreateHermiteVector4 (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector4 *points, const struct KzcVector4 *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points of 4-dimensional vectors. More...
 
kzsError kzcSplineCreateHermiteVector4Pointers (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector4 *const *points, const struct KzcVector4 *const *tangents, kzBool loop, struct KzcSpline **out_spline)
 Creates a Hermite spline with given control points of 4-dimensional vector pointers. More...
 
kzsError kzcSplineCreateCatmullRom (const struct KzcMemoryManager *memoryManager, kzUint dimension, kzUint pointCount, const kzFloat *const *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points. More...
 
kzsError kzcSplineCreateCatmullRomVector2 (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector2 *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points of 2-dimensional vectors. More...
 
kzsError kzcSplineCreateCatmullRomVector2Pointers (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector2 *const *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points of 2-dimensional vector pointers. More...
 
kzsError kzcSplineCreateCatmullRomVector3 (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector3 *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points of 3-dimensional vectors. More...
 
kzsError kzcSplineCreateCatmullRomVector3Pointers (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector3 *const *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points of 3-dimensional vector pointers. More...
 
kzsError kzcSplineCreateCatmullRomVector4 (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector4 *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points of 4-dimensional vectors. More...
 
kzsError kzcSplineCreateCatmullRomVector4Pointers (const struct KzcMemoryManager *memoryManager, kzUint pointCount, const struct KzcVector4 *const *points, kzBool loop, struct KzcSpline **out_spline)
 Creates a Catmull-Rom spline with given control points of 4-dimensional vector pointers. More...
 
kzsError kzcSplineDelete (struct KzcSpline *spline)
 Frees the memory allocated for spline. More...
 
kzsError kzcSplineLoadFromKZB (struct KzcSpline *spline, struct KzcInputStream *inputStream)
 Loads spline from KZB. More...
 
kzUint kzcSplineGetLength (const struct KzcSpline *spline)
 Returns the length of the spline. More...
 
kzUint kzcSplineGetDimension (const struct KzcSpline *spline)
 Returns the dimension of the spline. More...
 
void kzcSplineGetPoint (const struct KzcSpline *spline, kzFloat t, kzFloat *out_point)
 Evaluates the value of the spline in the given location t. More...
 
kzsError kzcSplineTrackerCreate (const struct KzcMemoryManager *memoryManager, const struct KzcSpline *spline, struct KzcSplineTracker **out_splineTracker)
 Creates a new spline tracker with the given spline curve. More...
 
kzsError kzcSplineTrackerDelete (struct KzcSplineTracker *splineTracker)
 Frees the memory allocated for spline tracker. More...
 
kzFloat kzcSplineTrackerGetT (const struct KzcSplineTracker *splineTracker)
 Returns the t location of the given spline tracker. More...
 
void kzcSplineTrackerMove (struct KzcSplineTracker *splineTracker, kzFloat deltaT)
 Moves given amount (forward or backwards) in the given spline tracker. More...
 
void kzcSplineTrackerGetPoint (const struct KzcSplineTracker *splineTracker, kzFloat *out_point)
 Evaluates the value of the spline tracker in the current location. More...
 

Detailed Description

Spline curves.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

kzsError kzcSplineCreateEmpty ( const struct KzcMemoryManager memoryManager,
struct KzcSpline **  out_spline 
)

Creates an empty spline with no data.

kzsError kzcSplineCreate ( const struct KzcMemoryManager memoryManager,
kzUint  dimension,
kzUint  degree,
kzUint  pointCount,
kzFloat controlPoints,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates an arbitrary spline with given control points.

Parameters
degreeDegree of the polynomial.
dimensionDimension of the point vectors, i.e. the number of components in the point array.
pointCountNumber of control points.
controlPointsControl points as polynomial coefficients, where the highest order coefficient is the first element. This is an array of polynomials, where each polynomial is an array of coefficients, where each coefficient is a vector. This 3-dimensional array is given as flattened to 1-dimensional: controlPoints[numPoints][degree][dimension] -> controlPoints[numPoints * degree * dimension].
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermite ( const struct KzcMemoryManager memoryManager,
kzUint  dimension,
kzUint  pointCount,
const kzFloat *const *  points,
const kzFloat *const *  tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points.

Hermite spline is a cubic spline where each control point is defined with position and tangent vector.

Parameters
dimensionDimension of the point vectors, i.e. the number of components in the point array.
pointCountNumber of control points.
pointsLocation vectors of control points as an array of arrays, where each inner array represents a vector.
tangentsTangent vectors of control points as an array of arrays, where each inner array represents a vector.
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermiteVector2 ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector2 points,
const struct KzcVector2 tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points of 2-dimensional vectors.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vectors.
tangentsTangent vectors of control points as array of vectors.
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermiteVector2Pointers ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector2 *const *  points,
const struct KzcVector2 *const *  tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points of 2-dimensional vector pointers.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vector pointers.
tangentsTangent vectors of control points as array of vector pointers.
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermiteVector3 ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector3 points,
const struct KzcVector3 tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points of 3-dimensional vectors.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vectors.
tangentsTangent vectors of control points as array of vectors.
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermiteVector3Pointers ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector3 *const *  points,
const struct KzcVector3 *const *  tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points of 3-dimensional vector pointers.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vector pointers.
tangentsTangent vectors of control points as array of vector pointers.
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermiteVector4 ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector4 points,
const struct KzcVector4 tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points of 4-dimensional vectors.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vectors.
tangentsTangent vectors of control points as array of vectors.
loopControls whether the spline is looping.
kzsError kzcSplineCreateHermiteVector4Pointers ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector4 *const *  points,
const struct KzcVector4 *const *  tangents,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Hermite spline with given control points of 4-dimensional vector pointers.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vector pointers.
tangentsTangent vectors of control points as array of vector pointers.
loopControls whether the spline is looping.
kzsError kzcSplineCreateCatmullRom ( const struct KzcMemoryManager memoryManager,
kzUint  dimension,
kzUint  pointCount,
const kzFloat *const *  points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points.

Catmull-Rom spline is a Hermite spline where tangents are calculated automatically as t_n = (p_n+1 - p_n-1) / 2. If looping is disabled, first and last tangents are calculated simply t_0 = p_1 - p_0 and t_N = p_N - p_N-1.

Parameters
dimensionDimension of the point vectors, i.e. the number of components in the point array.
pointCountNumber of control points.
pointsLocation vectors of control points as an array of arrays, where each inner array represents a vector.
loopControls whether the spline is looping as an array of arrays, where each inner array represents a vector.
kzsError kzcSplineCreateCatmullRomVector2 ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector2 points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points of 2-dimensional vectors.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vectors.
loopControls whether the spline is looping.
kzsError kzcSplineCreateCatmullRomVector2Pointers ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector2 *const *  points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points of 2-dimensional vector pointers.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vector pointers.
loopControls whether the spline is looping.
kzsError kzcSplineCreateCatmullRomVector3 ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector3 points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points of 3-dimensional vectors.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vectors.
loopControls whether the spline is looping.
kzsError kzcSplineCreateCatmullRomVector3Pointers ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector3 *const *  points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points of 3-dimensional vector pointers.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vector pointers.
loopControls whether the spline is looping.
kzsError kzcSplineCreateCatmullRomVector4 ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector4 points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points of 4-dimensional vectors.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vectors.
loopControls whether the spline is looping.
kzsError kzcSplineCreateCatmullRomVector4Pointers ( const struct KzcMemoryManager memoryManager,
kzUint  pointCount,
const struct KzcVector4 *const *  points,
kzBool  loop,
struct KzcSpline **  out_spline 
)

Creates a Catmull-Rom spline with given control points of 4-dimensional vector pointers.

Parameters
pointCountNumber of control points.
pointsLocation vectors of control points as array of vector pointers.
loopControls whether the spline is looping.
kzsError kzcSplineDelete ( struct KzcSpline spline)

Frees the memory allocated for spline.

kzsError kzcSplineLoadFromKZB ( struct KzcSpline spline,
struct KzcInputStream inputStream 
)

Loads spline from KZB.

kzUint kzcSplineGetLength ( const struct KzcSpline spline)

Returns the length of the spline.

This is the number of control points or possibly one less if looping is disabled. Each spline segment (part between two consecutive control points) has a length of one.

kzUint kzcSplineGetDimension ( const struct KzcSpline spline)

Returns the dimension of the spline.

This is the number of components in the point array.

void kzcSplineGetPoint ( const struct KzcSpline spline,
kzFloat  t,
kzFloat out_point 
)

Evaluates the value of the spline in the given location t.

Integer part of t defines the segment index and decimal part of t defines the location in that segment.

kzsError kzcSplineTrackerCreate ( const struct KzcMemoryManager memoryManager,
const struct KzcSpline spline,
struct KzcSplineTracker **  out_splineTracker 
)

Creates a new spline tracker with the given spline curve.

kzsError kzcSplineTrackerDelete ( struct KzcSplineTracker splineTracker)

Frees the memory allocated for spline tracker.

kzFloat kzcSplineTrackerGetT ( const struct KzcSplineTracker splineTracker)

Returns the t location of the given spline tracker.

void kzcSplineTrackerMove ( struct KzcSplineTracker splineTracker,
kzFloat  deltaT 
)

Moves given amount (forward or backwards) in the given spline tracker.

void kzcSplineTrackerGetPoint ( const struct KzcSplineTracker splineTracker,
kzFloat out_point 
)

Evaluates the value of the spline tracker in the current location.