PixelLightAPI  .
Public Member Functions
PLMath::GraphPath Class Reference

A path can be set of links to graph nodes or owning it's own private nodes. More...

#include <GraphPath.h>

Inheritance diagram for PLMath::GraphPath:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLMATH_API GraphPath (const PLCore::String &sName, PLCore::ResourceManager< GraphPath > *pManager=nullptr)
 Constructor.
PLMATH_API GraphPath (Graph *pOwnerGraph=nullptr)
 Constructor.
virtual PLMATH_API ~GraphPath ()
 Destructor.
PLMATH_API GraphGetOwnerGraph () const
 Returns the owner graph of the path.
PLMATH_API PLCore::uint32 GetNumOfNodes () const
 Returns the number of nodes.
PLMATH_API bool AddNode (GraphNode &cNode)
 Adds a node.
PLMATH_API bool RemoveNode (PLCore::uint32 nNode=0)
 Removes a node.
PLMATH_API const GraphNodeGetNode (PLCore::uint32 nID=0) const
 Returns a node.
PLMATH_API GraphNodeGetNode (PLCore::uint32 nID=0)
 Returns a node.
PLMATH_API float GetLength () const
 Returns the length of the path.
PLMATH_API bool IsClosed () const
 Returns whether the path is closed or not.
PLMATH_API void SetClosed (bool bClosed=false)
 Sets if the path is closed or not.
PLMATH_API Vector3 GetPosByNodeIndex (float fNodeIndex, bool bLinear=true) const
 Calculates the position at the given node index.
PLMATH_API Vector3 GetPosByPercentageAlongPath (float fPercentageAlongPath, bool bLinear=true) const
 Calculates the position by using percentage along the path.
virtual PLMATH_API GraphPathoperator= (const GraphPath &cSource)
virtual PLMATH_API bool Unload () override
 Unloads the loadable.
virtual PLMATH_API PLCore::String GetLoadableTypeName () const override
 Returns the loadable type name.

Detailed Description

A path can be set of links to graph nodes or owning it's own private nodes.


Constructor & Destructor Documentation

PLMATH_API PLMath::GraphPath::GraphPath ( const PLCore::String sName,
PLCore::ResourceManager< GraphPath > *  pManager = nullptr 
)

Constructor.

Parameters:
[in]sNameResource name to set
[in]pManagerResource manager using this resource, can be a null pointer
PLMATH_API PLMath::GraphPath::GraphPath ( Graph pOwnerGraph = nullptr)

Constructor.

Parameters:
[in]pOwnerGraphOwner graph, if a null pointer the path has it's own private nodes
Note:
virtual PLMATH_API PLMath::GraphPath::~GraphPath ( ) [virtual]

Destructor.


Member Function Documentation

PLMATH_API Graph* PLMath::GraphPath::GetOwnerGraph ( ) const

Returns the owner graph of the path.

Returns:
Owner graph of the path, a null pointer if the path is independent
PLMATH_API PLCore::uint32 PLMath::GraphPath::GetNumOfNodes ( ) const

Returns the number of nodes.

Returns:
Number of path nodes
PLMATH_API bool PLMath::GraphPath::AddNode ( GraphNode cNode)

Adds a node.

Parameters:
[in]cNodeNode which should be added, if the path has no owner graph it will delete the node after it is no longer required.
Returns:
'true' if all went fine, else 'false'
PLMATH_API bool PLMath::GraphPath::RemoveNode ( PLCore::uint32  nNode = 0)

Removes a node.

Parameters:
[in]nNodeID of the node which should be removed
Returns:
'true' if all went fine, else 'false'
PLMATH_API const GraphNode* PLMath::GraphPath::GetNode ( PLCore::uint32  nID = 0) const

Returns a node.

Parameters:
[in]nIDID of the node which should be returned
Returns:
The path node, a null pointer if there was an error
PLMATH_API GraphNode* PLMath::GraphPath::GetNode ( PLCore::uint32  nID = 0)

Returns a node.

Parameters:
[in]nIDID of the node which should be returned
Returns:
The path node, a null pointer if there was an error
PLMATH_API float PLMath::GraphPath::GetLength ( ) const

Returns the length of the path.

Returns:
Path length
PLMATH_API bool PLMath::GraphPath::IsClosed ( ) const

Returns whether the path is closed or not.

Returns:
'true' if the path is closed, else 'false'
Note:
  • If a path is closed the first node is taken after the last one
PLMATH_API void PLMath::GraphPath::SetClosed ( bool  bClosed = false)

Sets if the path is closed or not.

Parameters:
[in]bClosedShould the path be closed?
See also:
PLMATH_API Vector3 PLMath::GraphPath::GetPosByNodeIndex ( float  fNodeIndex,
bool  bLinear = true 
) const

Calculates the position at the given node index.

Parameters:
[in]fNodeIndexNode index (0-<number of="" nodes>="">, automatically wrapped into that range)
[in]bLinearLinear interpolation? Else a catmull rom curve is used.
Returns:
The path position corresponding to the given node index
Remarks:
If the position isn't linear interpolated the first and last node are skipped. (only required for the curve progression) Therefore at node index 0 the position will be the position node 2.
PLMATH_API Vector3 PLMath::GraphPath::GetPosByPercentageAlongPath ( float  fPercentageAlongPath,
bool  bLinear = true 
) const

Calculates the position by using percentage along the path.

Parameters:
[in]fPercentageAlongPathPercentage along the path (0-1, automatically wrapped into that range)
[in]bLinearLinear interpolation? Else a catmull rom curve is used.
Returns:
The path position corresponding to the given percentage along the path
Remarks:
If the position isn't linear interpolated the first and last node are skipped. (only required for the curve progression) Therefore at node index 0 the position will be the position node 2.
virtual PLMATH_API GraphPath& PLMath::GraphPath::operator= ( const GraphPath cSource) [virtual]
virtual PLMATH_API bool PLMath::GraphPath::Unload ( ) [override, virtual]

Unloads the loadable.

Returns:
'true' if all went fine, else 'false'

Reimplemented from PLCore::Loadable.

virtual PLMATH_API PLCore::String PLMath::GraphPath::GetLoadableTypeName ( ) const [override, virtual]

Returns the loadable type name.

Returns:
The loadable type name

Reimplemented from PLCore::Loadable.


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:34
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported