RAIN.Path.PathBase Interface Reference

PathBase is the base interface for all Path implementations. More...

Inheritance diagram for RAIN.Path.PathBase:

## Public Member Functions | |

float | GetLength () |

Computes the distance along the path from start to end. | |

float | GetDistanceFromStart (Vector3 position) |

Computes the distance from the start of the path to the closest intersecting point along the path. | |

float | GetDistanceFromStart (Vector3 position, float startDistance) |

Computes the distance from the starting of the path to the closest intersecting point that occurs after the startDistance. | |

bool | IsValid () |

Indicates whether the path is valid. An invalid path may be the result of a failed pathfinding step, or may be a path that has been invalidated at some later time due to changing game conditions, etc. | |

Vector3 | GetPositionOnPath (float distance) |

Returns the position along the path at the specified path distance. | |

int | GetWaypointCount () |

Returns the number of path nodes, or waypoints, in the given path. Valid paths will have at least 2. | |

Vector3 | GetWaypointPosition (int waypointIndex) |

Returns the position of the nth waypoint as specified by waypointIndex. | |

int | GetGraphNodeIndexOfWaypoint (int waypointIndex) |

Returns the graph node index of the nth waypoint as specified by waypointIndex. The graph node index should support retrieval of an associated graph node from the PathGraph used to create the Path. | |

bool | IsGraphNodeInPath (int graphNodeIndex) |

Indicates whether the graph node with index graphNodeIndex is a waypoint in the path. | |

int | GetStartGraphNodeIndex () |

A shortcut to retrieve the graph node index of waypoint 0. | |

int | GetEndGraphNodeIndex () |

A shortcut to retrieve the graph node index of waypoint GetWaypointCount()-1. | |

float | GetTotalCost () |

Returns the total cost of the path. For most paths, this will be equivalent to GetLength(). GetTotalCost() may return a previously computed value rather than recomputing the path cost for each call. | |

float | RecomputeTotalCost () |

Recomputes the total cost of the path and returns the value. The compute value may be stored and returned later by the GetTotalCost() call. |

float RAIN.Path.PathBase.GetDistanceFromStart | ( | Vector3 | position | ) |

Computes the distance from the start of the path to the closest intersecting point along the path.

**Parameters:**-
position The point to intersect with the path

**Returns:**- The total path distance from the start to the intersection point

Implemented in RAIN.Path.SimplePath.

float RAIN.Path.PathBase.GetDistanceFromStart | ( | Vector3 | position, |

float | startDistance |
||

) |

Computes the distance from the starting of the path to the closest intersecting point that occurs after the startDistance.

**Parameters:**-
position The point to intersect with the path closestDistance The starting distance along the path, after which an intersection may occur. This is mainly used for paths that may have switchbacks or crossovers, in which case we may want to avoid backtracking if more than one intersection is possible.

**Returns:**- The total path distance from the start to the intersection point

Implemented in RAIN.Path.SimplePath.

int RAIN.Path.PathBase.GetEndGraphNodeIndex | ( | ) |

A shortcut to retrieve the graph node index of waypoint GetWaypointCount()-1.

**Returns:**- The graph node index of waypoint GetWaypointCount()-1

Implemented in RAIN.Path.SimplePath.

int RAIN.Path.PathBase.GetGraphNodeIndexOfWaypoint | ( | int | waypointIndex | ) |

Returns the graph node index of the nth waypoint as specified by waypointIndex. The graph node index should support retrieval of an associated graph node from the PathGraph used to create the Path.

**Parameters:**-
waypointIndex The sequential index of the waypoint in the path to be retrieved. Must be between 0 and GetWaypointCount()-1

**Returns:**- The graph node index associated with the waypoint. -1 should indicate a missing or invalid waypoint

Implemented in RAIN.Path.SimplePath.

float RAIN.Path.PathBase.GetLength | ( | ) |

Computes the distance along the path from start to end.

**Returns:**- The total path distance

Implemented in RAIN.Path.SimplePath.

Vector3 RAIN.Path.PathBase.GetPositionOnPath | ( | float | distance | ) |

Returns the position along the path at the specified path distance.

**Parameters:**-
distance The distance along the path from the start to the queried point

**Returns:**- The Vector3 coordinate of the path at the specified path distance

Implemented in RAIN.Path.SimplePath.

int RAIN.Path.PathBase.GetStartGraphNodeIndex | ( | ) |

A shortcut to retrieve the graph node index of waypoint 0.

**Returns:**- The graph node index of waypoint 0

Implemented in RAIN.Path.SimplePath.

float RAIN.Path.PathBase.GetTotalCost | ( | ) |

Returns the total cost of the path. For most paths, this will be equivalent to GetLength(). GetTotalCost() may return a previously computed value rather than recomputing the path cost for each call.

**Returns:**- The total cost of the path, determined by adding edge costs

Implemented in RAIN.Path.SimplePath.

int RAIN.Path.PathBase.GetWaypointCount | ( | ) |

Returns the number of path nodes, or waypoints, in the given path. Valid paths will have at least 2.

**Returns:**- The number of path nodes (waypoints)

Implemented in RAIN.Path.SimplePath.

Vector3 RAIN.Path.PathBase.GetWaypointPosition | ( | int | waypointIndex | ) |

Returns the position of the nth waypoint as specified by waypointIndex.

**Parameters:**-
waypointIndex The sequential index of the waypoint in the path. Must be between 0 and GetWaypointCount()-1

**Returns:**- The Vector3 coordinate of the waypoint.

Implemented in RAIN.Path.SimplePath.

bool RAIN.Path.PathBase.IsGraphNodeInPath | ( | int | graphNodeIndex | ) |

Indicates whether the graph node with index graphNodeIndex is a waypoint in the path.

**Parameters:**-
graphNodeIndex The graph node index of the graph node to check.

**Returns:**- true if the graph node index represents a waypoint, false otherwise

Implemented in RAIN.Path.SimplePath.

bool RAIN.Path.PathBase.IsValid | ( | ) |

Indicates whether the path is valid. An invalid path may be the result of a failed pathfinding step, or may be a path that has been invalidated at some later time due to changing game conditions, etc.

**Returns:**- true if the path is valid, false otherwise

Implemented in RAIN.Path.SimplePath.

float RAIN.Path.PathBase.RecomputeTotalCost | ( | ) |

Recomputes the total cost of the path and returns the value. The compute value may be stored and returned later by the GetTotalCost() call.

**Returns:**- Returns the computed total path cost.

Implemented in RAIN.Path.SimplePath.