NSMath::NSCurves::THermiteCubicSpline Struct Reference

THermiteCubicSpline class. More...

#include <HermiteCubicSpline.h>

Inheritance diagram for NSMath::NSCurves::THermiteCubicSpline:

Inheritance graph
[legend]
Collaboration diagram for NSMath::NSCurves::THermiteCubicSpline:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 THermiteCubicSpline (void)
 Creates initialized Hermite spline with no points.
 THermiteCubicSpline (const THermiteCubicSpline &orig)
 Copy constructor.
 ~THermiteCubicSpline (void)
 Destructor.
DWORD GetPointCount (void) const
 Returns number of points on spline.
float GetLength (void) const
 Returns "length" of spline.
const TVector3GetPoint (const DWORD &index) const
 Return point at specified index.
const TVector3GetTangent (const DWORD &index) const
 Return tangent vector for point at specified index.
const TVector3GetPointByTime (const float &t) const
 Return point which is nearest point to the point specified by parameter.
DWORD GetIndexByTime (const float &t) const
 Return index of point which is nearest point to the point specified by parameter.
const TVector3GetPointByUniformTime (const float &t) const
 Return point which is nearest point to the point specified by parameter.
DWORD GetIndexByUniformTime (const float &t) const
 Return index of point which is left-closest point to the point specified by parameter.
void Set (const THermiteCubicSpline &spline)
 Set another Hermite spline to this spline.
void AddPoint (const TVector3 &pt, const TVector3 &tangent)
 Add next point to this spline.
void MovePoint (const DWORD &index, const TVector3 &pt)
 This method moves with specified point at given index about specified vector.
void ChangeTangent (const DWORD &index, const TVector3 &tangent)
 Change tangent vector for specified point.
void Move (const TVector3 &vec)
 Move with entire spline about specified vector.
void Add (const TVector3 &vec)
 Add specified vector to each point of this spline.
void Sub (const TVector3 &vec)
 Substract specified vector from each point of this spline.
TVector3 GetValue (const float &t) const
 Get value of spline at given time value in denormalized format.
void GetValue (const float &t, TVector3 &res) const
 Get value of spline at given time value in denormalized format and result store in second operand.
TVector3 GetValueUniform (const float &t) const
 Get value of spline at given time value in normalized format.
void GetValueUniform (const float &t, TVector3 &res) const
 Get value of spline at given time value in normalized format and result store in second operand.
TVector3 GetFirstDerivateValue (const float &t) const
 Return first derivation at given denormalized time.
void GetFirstDerivateValue (const float &t, TVector3 &res) const
 Compute first derivation at given denormalized time and result store in second parameter.
TVector3 GetFirstDerivateValueUniform (const float &t) const
 Compute first derivation at given normalized time.
void GetFirstDerivateValueUniform (const float &t, TVector3 &res) const
 Compute first derivation at given normalized time and result store in second parameter.
TVector3 GetSecondDerivateValue (const float &t) const
 Compute second derivation at given denormalized time.
void GetSecondDerivateValue (const float &t, TVector3 &res) const
 Compute second derivation at given denormalized time and result store in second parameter.
TVector3 GetSecondDerivateValueUniform (const float &t) const
 Compute second derivation at given normalized time.
void GetSecondDerivateValueUniform (const float &t, TVector3 &res) const
 Compute second derivation at given normalized time and result store in second parameter.
BOOL Compare (const THermiteCubicSpline &spline) const
 Compare two Hermite cubic spline with default tolerance TVector3::DELTA_COMPARE.
BOOL Compare (const THermiteCubicSpline &spline, const float &delta) const
 Compare two Hermite cubic spline with given tolerance.
BOOL ComparePrecise (const THermiteCubicSpline &spline) const
 Compare two Hermite cubic spline very precisly.
THermiteCubicSplineoperator= (const THermiteCubicSpline &orig)
 Assignment operator.
BOOL operator== (const THermiteCubicSpline &spline) const
 Compare this spline with another spline with precision TVector3::DELTA_COMPARE.
TVector3operator[] (const DWORD &index)
 Returns point at specified index.
const TVector3operator[] (const DWORD &index) const
 Returns point at specified index.
THermiteCubicSplineoperator+= (const TVector3 &vec)
 Add specified vector to each point of this spline - this move spline to new position.
THermiteCubicSplineoperator-= (const TVector3 &vec)
 Substract specified vector from each point of this spline - this move spline to new position.

Detailed Description

THermiteCubicSpline class.

This class define simple spline with Hermite interpolation. Spline is constructed from simple Hermite cubics via adding points to spline.

For example spline contains points P0, P1, P2, P3 etc. then <P0,P1> is one segment, <P1,P2> second segment and so on. Thus segments share one point (and its tangent), this sharing ensure consquential points have identical tangent vectors.

Definition at line 45 of file HermiteCubicSpline.h.


Constructor & Destructor Documentation

THermiteCubicSpline::THermiteCubicSpline void   )  [inline]
 

Creates initialized Hermite spline with no points.

Definition at line 124 of file HermiteCubicSpline.h.

THermiteCubicSpline::THermiteCubicSpline const THermiteCubicSpline orig  )  [inline]
 

Copy constructor.

Parameters:
orig [in] original spline

Definition at line 132 of file HermiteCubicSpline.h.

THermiteCubicSpline::~THermiteCubicSpline void   )  [inline]
 

Destructor.

Definition at line 140 of file HermiteCubicSpline.h.


Member Function Documentation

void THermiteCubicSpline::Add const TVector3 vec  )  [inline]
 

Add specified vector to each point of this spline.

Result of operation is identical with THermiteCubicSpline::Move.

Parameters:
vec [in] vector to add

Definition at line 326 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Size().

Referenced by operator+=().

Here is the call graph for this function:

void THermiteCubicSpline::AddPoint const TVector3 pt,
const TVector3 tangent
[inline]
 

Add next point to this spline.

You must provide point and its tangent.

Parameters:
pt [in] new point in 3D added to spline
tangent [in] tangent vector for specified point

Definition at line 276 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::AddItem(), and NSMath::NSStdMath::tangent().

Here is the call graph for this function:

void THermiteCubicSpline::ChangeTangent const DWORD index,
const TVector3 tangent
[inline]
 

Change tangent vector for specified point.

Parameters:
index [in] index of point - must be in range
tangent [in] new tangent vector for point

Definition at line 300 of file HermiteCubicSpline.h.

References DBGASSERT, TArrayObjects< T, size, step >::Size(), and NSMath::NSStdMath::tangent().

Here is the call graph for this function:

BOOL THermiteCubicSpline::Compare const THermiteCubicSpline spline,
const float &  delta
const [inline]
 

Compare two Hermite cubic spline with given tolerance.

Both splines must have the same number of points and identical points and their tangent vectors.

Parameters:
spline [in] second spline to compare
delta [in] maximal allowed tolerance

Definition at line 625 of file HermiteCubicSpline.h.

References FALSE, and GetPointCount().

Here is the call graph for this function:

BOOL THermiteCubicSpline::Compare const THermiteCubicSpline spline  )  const [inline]
 

Compare two Hermite cubic spline with default tolerance TVector3::DELTA_COMPARE.

Both splines must have the same number of points and identical points and their tangent vectors.

Parameters:
spline [in] second spline to compare

Definition at line 591 of file HermiteCubicSpline.h.

References FALSE, and GetPointCount().

Referenced by operator==().

Here is the call graph for this function:

BOOL THermiteCubicSpline::ComparePrecise const THermiteCubicSpline spline  )  const [inline]
 

Compare two Hermite cubic spline very precisly.

Both splines must have the same number of points and identical points and their tangent vectors.

Parameters:
spline [in] second spline to compare

Definition at line 658 of file HermiteCubicSpline.h.

References FALSE, and GetPointCount().

Here is the call graph for this function:

void THermiteCubicSpline::GetFirstDerivateValue const float &  t,
TVector3 res
const [inline]
 

Compute first derivation at given denormalized time and result store in second parameter.

Parameters:
t [in] denormalized time in range <0,length>
res [in] parameter to store result

Definition at line 456 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), DBGASSERT, GetLength(), and TArrayObjects< T, size, step >::Size().

Here is the call graph for this function:

TVector3 THermiteCubicSpline::GetFirstDerivateValue const float &  t  )  const [inline]
 

Return first derivation at given denormalized time.

Parameters:
t [in] denormalized time in range <0, length>

Definition at line 442 of file HermiteCubicSpline.h.

Referenced by GetFirstDerivateValueUniform().

void THermiteCubicSpline::GetFirstDerivateValueUniform const float &  t,
TVector3 res
const [inline]
 

Compute first derivation at given normalized time and result store in second parameter.

Parameters:
t [in] normalized time in range <0,1>
res [in] parameter to store result

Definition at line 508 of file HermiteCubicSpline.h.

References GetFirstDerivateValue(), and GetLength().

Here is the call graph for this function:

TVector3 THermiteCubicSpline::GetFirstDerivateValueUniform const float &  t  )  const [inline]
 

Compute first derivation at given normalized time.

Parameters:
t [in] normalized time in range <0,1>

Definition at line 494 of file HermiteCubicSpline.h.

DWORD THermiteCubicSpline::GetIndexByTime const float &  t  )  const [inline]
 

Return index of point which is nearest point to the point specified by parameter.

From parameter T is determined interval between two points <Pa,Pb> and method always returns point Pa (first point).

Warning:
Spline must have at least two points!!!
Parameters:
t [in] "time "parameter - without normalization, thus in range <0,length>

Definition at line 212 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), DBGASSERT, NSRoutines::FloatClamp(), and GetLength().

Referenced by GetPointByTime().

Here is the call graph for this function:

DWORD THermiteCubicSpline::GetIndexByUniformTime const float &  t  )  const [inline]
 

Return index of point which is left-closest point to the point specified by parameter.

From parameter T (here is T normalized!!!) is determined interval between two points <Pa,Pb> and method always returns point Pa (first point).

Warning:
Spline must have at least two points!!!
Parameters:
t [in] normalized "time "parameter - in range <0,1>

Definition at line 246 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), DBGASSERT, NSRoutines::FloatClampNormalize(), and GetLength().

Referenced by GetPointByUniformTime().

Here is the call graph for this function:

float THermiteCubicSpline::GetLength void   )  const [inline]
 

Returns "length" of spline.

Length is determined as (number of points - 1).

Warning:
At least one point must be stored in spline!!!

Definition at line 158 of file HermiteCubicSpline.h.

References DBGASSERT, and TArrayObjects< T, size, step >::Size().

Referenced by GetFirstDerivateValue(), GetFirstDerivateValueUniform(), GetIndexByTime(), GetIndexByUniformTime(), GetSecondDerivateValue(), GetSecondDerivateValueUniform(), GetValue(), and GetValueUniform().

Here is the call graph for this function:

const TVector3 & THermiteCubicSpline::GetPoint const DWORD index  )  const [inline]
 

Return point at specified index.

Index must be in range!!!

Parameters:
index [in] zero-based index of item

Definition at line 170 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), and DBGASSERT.

Here is the call graph for this function:

const TVector3 & THermiteCubicSpline::GetPointByTime const float &  t  )  const [inline]
 

Return point which is nearest point to the point specified by parameter.

From parameter T is determined interval between two points <Pa,Pb> and method always returns point Pa (first point).

Warning:
Spline must have at least two points!!!
Parameters:
t [in] "time "parameter - without normalization, thus in range <0,length>

Definition at line 198 of file HermiteCubicSpline.h.

References GetIndexByTime().

Here is the call graph for this function:

const TVector3 & THermiteCubicSpline::GetPointByUniformTime const float &  t  )  const [inline]
 

Return point which is nearest point to the point specified by parameter.

From parameter T (here is normalized) is determined interval between two points <Pa,Pb> and method always returns point Pa (first point).

Warning:
Spline must have at least two points!!!
Parameters:
t [in] normalized "time "parameter - in range <0,length>

Definition at line 232 of file HermiteCubicSpline.h.

References GetIndexByUniformTime().

Here is the call graph for this function:

DWORD THermiteCubicSpline::GetPointCount void   )  const [inline]
 

Returns number of points on spline.

Definition at line 148 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count().

Referenced by Compare(), ComparePrecise(), and operator[]().

Here is the call graph for this function:

void THermiteCubicSpline::GetSecondDerivateValue const float &  t,
TVector3 res
const [inline]
 

Compute second derivation at given denormalized time and result store in second parameter.

Parameters:
t [in] denormalized time in range <0,length>
res [in] parameter to store result

Definition at line 531 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), DBGASSERT, GetLength(), and TArrayObjects< T, size, step >::Size().

Here is the call graph for this function:

TVector3 THermiteCubicSpline::GetSecondDerivateValue const float &  t  )  const [inline]
 

Compute second derivation at given denormalized time.

Parameters:
t [in] denormalized time in range <0,length>

Definition at line 517 of file HermiteCubicSpline.h.

Referenced by GetSecondDerivateValueUniform().

void THermiteCubicSpline::GetSecondDerivateValueUniform const float &  t,
TVector3 res
const [inline]
 

Compute second derivation at given normalized time and result store in second parameter.

Parameters:
t [in] normalized time in range <0,1>
res [in] parameter to store result

Definition at line 581 of file HermiteCubicSpline.h.

References GetLength(), and GetSecondDerivateValue().

Here is the call graph for this function:

TVector3 THermiteCubicSpline::GetSecondDerivateValueUniform const float &  t  )  const [inline]
 

Compute second derivation at given normalized time.

Parameters:
t [in] normalized time in range <0,1>

Definition at line 567 of file HermiteCubicSpline.h.

References GetSecondDerivateValue().

Here is the call graph for this function:

const TVector3 & THermiteCubicSpline::GetTangent const DWORD index  )  const [inline]
 

Return tangent vector for point at specified index.

Index must be in range!!!

Parameters:
index [in] zero-based index of item

Definition at line 182 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), and DBGASSERT.

Here is the call graph for this function:

void THermiteCubicSpline::GetValue const float &  t,
TVector3 res
const [inline]
 

Get value of spline at given time value in denormalized format and result store in second operand.

Warning:
At least two points must be inside spline!
Parameters:
t [in] denormalized time - must be in range <0,length>
res [in] vector to store result

Definition at line 374 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Count(), DBGASSERT, GetLength(), and TArrayObjects< T, size, step >::Size().

Here is the call graph for this function:

TVector3 THermiteCubicSpline::GetValue const float &  t  )  const [inline]
 

Get value of spline at given time value in denormalized format.

Warning:
At least two points must be inside spline!
Parameters:
t [in] denormalized time - must be in range <0,length>

Definition at line 356 of file HermiteCubicSpline.h.

Referenced by GetValueUniform().

void THermiteCubicSpline::GetValueUniform const float &  t,
TVector3 res
const [inline]
 

Get value of spline at given time value in normalized format and result store in second operand.

Warning:
At least two points must be inside spline!
Parameters:
t [in] normalize time - must be in range <0,1>
res [in] vector to store result

Definition at line 430 of file HermiteCubicSpline.h.

References DBGASSERT, GetLength(), and GetValue().

Here is the call graph for this function:

TVector3 THermiteCubicSpline::GetValueUniform const float &  t  )  const [inline]
 

Get value of spline at given time value in normalized format.

Warning:
At least two points must be inside spline!
Parameters:
t [in] normalize time - must be in range <0,1>

Definition at line 414 of file HermiteCubicSpline.h.

References DBGASSERT, GetLength(), and GetValue().

Here is the call graph for this function:

void THermiteCubicSpline::Move const TVector3 vec  )  [inline]
 

Move with entire spline about specified vector.

Parameters:
vec [in] vector specified offset

Definition at line 311 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Size().

Here is the call graph for this function:

void THermiteCubicSpline::MovePoint const DWORD index,
const TVector3 pt
[inline]
 

This method moves with specified point at given index about specified vector.

Parameters:
index [in] index of given point - must be in range!!!
pt [in] moving offset - this value is added to specified point

Definition at line 287 of file HermiteCubicSpline.h.

References DBGASSERT, and TArrayObjects< T, size, step >::Size().

Here is the call graph for this function:

THermiteCubicSpline & THermiteCubicSpline::operator+= const TVector3 vec  )  [inline]
 

Add specified vector to each point of this spline - this move spline to new position.

Parameters:
vec [in] vector with offset

Definition at line 732 of file HermiteCubicSpline.h.

References Add().

Here is the call graph for this function:

THermiteCubicSpline & THermiteCubicSpline::operator-= const TVector3 vec  )  [inline]
 

Substract specified vector from each point of this spline - this move spline to new position.

Parameters:
vec [in] vector with offset

Definition at line 743 of file HermiteCubicSpline.h.

References Sub().

Here is the call graph for this function:

THermiteCubicSpline & THermiteCubicSpline::operator= const THermiteCubicSpline orig  )  [inline]
 

Assignment operator.

Parameters:
orig [in] original spline

Definition at line 692 of file HermiteCubicSpline.h.

References Set().

Here is the call graph for this function:

BOOL THermiteCubicSpline::operator== const THermiteCubicSpline spline  )  const [inline]
 

Compare this spline with another spline with precision TVector3::DELTA_COMPARE.

Parameters:
spline [in] second spline to compare

Definition at line 701 of file HermiteCubicSpline.h.

References Compare().

Here is the call graph for this function:

const TVector3 & THermiteCubicSpline::operator[] const DWORD index  )  const [inline]
 

Returns point at specified index.

Parameters:
index [in] index of given point - must be in range

Definition at line 721 of file HermiteCubicSpline.h.

References DBGASSERT, and GetPointCount().

Here is the call graph for this function:

TVector3 & THermiteCubicSpline::operator[] const DWORD index  )  [inline]
 

Returns point at specified index.

Parameters:
index [in] index of given point - must be in range

Definition at line 710 of file HermiteCubicSpline.h.

References DBGASSERT, and GetPointCount().

Here is the call graph for this function:

void THermiteCubicSpline::Set const THermiteCubicSpline spline  )  [inline]
 

Set another Hermite spline to this spline.

Parameters:
spline [in] source spline

Definition at line 260 of file HermiteCubicSpline.h.

References m_points, m_tangents, and TArrayObjects< T, size, step >::Set().

Referenced by operator=().

Here is the call graph for this function:

void THermiteCubicSpline::Sub const TVector3 vec  )  [inline]
 

Substract specified vector from each point of this spline.

Parameters:
vec [in] vector to substract

Definition at line 340 of file HermiteCubicSpline.h.

References TArrayObjects< T, size, step >::Size().

Referenced by operator-=().

Here is the call graph for this function:


The documentation for this struct was generated from the following file:
Generated on Wed Nov 28 23:08:09 2007 for Joy4D by  doxygen 1.4.6-NO