Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
OpenSkyNet::Math::Path Class Reference

#include <MPath.h>

Public Member Functions

 Path ()
 
Utils::uint getNumPoints () const
 
std::vector< Math::Point<> > & getPoints ()
 
const std::vector< Math::Point<> > & getPoints () const
 
Utils::uint addAPoint (const Math::Point<> &aPoint_)
 
Utils::uint addAPoint (float x_, float y_, float z_)
 
Utils::uint appendPath (const Path &path_)
 
void clear ()
 
bool isPathChanged ()
 
void translate (const Math::Point<> &p_)
 
void calcNaturalCubicSpline (float minDistanceBetweenPoints_=1.0, Utils::uint maxTotalPoints_=0, float tension_=0.0f)
 
void calcDistances ()
 
float getTotalDist () const
 
float getAdditiveFromSpeed (float speed_) const
 
Path Interpolation

Returns an interpolated point along the path by a percentage of the number of stored points or the total distance. The two methods will return the same result if all stored points are equidistant from their neighbor.

Math::Point travelPercentOfPoints (const float &percent_) const
 
Math::Point travelPercentOfDist (const float &percent_) const
 

Detailed Description

A Path is a series of points that can be interpolated.

Constructor & Destructor Documentation

Path::Path ( )

Member Function Documentation

Utils::uint OpenSkyNet::Math::Path::addAPoint ( const Math::Point<> &  aPoint_)
inline
Utils::uint OpenSkyNet::Math::Path::addAPoint ( float  x_,
float  y_,
float  z_ 
)
inline
Utils::uint OpenSkyNet::Math::Path::appendPath ( const Path path_)
inline
void Path::calcDistances ( )

Calculates distances from point to point and the total distance.

void Path::calcNaturalCubicSpline ( float  minDistanceBetweenPoints_ = 1.0,
Utils::uint  maxTotalPoints_ = 0,
float  tension_ = 0.0f 
)

Creates a natural cubic spline from the path. The number of subdivisions is limited by the total number of points in the path and/or the points' density. One of the first two parameters can be zero, meaning that condition is not checked. This method is NOT safe for multiple simultaneous accesses because it uses static local variables. Precondition: There are at least two points in the path.

void OpenSkyNet::Math::Path::clear ( )
inline
float OpenSkyNet::Math::Path::getAdditiveFromSpeed ( float  speed_) const
inline

Returns the percent needed to interpolate per update interval. Put another way, it's the amount added to an Interpolator instance.

Parameters
speed_= distance step / time step (i.e. interpolator update interval)
Utils::uint OpenSkyNet::Math::Path::getNumPoints ( ) const
inline
std::vector<Math::Point<> >& OpenSkyNet::Math::Path::getPoints ( )
inline
const std::vector<Math::Point<> >& OpenSkyNet::Math::Path::getPoints ( ) const
inline
float OpenSkyNet::Math::Path::getTotalDist ( ) const
inline
bool OpenSkyNet::Math::Path::isPathChanged ( )
inline

Returns true if the path has changed since the last call to this method.

void OpenSkyNet::Math::Path::translate ( const Math::Point<> &  p_)
inline
Point Path::travelPercentOfDist ( const float &  percent_) const
Point Path::travelPercentOfPoints ( const float &  percent_) const

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