#include <ePath.h>
Public Member Functions | |
ePath () | |
~ePath () | |
bool | Valid () const |
eCoord & | CurrentPosition () const |
eCoord & | CurrentOffset () const |
bool | Proceed () |
bool | GoBack () |
void | Clear () |
Protected Member Functions | |
void | Add (eHalfEdge *edge) |
void | Add (const eCoord &point) |
Protected Attributes | |
tArray< eCoord > | positions |
tArray< eCoord > | offsets |
int | current |
Friends | |
class | eHalfEdge |
Definition at line 36 of file ePath.h.
ePath::ePath | ( | ) |
ePath::~ePath | ( | ) |
bool ePath::Valid | ( | ) | const [inline] |
Definition at line 46 of file ePath.h.
References current, GrowingArrayBase::Len(), and positions.
Referenced by gAIPlayer::ThinkPath().
eCoord& ePath::CurrentPosition | ( | ) | const [inline] |
eCoord& ePath::CurrentOffset | ( | ) | const [inline] |
bool ePath::Proceed | ( | ) |
bool ePath::GoBack | ( | ) |
Definition at line 404 of file ePath.cpp.
References current, GrowingArrayBase::Len(), and positions.
Referenced by gAIPlayer::ThinkPath().
00405 { 00406 if (current < positions.Len()-1) 00407 { 00408 current++; 00409 return true; 00410 } 00411 else 00412 return false; 00413 }
void ePath::Clear | ( | ) |
Definition at line 452 of file ePath.cpp.
References current, offsets, positions, and tArray< T, MALLOC >::SetLen().
Referenced by eHalfEdge::FindPath(), and gAIPlayer::NewObject().
00453 { 00454 lastPath = this; 00455 00456 current=-1; 00457 00458 offsets.SetLen(0); 00459 positions.SetLen(0); 00460 }
void ePath::Add | ( | eHalfEdge * | edge | ) | [protected] |
Definition at line 424 of file ePath.cpp.
References current, eCoord, eHalfEdge::Next(), offsets, eHalfEdge::Point(), pos, positions, REAL, sqrt(), and tASSERT.
Referenced by eHalfEdge::FindPath().
00425 { 00426 tASSERT (e->Point() && e->Next() && e->Next()->Point() && e->Next()->Next() && e->Next()->Next()->Point()); 00427 00428 current++; 00429 00430 eCoord pos = *e->Point(); 00431 // eCoord dir = e->Vec(); 00432 eCoord offset = ((*e->Next()->Next()->Point() + *e->Next()->Point()) * .5f - pos) * .5f; 00433 // offset = offset - dir * (eCoord::F(dir, offset) / dir.NormSquared()); 00434 00435 REAL ol = sqrt(offset.NormSquared()); 00436 if (ol > 1) 00437 offset = offset * (1/ol); 00438 00439 positions[current] = pos; 00440 offsets[current] = offset; 00441 }
void ePath::Add | ( | const eCoord & | point | ) | [protected] |
tArray<eCoord> ePath::positions [protected] |
tArray<eCoord> ePath::offsets [protected] |
int ePath::current [protected] |
Definition at line 57 of file ePath.h.
Referenced by Add(), Clear(), CurrentOffset(), CurrentPosition(), ePath(), GoBack(), Proceed(), and Valid().