SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
The SLCurveBezier class implements a Bezier curve interpolation. More...
#include <SLCurveBezier.h>
Public Member Functions | |
SLCurveBezier (const SLVVec4f &points) | |
SLCurveBezier (const SLVVec4f &points, const SLVVec3f &controlPoints) | |
~SLCurveBezier () | |
void | dispose () |
Deletes all curve arrays. More... | |
void | init (const SLVVec4f &points, const SLVVec3f &controlPoints) |
void | draw (const SLMat4f &wm) |
SLVec3f | evaluate (const SLfloat t) |
SLVec3f | velocity (SLfloat t) |
SLVec3f | acceleration (SLfloat t) |
SLfloat | segmentArcLength (SLuint i, SLfloat u1, SLfloat u2) |
SLfloat | subdivideLength (const SLVec3f &P0, const SLVec3f &P1, const SLVec3f &P2, const SLVec3f &P3) |
void | subdivideRender (SLVVec3f &points, const SLMat4f &wm, SLfloat epsilon, const SLVec3f &P0, const SLVec3f &P1, const SLVec3f &P2, const SLVec3f &P3) |
SLfloat | arcLength (SLfloat t1, SLfloat t2) |
SLfloat | findParamByDist (SLfloat t1, SLfloat s) |
SLint | numControlPoints () |
SLVVec3f & | controls () |
Public Member Functions inherited from SLCurve | |
SLCurve () | |
virtual | ~SLCurve () |
Protected Attributes | |
SLVVec3f | _controls |
Control points of Bezier curve. More... | |
SLGLVertexArrayExt | _vao |
Vertex array object for rendering. More... | |
Protected Attributes inherited from SLCurve | |
SLVVec4f | _points |
Sample points (x,y,z) and time (w) of curve. More... | |
SLVfloat | _lengths |
Length of each curve segment. More... | |
SLfloat | _totalLength |
Total length of curve. More... | |
The SLCurveBezier class implements a Bezier curve interpolation.
The SLCurveBezier class implements a Bezier curve interpolation. The math is originally based on the implementation from the book: "Essential Mathematics for Games and Interactive Applications" from James M. Van Verth and Lars M. Bishop.
Definition at line 24 of file SLCurveBezier.h.
SLCurveBezier::SLCurveBezier | ( | const SLVVec4f & | points | ) |
Definition at line 15 of file SLCurveBezier.cpp.
Definition at line 22 of file SLCurveBezier.cpp.
SLCurveBezier::~SLCurveBezier | ( | ) |
Definition at line 30 of file SLCurveBezier.cpp.
SLCurveBezier::curveAcceleration determines the acceleration vector on the curve at time t. It is the second derivative at point t.
Definition at line 290 of file SLCurveBezier.cpp.
Calculate length of curve between parameters t1 and t2
Definition at line 352 of file SLCurveBezier.cpp.
|
inline |
Definition at line 56 of file SLCurveBezier.h.
|
virtual |
SLCurveBezier::draw does the rendering of the Bezier curve in world space.
Implements SLCurve.
Definition at line 106 of file SLCurveBezier.cpp.
SLCurveBezier::curveEvaluate determines the position on the curve at time t.
Implements SLCurve.
Definition at line 213 of file SLCurveBezier.cpp.
SLCurveBezier::findParamByDist gets parameter s distance in arc length from Q(t1). Returns max SLfloat if can't find it.
Definition at line 325 of file SLCurveBezier.cpp.
Init curve with curve points and times. If no control points are passed they will be calculated automatically
points | Array of points on the Bezier curve (w = time) |
controlPoints | Array of control points with size = 2*(numPointsAndTimes-1) |
Definition at line 41 of file SLCurveBezier.cpp.
|
inline |
Definition at line 55 of file SLCurveBezier.h.
SLCurveBezier::segmentArcLength calculate length of curve segment between parameters u1 and u2 by recursively subdividing the segment.
Definition at line 395 of file SLCurveBezier.cpp.
SLfloat SLCurveBezier::subdivideLength | ( | const SLVec3f & | P0, |
const SLVec3f & | P1, | ||
const SLVec3f & | P2, | ||
const SLVec3f & | P3 | ||
) |
SLCurveBezier::subdivideLength calculates length of Bezier curve by recursive midpoint subdivision.
Definition at line 432 of file SLCurveBezier.cpp.
void SLCurveBezier::subdivideRender | ( | SLVVec3f & | renderPoints, |
const SLMat4f & | wm, | ||
SLfloat | epsilon, | ||
const SLVec3f & | P0, | ||
const SLVec3f & | P1, | ||
const SLVec3f & | P2, | ||
const SLVec3f & | P3 | ||
) |
SLCurveBezier::subdivideRender adds points along the curve to the point vector renderPoints by recursively subdividing the curve with the Casteljau scheme.
Definition at line 461 of file SLCurveBezier.cpp.
SLCurveBezier::curveVelocity determines the velocity vector on the curve at point t. The velocity vector direction is the tangent vector at t an is the first derivative at point t. The velocity vector magnitude is the speed at point t.
Definition at line 252 of file SLCurveBezier.cpp.
|
protected |
Control points of Bezier curve.
Definition at line 59 of file SLCurveBezier.h.
|
protected |
Vertex array object for rendering.
Definition at line 60 of file SLCurveBezier.h.