TrinityCore
Loading...
Searching...
No Matches
Movement::Spline< length_type > Class Template Reference

#include <Spline.h>

+ Inheritance diagram for Movement::Spline< length_type >:

Public Types

typedef length_type LengthType
 
typedef std::vector< length_type > LengthArray
 
- Public Types inherited from Movement::SplineBase
enum  EvaluationMode {
  ModeLinear , ModeCatmullrom , ModeBezier3_Unused , UninitializedMode ,
  ModesEnd
}
 
typedef int index_type
 
typedef std::vector< Vector3 > ControlArray
 

Public Member Functions

 Spline ()
 
void evaluate_percent (float t, Vector3 &c) const
 
void evaluate_derivative (float t, Vector3 &hermite) const
 
index_type computeIndexInBounds (float t) const
 
void computeIndex (float t, index_type &out_idx, float &out_u) const
 
void initLengths ()
 
template<class T >
void initLengths (T &cacher)
 
length_type length () const
 
length_type length (index_type first, index_type last) const
 
length_type length (index_type Idx) const
 
void set_length (index_type i, length_type length)
 
void clear () override
 
void evaluate_percent (index_type Idx, float u, Vector3 &c) const
 
void evaluate_derivative (index_type Idx, float u, Vector3 &hermite) const
 
- Public Member Functions inherited from Movement::SplineBase
 SplineBase ()
 
 SplineBase (SplineBase const &right)=delete
 
 SplineBase (SplineBase &&right)=delete
 
SplineBase & operator= (SplineBase const &right)=delete
 
SplineBase & operator= (SplineBase &&right)=delete
 
virtual ~SplineBase ()
 
void evaluate_percent (index_type Idx, float u, Vector3 &c) const
 
void evaluate_derivative (index_type Idx, float u, Vector3 &hermite) const
 
index_type first () const
 
index_type last () const
 
bool empty () const
 
EvaluationMode mode () const
 
bool isCyclic () const
 
ControlArray const & getPoints () const
 
index_type getPointCount () const
 
Vector3 const & getPoint (index_type i) const
 
void init_spline (const Vector3 *controls, index_type count, EvaluationMode m, float orientation=0.0f)
 
void init_cyclic_spline (const Vector3 *controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation=0.0f)
 
template<class Init >
void init_spline_custom (Init &&initializer)
 
float SegLength (index_type i) const
 
void set_steps_per_segment (index_type newStepsPerSegment)
 
std::string ToString () const
 

Protected Member Functions

index_type computeIndexInBoundsAtLength (length_type length) const
 
- Protected Member Functions inherited from Movement::SplineBase
void EvaluateLinear (index_type, float, Vector3 &) const
 
void EvaluateCatmullRom (index_type, float, Vector3 &) const
 
void EvaluateBezier3 (index_type, float, Vector3 &) const
 
void EvaluateDerivativeLinear (index_type, float, Vector3 &) const
 
void EvaluateDerivativeCatmullRom (index_type, float, Vector3 &) const
 
void EvaluateDerivativeBezier3 (index_type, float, Vector3 &) const
 
float SegLengthLinear (index_type) const
 
float SegLengthCatmullRom (index_type) const
 
float SegLengthBezier3 (index_type) const
 
void InitLinear (Vector3 const *, index_type, index_type)
 
void InitCatmullRom (Vector3 const *, index_type, index_type)
 
void InitBezier3 (Vector3 const *, index_type, index_type)
 
void UninitializedSplineEvaluationMethod (index_type, float, Vector3 &) const
 
float UninitializedSplineSegLenghtMethod (index_type) const
 
void UninitializedSplineInitMethod (Vector3 const *, index_type, index_type)
 

Protected Attributes

LengthArray lengths
 
- Protected Attributes inherited from Movement::SplineBase
ControlArray points
 
index_type index_lo
 
index_type index_hi
 
uint8 m_mode
 
bool cyclic
 
float initialOrientation
 
index_type stepsPerSegment = 3
 

Additional Inherited Members

- Protected Types inherited from Movement::SplineBase
typedef void(SplineBase::* EvaluationMethtod) (index_type, float, Vector3 &) const
 
typedef float(SplineBase::* SegLenghtMethtod) (index_type) const
 
typedef void(SplineBase::* InitMethtod) (Vector3 const *, index_type, index_type)
 
- Static Protected Attributes inherited from Movement::SplineBase
static EvaluationMethtod evaluators [ModesEnd]
 
static EvaluationMethtod derivative_evaluators [ModesEnd]
 
static SegLenghtMethtod seglengths [ModesEnd]
 
static InitMethtod initializers [ModesEnd]
 

Detailed Description

template<typename length_type>
class Movement::Spline< length_type >

Definition at line 144 of file Spline.h.

Member Typedef Documentation

◆ LengthArray

template<typename length_type >
typedef std::vector<length_type> Movement::Spline< length_type >::LengthArray

Definition at line 148 of file Spline.h.

◆ LengthType

template<typename length_type >
typedef length_type Movement::Spline< length_type >::LengthType

Definition at line 147 of file Spline.h.

Constructor & Destructor Documentation

◆ Spline()

template<typename length_type >
Movement::Spline< length_type >::Spline ( )
inlineexplicit

Definition at line 156 of file Spline.h.

Member Function Documentation

◆ clear()

template<typename length_type >
void Movement::Spline< length_type >::clear ( )
overridevirtual

Reimplemented from Movement::SplineBase.

Definition at line 90 of file SplineImpl.h.

References Movement::SplineBase::clear().

Referenced by Movement::MoveSpline::Initialize().

◆ computeIndex()

template<typename length_type >
void Movement::Spline< length_type >::computeIndex ( float  t,
index_type &  out_idx,
float &  out_u 
) const

Definition at line 63 of file SplineImpl.h.

References ASSERT.

◆ computeIndexInBounds()

template<typename length_type >
SplineBase::index_type Movement::Spline< length_type >::computeIndexInBounds ( float  t) const

Definition at line 72 of file SplineImpl.h.

References ASSERT.

◆ computeIndexInBoundsAtLength()

template<typename length_type >
SplineBase::index_type Movement::Spline< length_type >::computeIndexInBoundsAtLength ( length_type  length) const
protected

Definition at line 36 of file SplineImpl.h.

◆ evaluate_derivative() [1/2]

template<typename length_type >
void Movement::Spline< length_type >::evaluate_derivative ( float  t,
Vector3 &  hermite 
) const

Calculates derivation for given t

Parameters
t- percent of spline's length, assumes that t in range [0, 1].

Definition at line 28 of file SplineImpl.h.

Referenced by Movement::MoveSpline::computePosition().

◆ evaluate_derivative() [2/2]

template<typename length_type >
void Movement::SplineBase::evaluate_derivative ( index_type  Idx,
float  u,
Vector3 &  hermite 
) const
inline

Caclulates derivation in index Idx, and percent of segment length t

Parameters
Idx- spline segment index, should be in range [first, last)
t- percent of spline segment length, assumes that t in range [0, 1]

Definition at line 107 of file Spline.h.

◆ evaluate_percent() [1/2]

template<typename length_type >
void Movement::Spline< length_type >::evaluate_percent ( float  t,
Vector3 &  c 
) const

Calculates the position for given t

Parameters
t- percent of spline's length, assumes that t in range [0, 1].

Definition at line 20 of file SplineImpl.h.

Referenced by Movement::MoveSpline::computePosition().

◆ evaluate_percent() [2/2]

template<typename length_type >
void Movement::SplineBase::evaluate_percent ( index_type  Idx,
float  u,
Vector3 &  c 
) const
inline

Caclulates the position for given segment Idx, and percent of segment length t

Parameters
t- percent of segment length, assumes that t in range [0, 1]
Idx- spline segment index, should be in range [first, last)

Definition at line 101 of file Spline.h.

◆ initLengths() [1/2]

template<typename length_type >
void Movement::Spline< length_type >::initLengths ( )

Initializes lengths with SplineBase::SegLength method.

Definition at line 78 of file SplineImpl.h.

Referenced by Movement::MoveSpline::init_spline().

◆ initLengths() [2/2]

template<typename length_type >
template<class T >
void Movement::Spline< length_type >::initLengths ( T &  cacher)
inline

Initializes lengths in some custom way Note that value returned by cacher must be greater or equal to previous value.

Definition at line 180 of file Spline.h.

References ASSERT, Movement::SplineBase::index_hi, Movement::SplineBase::index_lo, and Movement::Spline< length_type >::lengths.

◆ length() [1/3]

◆ length() [2/3]

template<typename length_type >
length_type Movement::Spline< length_type >::length ( index_type  first,
index_type  last 
) const
inline

Returns length between given nodes.

Definition at line 206 of file Spline.h.

References Movement::SplineBase::first(), Movement::SplineBase::last(), and Movement::Spline< length_type >::lengths.

◆ length() [3/3]

template<typename length_type >
length_type Movement::Spline< length_type >::length ( index_type  Idx) const
inline

Definition at line 207 of file Spline.h.

References Movement::Spline< length_type >::lengths.

◆ set_length()

template<typename length_type >
void Movement::Spline< length_type >::set_length ( index_type  i,
length_type  length 
)
inline

Member Data Documentation

◆ lengths


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