TrinityCore
Movement::SplineBase Class Reference

#include <Spline.h>

+ Inheritance diagram for Movement::SplineBase:

Public Types

enum  EvaluationMode {
  ModeLinear , ModeCatmullrom , ModeBezier3_Unused , UninitializedMode ,
  ModesEnd
}
 
typedef int index_type
 
typedef std::vector< Vector3 > ControlArray
 

Public Member Functions

 SplineBase ()
 
 SplineBase (SplineBase const &right)=delete
 
 SplineBase (SplineBase &&right)=delete
 
SplineBaseoperator= (SplineBase const &right)=delete
 
SplineBaseoperator= (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)
 
virtual void clear ()
 
float SegLength (index_type i) const
 
void set_steps_per_segment (index_type newStepsPerSegment)
 
std::string ToString () const
 

Protected Types

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)
 

Protected Member Functions

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

ControlArray points
 
index_type index_lo
 
index_type index_hi
 
uint8 m_mode
 
bool cyclic
 
float initialOrientation
 
index_type stepsPerSegment = 3
 

Static Protected Attributes

static EvaluationMethtod evaluators [ModesEnd]
 
static EvaluationMethtod derivative_evaluators [ModesEnd]
 
static SegLenghtMethtod seglengths [ModesEnd]
 
static InitMethtod initializers [ModesEnd]
 

Detailed Description

Definition at line 29 of file Spline.h.

Member Typedef Documentation

◆ ControlArray

typedef std::vector<Vector3> Movement::SplineBase::ControlArray

Definition at line 33 of file Spline.h.

◆ EvaluationMethtod

typedef void(SplineBase::* Movement::SplineBase::EvaluationMethtod) (index_type, float, Vector3 &) const
protected

Definition at line 64 of file Spline.h.

◆ index_type

Definition at line 32 of file Spline.h.

◆ InitMethtod

typedef void(SplineBase::* Movement::SplineBase::InitMethtod) (Vector3 const *, index_type, index_type)
protected

Definition at line 81 of file Spline.h.

◆ SegLenghtMethtod

typedef float(SplineBase::* Movement::SplineBase::SegLenghtMethtod) (index_type) const
protected

Definition at line 75 of file Spline.h.

Member Enumeration Documentation

◆ EvaluationMode

Enumerator
ModeLinear 
ModeCatmullrom 
ModeBezier3_Unused 
UninitializedMode 
ModesEnd 

Definition at line 35 of file Spline.h.

Constructor & Destructor Documentation

◆ SplineBase() [1/3]

Movement::SplineBase::SplineBase ( )
explicit

Definition at line 285 of file Spline.cpp.

◆ SplineBase() [2/3]

Movement::SplineBase::SplineBase ( SplineBase const &  right)
delete

◆ SplineBase() [3/3]

Movement::SplineBase::SplineBase ( SplineBase &&  right)
delete

◆ ~SplineBase()

Movement::SplineBase::~SplineBase ( )
virtualdefault

Member Function Documentation

◆ clear()

void Movement::SplineBase::clear ( )
virtual

Reimplemented in Movement::Spline< length_type >, and Movement::Spline< int32 >.

Definition at line 291 of file Spline.cpp.

+ Here is the caller graph for this function:

◆ empty()

bool Movement::SplineBase::empty ( ) const
inline

Definition at line 113 of file Spline.h.

+ Here is the caller graph for this function:

◆ evaluate_derivative()

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()

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.

◆ EvaluateBezier3()

void Movement::SplineBase::EvaluateBezier3 ( index_type  index,
float  t,
Vector3 &  result 
) const
protected

Definition at line 126 of file Spline.cpp.

+ Here is the call graph for this function:

◆ EvaluateCatmullRom()

void Movement::SplineBase::EvaluateCatmullRom ( index_type  index,
float  t,
Vector3 &  result 
) const
protected

Definition at line 120 of file Spline.cpp.

+ Here is the call graph for this function:

◆ EvaluateDerivativeBezier3()

void Movement::SplineBase::EvaluateDerivativeBezier3 ( index_type  index,
float  t,
Vector3 &  result 
) const
protected

Definition at line 145 of file Spline.cpp.

+ Here is the call graph for this function:

◆ EvaluateDerivativeCatmullRom()

void Movement::SplineBase::EvaluateDerivativeCatmullRom ( index_type  index,
float  t,
Vector3 &  result 
) const
protected

Definition at line 139 of file Spline.cpp.

+ Here is the call graph for this function:

◆ EvaluateDerivativeLinear()

void Movement::SplineBase::EvaluateDerivativeLinear ( index_type  index,
float  ,
Vector3 &  result 
) const
protected

Definition at line 133 of file Spline.cpp.

◆ EvaluateLinear()

void Movement::SplineBase::EvaluateLinear ( index_type  index,
float  u,
Vector3 &  result 
) const
protected

Definition at line 114 of file Spline.cpp.

◆ first()

index_type Movement::SplineBase::first ( ) const
inline

Bounds for spline indexes. All indexes should be in range [first, last).

Definition at line 110 of file Spline.h.

+ Here is the caller graph for this function:

◆ getPoint()

Vector3 const & Movement::SplineBase::getPoint ( index_type  i) const
inline

Definition at line 119 of file Spline.h.

+ Here is the caller graph for this function:

◆ getPointCount()

index_type Movement::SplineBase::getPointCount ( ) const
inline

Definition at line 118 of file Spline.h.

+ Here is the caller graph for this function:

◆ getPoints()

ControlArray const & Movement::SplineBase::getPoints ( ) const
inline

Definition at line 117 of file Spline.h.

+ Here is the caller graph for this function:

◆ init_cyclic_spline()

void Movement::SplineBase::init_cyclic_spline ( const Vector3 *  controls,
index_type  count,
EvaluationMode  m,
index_type  cyclic_point,
float  orientation = 0.0f 
)

Definition at line 210 of file Spline.cpp.

+ Here is the caller graph for this function:

◆ init_spline()

void Movement::SplineBase::init_spline ( const Vector3 *  controls,
index_type  count,
EvaluationMode  m,
float  orientation = 0.0f 
)

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

Definition at line 201 of file Spline.cpp.

+ Here is the caller graph for this function:

◆ init_spline_custom()

template<class Init >
void Movement::SplineBase::init_spline_custom ( Init &  initializer)
inline

As i can see there are a lot of ways how spline can be initialized would be no harm to have some custom initializers.

Definition at line 128 of file Spline.h.

◆ InitBezier3()

void Movement::SplineBase::InitBezier3 ( Vector3 const *  controls,
index_type  count,
index_type   
)
protected

Definition at line 272 of file Spline.cpp.

◆ InitCatmullRom()

void Movement::SplineBase::InitCatmullRom ( Vector3 const *  controls,
index_type  count,
index_type  cyclic_point 
)
protected

Definition at line 239 of file Spline.cpp.

◆ InitLinear()

void Movement::SplineBase::InitLinear ( Vector3 const *  controls,
index_type  count,
index_type  cyclic_point 
)
protected

Definition at line 219 of file Spline.cpp.

◆ isCyclic()

bool Movement::SplineBase::isCyclic ( ) const
inline

Definition at line 115 of file Spline.h.

+ Here is the caller graph for this function:

◆ last()

index_type Movement::SplineBase::last ( ) const
inline

Definition at line 111 of file Spline.h.

+ Here is the caller graph for this function:

◆ mode()

EvaluationMode Movement::SplineBase::mode ( ) const
inline

Definition at line 114 of file Spline.h.

+ Here is the caller graph for this function:

◆ operator=() [1/2]

SplineBase & Movement::SplineBase::operator= ( SplineBase &&  right)
delete

◆ operator=() [2/2]

SplineBase & Movement::SplineBase::operator= ( SplineBase const &  right)
delete

◆ SegLength()

float Movement::SplineBase::SegLength ( index_type  i) const
inline

Calculates distance between [i; i+1] points, assumes that index i is in bounds.

Definition at line 136 of file Spline.h.

+ Here is the caller graph for this function:

◆ SegLengthBezier3()

float Movement::SplineBase::SegLengthBezier3 ( index_type  index) const
protected

Definition at line 178 of file Spline.cpp.

+ Here is the call graph for this function:

◆ SegLengthCatmullRom()

float Movement::SplineBase::SegLengthCatmullRom ( index_type  index) const
protected

Definition at line 158 of file Spline.cpp.

+ Here is the call graph for this function:

◆ SegLengthLinear()

float Movement::SplineBase::SegLengthLinear ( index_type  index) const
protected

Definition at line 152 of file Spline.cpp.

◆ set_steps_per_segment()

void Movement::SplineBase::set_steps_per_segment ( index_type  newStepsPerSegment)
inline

Definition at line 138 of file Spline.h.

◆ ToString()

std::string Movement::SplineBase::ToString ( ) const

Definition at line 298 of file Spline.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UninitializedSplineEvaluationMethod()

void Movement::SplineBase::UninitializedSplineEvaluationMethod ( index_type  ,
float  ,
Vector3 &   
) const
inlineprotected

Definition at line 84 of file Spline.h.

◆ UninitializedSplineInitMethod()

void Movement::SplineBase::UninitializedSplineInitMethod ( Vector3 const *  ,
index_type  ,
index_type   
)
inlineprotected

Definition at line 86 of file Spline.h.

◆ UninitializedSplineSegLenghtMethod()

float Movement::SplineBase::UninitializedSplineSegLenghtMethod ( index_type  ) const
inlineprotected

Definition at line 85 of file Spline.h.

Member Data Documentation

◆ cyclic

bool Movement::SplineBase::cyclic
protected

Definition at line 51 of file Spline.h.

◆ derivative_evaluators

SplineBase::EvaluationMethtod Movement::SplineBase::derivative_evaluators
staticprotected
Initial value:
=
{
}
void EvaluateDerivativeCatmullRom(index_type, float, Vector3 &) const
Definition: Spline.cpp:139
void EvaluateDerivativeBezier3(index_type, float, Vector3 &) const
Definition: Spline.cpp:145
void EvaluateDerivativeLinear(index_type, float, Vector3 &) const
Definition: Spline.cpp:133
void UninitializedSplineEvaluationMethod(index_type, float, Vector3 &) const
Definition: Spline.h:84

Definition at line 70 of file Spline.h.

◆ evaluators

SplineBase::EvaluationMethtod Movement::SplineBase::evaluators
staticprotected
Initial value:
=
{
}
void EvaluateCatmullRom(index_type, float, Vector3 &) const
Definition: Spline.cpp:120
void EvaluateBezier3(index_type, float, Vector3 &) const
Definition: Spline.cpp:126
void EvaluateLinear(index_type, float, Vector3 &) const
Definition: Spline.cpp:114

Definition at line 65 of file Spline.h.

◆ index_hi

index_type Movement::SplineBase::index_hi
protected

Definition at line 48 of file Spline.h.

◆ index_lo

index_type Movement::SplineBase::index_lo
protected

Definition at line 47 of file Spline.h.

◆ initializers

SplineBase::InitMethtod Movement::SplineBase::initializers
staticprotected
Initial value:
=
{
}
void UninitializedSplineInitMethod(Vector3 const *, index_type, index_type)
Definition: Spline.h:86
void InitBezier3(Vector3 const *, index_type, index_type)
Definition: Spline.cpp:272
void InitCatmullRom(Vector3 const *, index_type, index_type)
Definition: Spline.cpp:239

Definition at line 82 of file Spline.h.

◆ initialOrientation

float Movement::SplineBase::initialOrientation
protected

Definition at line 52 of file Spline.h.

◆ m_mode

uint8 Movement::SplineBase::m_mode
protected

Definition at line 50 of file Spline.h.

◆ points

ControlArray Movement::SplineBase::points
protected

Definition at line 45 of file Spline.h.

◆ seglengths

SplineBase::SegLenghtMethtod Movement::SplineBase::seglengths
staticprotected
Initial value:
=
{
}
float SegLengthLinear(index_type) const
Definition: Spline.cpp:152
float SegLengthBezier3(index_type) const
Definition: Spline.cpp:178
float UninitializedSplineSegLenghtMethod(index_type) const
Definition: Spline.h:85
float SegLengthCatmullRom(index_type) const
Definition: Spline.cpp:158

Definition at line 76 of file Spline.h.

◆ stepsPerSegment

index_type Movement::SplineBase::stepsPerSegment = 3
protected

Definition at line 58 of file Spline.h.


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