Path finding is based on the Shape class with the invariant that every polygon is a convex polygon with at most four points. Equal points of different quads link them together, for shared edges we add an additional link point in the center of the edge. More...
#include <shape.h>
Public Types | |
using | iterator = PolygonIterator< PathFindingShape, PathFindingPolygon > |
![]() | |
using | iterator = PolygonIterator< Shape, Polygon > |
Public Member Functions | |
PathFindingShape (Common::ReadStream &stream) | |
iterator | begin () const |
iterator | end () const |
PathFindingPolygon | at (uint index) const |
int8 | orderAt (Common::Point query) const |
float | depthAt (Common::Point query) const |
bool | findPath (Common::Point from, Common::Point to, Common::Stack< Common::Point > &path) const |
int32 | edgeTarget (uint polygonI, uint pointI) const |
bool | findEvadeTarget (Common::Point centerTarget, float depthScale, float minDistSqr, Common::Point &evadeTarget) const |
![]() | |
Shape (Common::ReadStream &stream) | |
Common::Point | firstPoint () const |
uint | polygonCount () const |
bool | empty () const |
iterator | begin () const |
iterator | end () const |
Polygon | at (uint index) const |
int32 | polygonContaining (Common::Point query) const |
bool | contains (Common::Point query) const |
Common::Point | closestPointTo (Common::Point query, int32 &polygonI) const |
Common::Point | closestPointTo (Common::Point query) const |
void | setAsRectangle (const Common::Rect &rect) |
Static Public Attributes | |
static constexpr const uint | kPointsPerPolygon = 4 |
Additional Inherited Members | |
![]() | |
using | PolygonRange = Common::Pair< uint, uint > |
![]() | |
uint | addPolygon (uint maxCount) |
![]() | |
Common::Array< PolygonRange > | _polygons |
Common::Array< Common::Point > | _points |
Path finding is based on the Shape class with the invariant that every polygon is a convex polygon with at most four points. Equal points of different quads link them together, for shared edges we add an additional link point in the center of the edge.
The resulting graph is processed using Floyd-Warshall to precalculate for the actual path finding. Additionally we check whether a character can walk straight through an edge instead of following the link points.