ezEngine Release 26.3
Loading...
Searching...
No Matches
ezSpline Struct Reference

Describes a spline consisting of cubic Bezier curves segments. Each control point defines the position, rotation, and scale at that point. The parameter fT to evaluate the spline is a combination of the control point index and the zero to one parameter in the fractional part to interpolate within that segment. More...

#include <Spline.h>

Classes

struct  ControlPoint
 

Public Member Functions

ezResult Serialize (ezStreamWriter &ref_writer) const
 
ezResult Deserialize (ezStreamReader &ref_reader)
 
ezUInt32 GetNumControlPoints () const
 
ezUInt32 GetNumSegments () const
 
void CalculateUpDirAndAutoTangents (const ezSimdVec4f &vGlobalUpDir=ezSimdVec4f(0, 0, 1), const ezSimdVec4f &vGlobalForwardDir=ezSimdVec4f(1, 0, 0))
 Calculates tangents for all control points with a tangent mode other than 'Custom'.
 
ezSimdVec4f EvaluatePosition (float fT) const
 Returns the position of the spline at the given parameter fT.
 
ezSimdVec4f EvaluatePosition (ezUInt32 uiCp0, const ezSimdFloat &fT) const
 
ezSimdVec4f EvaluateDerivative (float fT) const
 Returns the derivative, aka the tangent of the spline at the given parameter fT. This also equals to the unnormalized forward direction.
 
ezSimdVec4f EvaluateDerivative (ezUInt32 uiCp0, const ezSimdFloat &fT) const
 
ezSimdVec4f EvaluateUpDirection (float fT) const
 Returns the up direction of the spline at the given parameter fT.
 
ezSimdVec4f EvaluateScale (float fT) const
 Returns the scale of the spline at the given parameter fT.
 
ezSimdTransform EvaluateTransform (float fT) const
 Returns the full transform (consisting of position, scale, and orientation) of the spline at the given parameter fT.
 
ezResult CalculateSegmentBounds (ezUInt32 uiSegmentIndex, ezSimdBBoxSphere &out_bounds) const
 Calculates the bounding volume of a single segment of the spline.
 
ezResult CalculateBounds (ezSimdBBoxSphere &out_bounds) const
 Calculates the bounding volume of the entire spline.
 
ezSimdVec4f FindClosestPointOnSegment (ezUInt32 uiSegmentIndex, const ezSimdVec4f &vPoint, float &out_fT, float &out_fDistanceSquared, float fMaxError=0.1f) const
 Finds the closest point on a single segment of the spline to the given point. Returns the position on the spline, the parameter fT, and the squared distance.
 
ezSimdVec4f FindClosestPoint (const ezSimdVec4f &vPoint, float &out_fT, float &out_fDistanceSquared, float fMaxError=0.1f) const
 Finds the closest point on the entire spline to the given point. Returns the position on the spline, the parameter fT, and the squared distance.
 

Public Attributes

ezDynamicArray< ControlPoint, ezAlignedAllocatorWrapperm_ControlPoints
 
bool m_bClosed = false
 
ezUInt32 m_uiChangeCounter = 0
 

Detailed Description

Describes a spline consisting of cubic Bezier curves segments. Each control point defines the position, rotation, and scale at that point. The parameter fT to evaluate the spline is a combination of the control point index and the zero to one parameter in the fractional part to interpolate within that segment.


The documentation for this struct was generated from the following files: