Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Movement::SplineBase Class Reference

#include <Spline.h>

Inheritance diagram for Movement::SplineBase:

Public Types

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

Public Member Functions

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 Types

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

Protected Member Functions

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

bool cyclic
index_type index_hi
index_type index_lo
uint8 m_mode
ControlArray points

Static Protected Attributes

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

Detailed Description

Definition at line 15 of file Spline.h.

Member Typedef Documentation

◆ ControlArray

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

Definition at line 19 of file Spline.h.

◆ EvaluationMethtod

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

Definition at line 52 of file Spline.h.

◆ index_type

Definition at line 18 of file Spline.h.

◆ InitMethtod

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

Definition at line 69 of file Spline.h.

◆ SegLenghtMethtod

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

Definition at line 63 of file Spline.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
STEPS_PER_SEGMENT 

Definition at line 39 of file Spline.h.

◆ EvaluationMode

Enumerator
ModeLinear 
ModeCatmullrom 
ModeBezier3_Unused 
UninitializedMode 
ModesEnd 

Definition at line 21 of file Spline.h.

Constructor & Destructor Documentation

◆ SplineBase()

Movement::SplineBase::SplineBase ( )
inlineexplicit

Definition at line 75 of file Spline.h.

References cyclic, index_hi, index_lo, m_mode, and UninitializedMode.

Member Function Documentation

◆ clear()

void Movement::SplineBase::clear ( )

Definition at line 271 of file Spline.cpp.

References index_hi, index_lo, and points.

Referenced by Movement::Spline< length_type >::clear().

◆ empty()

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

Definition at line 93 of file Spline.h.

References index_hi, and index_lo.

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

References m_mode.

Referenced by Movement::Spline< double >::evaluate_derivative().

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

References m_mode.

Referenced by Movement::Spline< double >::evaluate_percent().

◆ EvaluateBezier3()

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

◆ EvaluateCatmullRom()

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

◆ EvaluateDerivativeBezier3()

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

◆ EvaluateDerivativeCatmullRom()

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

◆ EvaluateDerivativeLinear()

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

Definition at line 121 of file Spline.cpp.

References ASSERT, index_hi, index_lo, and points.

◆ EvaluateLinear()

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

Definition at line 102 of file Spline.cpp.

References ASSERT, index_hi, index_lo, and points.

◆ first()

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

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

Definition at line 90 of file Spline.h.

References index_lo.

Referenced by Movement::Spline< double >::length(), and Movement::PacketBuilder::WriteMonsterMove().

◆ getPoint()

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

◆ getPointCount()

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

◆ getPoints()

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

Definition at line 97 of file Spline.h.

References points.

◆ init_cyclic_spline()

void Movement::SplineBase::init_cyclic_spline ( const Vector3 * controls,
index_type count,
EvaluationMode m,
index_type cyclic_point )

Definition at line 197 of file Spline.cpp.

References cyclic, initializers, and m_mode.

Referenced by Movement::Spline< double >::init_cyclic_spline().

◆ init_spline() [1/2]

void Movement::SplineBase::init_spline ( const Vector3 * controls,
index_type count,
EvaluationMode m )

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

Definition at line 189 of file Spline.cpp.

References cyclic, initializers, and m_mode.

Referenced by Movement::Spline< double >::init_spline().

◆ init_spline() [2/2]

template<class Init>
void Movement::SplineBase::init_spline ( 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 107 of file Spline.h.

References cyclic, index_hi, index_lo, m_mode, and points.

◆ InitBezier3()

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

Definition at line 258 of file Spline.cpp.

References index_hi, index_lo, and points.

◆ InitCatmullRom()

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

Definition at line 225 of file Spline.cpp.

References cyclic, index_hi, index_lo, and points.

◆ InitLinear()

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

Definition at line 205 of file Spline.cpp.

References ASSERT, cyclic, index_hi, index_lo, and points.

◆ isCyclic()

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

Definition at line 95 of file Spline.h.

References cyclic.

◆ last()

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

Definition at line 91 of file Spline.h.

References index_hi.

Referenced by TransportMgr::GeneratePath(), and Movement::Spline< double >::length().

◆ mode()

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

Definition at line 94 of file Spline.h.

References m_mode.

Referenced by ToString(), and Movement::PacketBuilder::WriteCreateBits().

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

References m_mode.

Referenced by Movement::Spline< length_type >::initLengths(), and Movement::CommonInitializer::operator()().

◆ SegLengthBezier3()

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

◆ SegLengthCatmullRom()

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

◆ SegLengthLinear()

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

Definition at line 140 of file Spline.cpp.

References ASSERT, index_hi, index_lo, and points.

◆ ToString()

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

Definition at line 278 of file Spline.cpp.

References mode(), ModesEnd, and points.

◆ UninitializedSpline()

void Movement::SplineBase::UninitializedSpline ( ) const
inlineprotected

Definition at line 72 of file Spline.h.

References ASSERT.

Member Data Documentation

◆ cyclic

bool Movement::SplineBase::cyclic
protected

◆ derivative_evaluators

SplineBase::EvaluationMethtod Movement::SplineBase::derivative_evaluators
staticprotected
Initial value:
=
{
}
void UninitializedSpline() const
Definition Spline.h:72
void EvaluateDerivativeCatmullRom(index_type, float, Vector3 &) const
Definition Spline.cpp:127
void EvaluateDerivativeBezier3(index_type, float, Vector3 &) const
Definition Spline.cpp:133
void EvaluateDerivativeLinear(index_type, float, Vector3 &) const
Definition Spline.cpp:121
void(SplineBase::* EvaluationMethtod)(index_type, float, Vector3 &) const
Definition Spline.h:52

Definition at line 58 of file Spline.h.

◆ evaluators

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

Definition at line 53 of file Spline.h.

◆ index_hi

◆ index_lo

◆ initializers

SplineBase::InitMethtod Movement::SplineBase::initializers
staticprotected
Initial value:
=
{
}
void(SplineBase::* InitMethtod)(const Vector3 *, index_type, bool, index_type)
Definition Spline.h:69
void InitBezier3(const Vector3 *, index_type, bool, index_type)
Definition Spline.cpp:258
void InitCatmullRom(const Vector3 *, index_type, bool, index_type)
Definition Spline.cpp:225

Definition at line 70 of file Spline.h.

Referenced by init_cyclic_spline(), and init_spline().

◆ m_mode

uint8 Movement::SplineBase::m_mode
protected

◆ points

◆ seglengths

SplineBase::SegLenghtMethtod Movement::SplineBase::seglengths
staticprotected
Initial value:
=
{
}
float SegLengthLinear(index_type) const
Definition Spline.cpp:140
float SegLengthBezier3(index_type) const
Definition Spline.cpp:166
float SegLengthCatmullRom(index_type) const
Definition Spline.cpp:146
float(SplineBase::* SegLenghtMethtod)(index_type) const
Definition Spline.h:63

Definition at line 64 of file Spline.h.


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