Ogre Procedural  0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
Public Member Functions | List of all members
Procedural::Path Class Reference

#include <ProceduralPath.h>

Public Member Functions

 Path ()
 Default constructor. More...
 
PathaddPoint (const Ogre::Vector3 &pt)
 Adds a point to the path, as a Vector3. More...
 
PathaddPoint (Ogre::Real x, Ogre::Real y, Ogre::Real z)
 Adds a point to the path, using its 3 coordinates. More...
 
PathinsertPoint (size_t index, Ogre::Real x, Ogre::Real y, Ogre::Real z)
 Inserts a point to the path. More...
 
PathinsertPoint (size_t index, const Ogre::Vector3 &pt)
 Inserts a point to the path. More...
 
PathappendPath (const Path &other)
 Appends another path at the end of this one. More...
 
PathappendPathRel (const Path &other)
 Appends another path at the end of this one, relative to the last point of this path. More...
 
Pathreset ()
 Clears the content of the Path. More...
 
Pathclose ()
 Define the path as being closed. More...
 
bool isClosed () const
 Tells if the path is closed or not. More...
 
const std::vector< Ogre::Vector3 > & getPoints () const
 Gets the list of points as a vector of Vector3. More...
 
std::vector< Ogre::Vector3 > & getPointsReference ()
 Gets raw vector data of this path as a non-const reference. More...
 
const Ogre::Vector3getPoint (int i) const
 Safely gets a given point. More...
 
int getSegCount () const
 Gets the number of segments in the path Takes into accound whether path is closed or not. More...
 
Ogre::Vector3 getDirectionAfter (unsigned int i) const
 Returns local direction after the current point. More...
 
Ogre::Vector3 getDirectionBefore (unsigned int i) const
 Returns local direction after the current point. More...
 
Ogre::Vector3 getAvgDirection (unsigned int i) const
 Returns the local direction at the current point. More...
 
Ogre::Real getTotalLength () const
 Returns the total lineic length of that shape. More...
 
Ogre::Real getLengthAtPoint (size_t index) const
 
Ogre::Vector3 getPosition (unsigned int i, Ogre::Real coord) const
 Gets a position on the shape with index of the point and a percentage of position on the segment. More...
 
Ogre::Vector3 getPosition (Ogre::Real coord) const
 Gets a position on the shape from lineic coordinate. More...
 
Ogre::MeshPtr realizeMesh (const std::string &name="") const
 Outputs a mesh representing the path. More...
 
Path mergeKeysWithTrack (const Track &track) const
 Creates a path with the keys of this path and extra keys coming from a track. More...
 
Pathtranslate (const Ogre::Vector3 &translation)
 Applies the given translation to all the points already defined. More...
 
Pathtranslate (Ogre::Real translationX, Ogre::Real translationY, Ogre::Real translationZ)
 Applies the given translation to all the points already defined. More...
 
Pathscale (Ogre::Real amount)
 Applies the given scale to all the points already defined. More...
 
Pathscale (Ogre::Real scaleX, Ogre::Real scaleY, Ogre::Real scaleZ)
 Applies the given scale to all the points already defined. More...
 
Pathscale (const Ogre::Vector3 &amount)
 Applies the given scale to all the points already defined. More...
 
Pathreflect (const Ogre::Vector3 &normal)
 Reflect all points in this path against a zero-origined plane with a given normal. More...
 
Path extractSubPath (unsigned int first, unsigned int last)
 Extracts a part of the shape as a new path. More...
 
Pathreverse ()
 Reverses direction of the path. More...
 
void buildFromSegmentSoup (const std::vector< Segment3D > &segList, std::vector< Path > &out)
 
Shape convertToShape () const
 Converts the path to a shape, with Y=0. More...
 

Detailed Description

Succession of points in 3D space. Can be closed or not.

Constructor & Destructor Documentation

◆ Path()

Procedural::Path::Path ( )

Default constructor.

Member Function Documentation

◆ addPoint() [1/2]

Path& Procedural::Path::addPoint ( const Ogre::Vector3 pt)

Adds a point to the path, as a Vector3.

Referenced by extractSubPath(), and Procedural::LinePath::realizePath().

◆ addPoint() [2/2]

Path& Procedural::Path::addPoint ( Ogre::Real  x,
Ogre::Real  y,
Ogre::Real  z 
)

Adds a point to the path, using its 3 coordinates.

◆ appendPath()

Path& Procedural::Path::appendPath ( const Path other)

Appends another path at the end of this one.

◆ appendPathRel()

Path& Procedural::Path::appendPathRel ( const Path other)

Appends another path at the end of this one, relative to the last point of this path.

◆ buildFromSegmentSoup()

void Procedural::Path::buildFromSegmentSoup ( const std::vector< Segment3D > &  segList,
std::vector< Path > &  out 
)

◆ close()

Path& Procedural::Path::close ( )

Define the path as being closed.

Almost the same as adding a last point on the first point position

Exceptions
Ogre::InvalidStateExceptionCannot close an empty path

References Ogre::Exception::ERR_INVALID_STATE, and OGRE_EXCEPT.

Referenced by extractSubPath().

◆ convertToShape()

Shape Procedural::Path::convertToShape ( ) const

Converts the path to a shape, with Y=0.

◆ extractSubPath()

Path Procedural::Path::extractSubPath ( unsigned int  first,
unsigned int  last 
)

Extracts a part of the shape as a new path.

Parameters
firstfirst index to be in the new path
lastlast index to be in the new path

References addPoint(), and close().

◆ getAvgDirection()

Ogre::Vector3 Procedural::Path::getAvgDirection ( unsigned int  i) const

Returns the local direction at the current point.

Parameters
iindex of the point

References Vector< 3, Real >::normalisedCopy().

◆ getDirectionAfter()

Ogre::Vector3 Procedural::Path::getDirectionAfter ( unsigned int  i) const

Returns local direction after the current point.

References Vector< 3, Real >::normalisedCopy().

◆ getDirectionBefore()

Ogre::Vector3 Procedural::Path::getDirectionBefore ( unsigned int  i) const

Returns local direction after the current point.

References Vector< 3, Real >::normalisedCopy().

◆ getLengthAtPoint()

Ogre::Real Procedural::Path::getLengthAtPoint ( size_t  index) const

◆ getPoint()

const Ogre::Vector3& Procedural::Path::getPoint ( int  i) const

Safely gets a given point.

Takes into account whether the path is closed or not.

Parameters
ithe index of the point. if it is <0 or >maxPoint, cycle through the list of points

References Procedural::Utils::cap(), and Procedural::Utils::modulo().

◆ getPoints()

const std::vector<Ogre::Vector3>& Procedural::Path::getPoints ( ) const

Gets the list of points as a vector of Vector3.

◆ getPointsReference()

std::vector<Ogre::Vector3>& Procedural::Path::getPointsReference ( )

Gets raw vector data of this path as a non-const reference.

◆ getPosition() [1/2]

Ogre::Vector3 Procedural::Path::getPosition ( Ogre::Real  coord) const

Gets a position on the shape from lineic coordinate.

Parameters
coordlineic coordinate
Exceptions
Ogre::InvalidStateExceptionThe path must at least contain 2 points

◆ getPosition() [2/2]

Ogre::Vector3 Procedural::Path::getPosition ( unsigned int  i,
Ogre::Real  coord 
) const

Gets a position on the shape with index of the point and a percentage of position on the segment.

Parameters
iindex of the segment
coorda number between 0 and 1 meaning the percentage of position on the segment
Exceptions
Ogre::InvalidParametersExceptioni is out of bounds
Ogre::InvalidParametersExceptioncoord must be comprised between 0 and 1

References Ogre::Exception::ERR_INVALIDPARAMS, and OGRE_EXCEPT.

◆ getSegCount()

int Procedural::Path::getSegCount ( ) const

Gets the number of segments in the path Takes into accound whether path is closed or not.

Referenced by Procedural::MultiPath::getNoIntersectionParts().

◆ getTotalLength()

Ogre::Real Procedural::Path::getTotalLength ( ) const

Returns the total lineic length of that shape.

◆ insertPoint() [1/2]

Path& Procedural::Path::insertPoint ( size_t  index,
const Ogre::Vector3 pt 
)

Inserts a point to the path.

Parameters
indexthe index before the inserted point
ptnew point's position

◆ insertPoint() [2/2]

Path& Procedural::Path::insertPoint ( size_t  index,
Ogre::Real  x,
Ogre::Real  y,
Ogre::Real  z 
)

Inserts a point to the path.

Parameters
indexthe index before the inserted point
xnew point's x coordinate
ynew point's y coordinate
znew point's z coordinate

◆ isClosed()

bool Procedural::Path::isClosed ( ) const

Tells if the path is closed or not.

◆ mergeKeysWithTrack()

Path Procedural::Path::mergeKeysWithTrack ( const Track track) const

Creates a path with the keys of this path and extra keys coming from a track.

◆ realizeMesh()

Ogre::MeshPtr Procedural::Path::realizeMesh ( const std::string &  name = "") const

Outputs a mesh representing the path.

Mostly for debugging purposes

◆ reflect()

Path& Procedural::Path::reflect ( const Ogre::Vector3 normal)

Reflect all points in this path against a zero-origined plane with a given normal.

Parameters
normalthe normal

References reflect().

Referenced by reflect().

◆ reset()

Path& Procedural::Path::reset ( )

Clears the content of the Path.

◆ reverse()

Path& Procedural::Path::reverse ( )

Reverses direction of the path.

◆ scale() [1/3]

Path& Procedural::Path::scale ( const Ogre::Vector3 amount)

Applies the given scale to all the points already defined.

Has strictly no effect on the points defined after that

Parameters
amountof scale

◆ scale() [2/3]

Path& Procedural::Path::scale ( Ogre::Real  amount)

Applies the given scale to all the points already defined.

Has strictly no effect on the points defined after that

Parameters
amountamount of scale

◆ scale() [3/3]

Path& Procedural::Path::scale ( Ogre::Real  scaleX,
Ogre::Real  scaleY,
Ogre::Real  scaleZ 
)

Applies the given scale to all the points already defined.

Has strictly no effect on the points defined after that

Parameters
scaleXamount of scale in the X direction
scaleYamount of scale in the Y direction
scaleZamount of scale in the Z direction

◆ translate() [1/2]

Path& Procedural::Path::translate ( const Ogre::Vector3 translation)

Applies the given translation to all the points already defined.

Has strictly no effect on the points defined after that

Parameters
translationthe translation vector

◆ translate() [2/2]

Path& Procedural::Path::translate ( Ogre::Real  translationX,
Ogre::Real  translationY,
Ogre::Real  translationZ 
)

Applies the given translation to all the points already defined.

Has strictly no effect on the points defined after that

Parameters
translationXX component of the translation vector
translationYY component of the translation vector
translationZZ component of the translation vector

References translate().


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