RAIN.Path.SimplePath Class Reference

Inheritance diagram for RAIN.Path.SimplePath:

## Public Member Functions | |

SimplePath (PathGraph graph, int[] nodes, float cost) | |

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. | |

bool | IsValidOnGraph (PathGraph pathGraph) |

Vector3 | GetWaypointPosition (int waypointIndex) |

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

bool | IsGraphNodeInPath (int nodeIndex) |

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

void | GetPathDetail (float param, float closeEnoughDistance, out int lastWaypointIndex, out int nextWaypointIndex, out float percentAlongSegment) |

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. | |

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. | |

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. | |

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. | |

## Properties | |

PathGraph | Graph` [get]` |

float RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

float RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

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

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

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

Implements RAIN.Path.PathBase.

int RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

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

Computes the distance along the path from start to end.

**Returns:**- The total path distance

Implements RAIN.Path.PathBase.

Vector3 RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

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

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

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

Implements RAIN.Path.PathBase.

float RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

int RAIN.Path.SimplePath.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)

Implements RAIN.Path.PathBase.

Vector3 RAIN.Path.SimplePath.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.

Implements RAIN.Path.PathBase.

bool RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

bool RAIN.Path.SimplePath.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

Implements RAIN.Path.PathBase.

float RAIN.Path.SimplePath.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.

Implements RAIN.Path.PathBase.