Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Movement::Spline< length_type > Class Template Reference

#include <Spline.h>

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

Public Types

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

Public Member Functions

void clear ()
void computeIndex (float t, index_type &out_idx, float &out_u) const
index_type computeIndexInBounds (float t) const
void evaluate_derivative (float t, Vector3 &hermite) const
void evaluate_derivative (index_type Idx, float u, Vector3 &c) const
void evaluate_percent (float t, Vector3 &c) const
void evaluate_percent (index_type Idx, float u, Vector3 &c) const
void init_cyclic_spline (const Vector3 *controls, index_type count, EvaluationMode m, index_type cyclic_point)
void init_spline (const Vector3 *controls, index_type count, EvaluationMode m)
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)
 Spline ()
Public Member Functions inherited from Movement::SplineBase
void clear ()
bool empty () const
void evaluate_derivative (index_type Idx, float u, Vector3 &hermite) const
void evaluate_percent (index_type Idx, float u, Vector3 &c) const
index_type first () const
const Vector3 & getPoint (index_type i) const
index_type getPointCount () const
const ControlArraygetPoints () const
void init_cyclic_spline (const Vector3 *controls, index_type count, EvaluationMode m, index_type cyclic_point)
void init_spline (const Vector3 *controls, index_type count, EvaluationMode m)
template<class Init>
void init_spline (Init &initializer)
bool isCyclic () const
index_type last () const
EvaluationMode mode () const
float SegLength (index_type i) const
 SplineBase ()
std::string ToString () const

Protected Member Functions

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

Protected Attributes

LengthArray lengths
Protected Attributes inherited from Movement::SplineBase
bool cyclic
index_type index_hi
index_type index_lo
uint8 m_mode
ControlArray points

Additional Inherited Members

Protected Types inherited from Movement::SplineBase
enum  { STEPS_PER_SEGMENT = 3 }
typedef void(SplineBase::* EvaluationMethtod) (index_type, float, Vector3 &) const
typedef void(SplineBase::* InitMethtod) (const Vector3 *, index_type, bool, index_type)
typedef float(SplineBase::* SegLenghtMethtod) (index_type) const
Static Protected Attributes inherited from Movement::SplineBase
static EvaluationMethtod derivative_evaluators [ModesEnd]
static EvaluationMethtod evaluators [ModesEnd]
static InitMethtod initializers [ModesEnd]
static SegLenghtMethtod seglengths [ModesEnd]

Detailed Description

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

Definition at line 121 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 125 of file Spline.h.

◆ LengthType

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

Definition at line 124 of file Spline.h.

Constructor & Destructor Documentation

◆ Spline()

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

Definition at line 132 of file Spline.h.

Member Function Documentation

◆ clear()

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

Definition at line 78 of file SplineImpl.h.

References Movement::SplineBase::clear(), and lengths.

◆ computeIndex()

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

◆ computeIndexInBounds() [1/2]

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

Definition at line 60 of file SplineImpl.h.

References ASSERT, computeIndexInBounds(), and length().

◆ computeIndexInBounds() [2/2]

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

◆ 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 16 of file SplineImpl.h.

References computeIndex(), and evaluate_derivative().

Referenced by evaluate_derivative().

◆ 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 150 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 8 of file SplineImpl.h.

References computeIndex(), and evaluate_percent().

Referenced by evaluate_percent().

◆ 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 145 of file Spline.h.

◆ 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 )
inline

Definition at line 158 of file Spline.h.

Referenced by TransportMgr::GeneratePath().

◆ init_spline()

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

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

Definition at line 157 of file Spline.h.

Referenced by TransportMgr::GeneratePath().

◆ initLengths() [1/2]

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

◆ 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 165 of file Spline.h.

◆ length() [1/3]

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

Returns length of the whole spline.

Definition at line 184 of file Spline.h.

Referenced by computeIndex(), computeIndexInBounds(), TransportMgr::GeneratePath(), and initLengths().

◆ 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 186 of file Spline.h.

◆ length() [3/3]

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

Definition at line 187 of file Spline.h.

◆ set_length()

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

Definition at line 189 of file Spline.h.

Member Data Documentation

◆ lengths

template<typename length_type>
LengthArray Movement::Spline< length_type >::lengths
protected

Definition at line 128 of file Spline.h.

Referenced by clear(), computeIndexInBounds(), and initLengths().


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