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
 
void evaluate_percent (index_type Idx, float u, Vector3 &c) const
 
void evaluate_derivative (index_type Idx, float u, Vector3 &c) const
 
index_type computeIndexInBounds (float t) const
 
void computeIndex (float t, index_type &out_idx, float &out_u) const
 
void init_spline (const Vector3 *controls, index_type count, EvaluationMode m, float orientation=0)
 
void init_cyclic_spline (const Vector3 *controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation=0)
 
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 ()
 
- Public Member Functions inherited from Movement::SplineBase
 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)
 
void init_cyclic_spline (const Vector3 *controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation)
 
template<class Init >
void init_spline_custom (Init &initializer)
 
void clear ()
 
float SegLength (index_type i) const
 
std::string ToString () const
 

Protected Member Functions

index_type computeIndexInBounds (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
 

Additional Inherited Members

- Protected Types inherited from Movement::SplineBase
enum  { STEPS_PER_SEGMENT = 3 }
 
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 139 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 143 of file Spline.h.

◆ LengthType

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

Definition at line 142 of file Spline.h.

Constructor & Destructor Documentation

◆ Spline()

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

Definition at line 151 of file Spline.h.

Member Function Documentation

◆ clear()

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

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() [1/2]

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.

◆ computeIndexInBounds() [2/2]

template<typename length_type >
SplineBase::index_type Movement::Spline< length_type >::computeIndexInBounds ( 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(), and TransportMgr::GeneratePath().

◆ evaluate_derivative() [2/2]

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

Caclulates derivation for 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 169 of file Spline.h.

References Movement::SplineBase::evaluate_derivative().

◆ 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::Spline< length_type >::evaluate_percent ( index_type  Idx,
float  u,
Vector3 &  c 
) const
inline

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

Parameters
t= partial_segment_length / whole_segment_length
Idx- spline segment index, should be in range [first, last).

Definition at line 164 of file Spline.h.

References Movement::SplineBase::evaluate_percent().

◆ init_cyclic_spline()

template<typename length_type >
void Movement::Spline< length_type >::init_cyclic_spline ( const Vector3 *  controls,
index_type  count,
EvaluationMode  m,
index_type  cyclic_point,
float  orientation = 0 
)
inline

Definition at line 177 of file Spline.h.

References Movement::SplineBase::init_cyclic_spline().

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

◆ init_spline()

template<typename length_type >
void Movement::Spline< length_type >::init_spline ( const Vector3 *  controls,
index_type  count,
EvaluationMode  m,
float  orientation = 0 
)
inline

Initializes spline. Don't call other methods while spline not initialized.

Definition at line 176 of file Spline.h.

References Movement::SplineBase::init_spline().

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

◆ 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 TransportMgr::GeneratePath(), and 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 184 of file Spline.h.

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

◆ length() [1/3]

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

◆ 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 210 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 211 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: