Classes | |
| struct | Section |
Public Member Functions | |
| BezierCurve (void) | |
| ~BezierCurve (void) | |
| bool | IsClosedLoop (void) const |
| void | MakeLinesBySteps (std::vector< tbMath::Vector3 > &points, const size_t &stepsPerSection=25) const |
| void | GetPositionsByDistance (std::vector< tbMath::Vector3 > &points, const float maxLineLength, const size_t stepsPerSection) const |
| void | GetTangentsByDistance (std::vector< tbMath::Vector3 > &points, const float maxLineLength, const size_t stepsPerSection) const |
| void | GetInformationByDistance (std::vector< tbMath::Vector3 > &points, std::vector< tbMath::Vector3 > &tangents, std::vector< float > &tValues, const float maxLineLength, const size_t stepsPerSection) const |
| tbMath::Vector3 | GetClosestPoint (const tbMath::Vector3 &position, float &distance, const size_t &stepsPerSection=25) const |
| void | GetOriginalPoints (std::vector< tbMath::Vector3 > &points) const |
| void | GetTangents (std::vector< tbMath::Vector3 > &points, const size_t &stepsPerSection=25) const |
| float | CalculateLength (const size_t stepsPerSection=25) const |
| tbMath::Vector3 | GetPosition (float t) const |
| tbMath::Vector3 | GetTangent (float t) const |
| tbMath::Vector3 | GetPositionAt (float lengthFromStart, const size_t &stepsPerSection=25) const |
| size_t | NumberOfSections (void) const |
Static Public Member Functions | |
| static BezierCurve | FromCatMullRom (const std::vector< tbMath::Vector3 > &points, bool isLoop) |
| static BezierCurve | FromCatMullRomBeau (const std::vector< tbMath::Vector3 > &points, bool isLoop) |
Public Attributes | |
| std::vector< Section > | mSections |
| size_t | mEstimatedLengthSteps |
| float | mEstimatedLength |
| bool | mIsLoop |
|
explicit |
Constructs an empty curve object.
| TurtleBrains::Math::BezierCurve::~BezierCurve | ( | void | ) |
Cleans up any resources used by the BezierCurve.
| float TurtleBrains::Math::BezierCurve::CalculateLength | ( | const size_t | stepsPerSection = 25 | ) | const |
Estimates the length of the entire curve, the more steps the more accurate. This will cache the result of previous estimations and return the value. If stepsPerSection is larger than a previous result a new calculation will take place.
|
static |
Sets up a BezierCurve object from a set of points that lay along the curve using the catmullrom algorithm.
| points | Points that lay on the desired curve. Must contain at least 2 points for a not looping curve, or at least 5 for a loop. |
| isLoop | True if the curved path should use the last and first points to create a continuous loop. |
|
static |
Sets up a BezierCurve object from a set of points that lay along the curve using the catmullrom algorithm with a slightly different control points for at the start and end of the curve to reduce the kink in the spline.
| points | Points that lay on the desired curve. Must contain at least 2 points for a not looping curve, or at least 5 for a loop. |
| isLoop | True if the curved path should use the last and first points to create a continuous loop. |
| void TurtleBrains::Math::BezierCurve::GetPositionsByDistance | ( | std::vector< tbMath::Vector3 > & | points, |
| const float | maxLineLength, | ||
| const size_t | stepsPerSection | ||
| ) | const |
Takes a curve object and breaks it back into lines. This variant will make each line approximately the length specified by maxLineLength independent of the actual curve sections. Shorter line lenghts will increase accurracy whereas a longer line may skip over portions of the curve. Do not, the lineLength is not a guaranteed that the points given back will actually be that length!
|
inline |
Returns true if the curve completes a loop sharing the start and final point.
| void TurtleBrains::Math::BezierCurve::MakeLinesBySteps | ( | std::vector< tbMath::Vector3 > & | points, |
| const size_t & | stepsPerSection = 25 |
||
| ) | const |
Takes a curve object and breaks it back into lines. This variant will split each curve section into several small lines. If the curve section is shorter, the amount of lines will remain the same as a longer curve section. Obviously, the more steps per section, the more lines will be created, so carefully increase.