Kaim::Channel Class Reference

Kaim::Channel Class Reference

#include <channel.h>

Class Description

Channels define preferred navigation areas around an original Path section on NavMesh.

They are typically used to drive bots which inertia prevent to use reactive path follower to drive it correctly along the original path itself.

Trajectory provides a spline mode that needs a Channel to compute splines to drive the bot.

Inherits Kaim::RefCountBase< C, Stat >.

Main API Functions

KyUInt32 GetGateCount () const
 
const GateGetGate (KyUInt32 index) const
 
const KyArray< Vec2f > & GetPreChannelPolyline () const
 
const KyArray< Vec2f > & GetPostChannelPolyline () const
 
KyUInt32 GetSectionCount () const
 
KyUInt32 GetLastSectionIdx () const
 
KyUInt32 GetSectionStartGateIdx (KyUInt32 sectionIdx) const
 
KyUInt32 GetSectionEndGateIdx (KyUInt32 sectionIdx) const
 
const GateGetSectionStartGate (KyUInt32 sectionIdx) const
 
const GateGetSectionEndGate (KyUInt32 sectionIdx) const
 
const Vec3fGetEndPos () const
 
KyUInt32 GetFirstPathNodeIdx () const
 
KyUInt32 GetGatePathNodeIdx (KyUInt32 gateIndex) const
 
bool IsPositionInSection (const Vec2f &position, KyUInt32 sectionIndex, KyUInt32 &positionFlags) const
 
bool IsPositionInSection (const Vec2f &position, KyUInt32 sectionIndex) const
 
KyResult GetSectionFromPositionAndSeed (const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx) const
 
KyResult GetSectionFromPositionAndSeed_AlongBubble (const Bubble &bubble, const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx) const
 
bool IsConcaveCorner (KyUInt32 gateIdx, ChannelSide side) const
 

For internal use only

KyArray< Gatem_gates
 
KyArray< Vec2fm_preChannelPolyline
 
KyArray< Vec2fm_postChannelPolyline
 
KyUInt32 m_firstPathNodeIdx
 
KyResult GetSectionFromPositionAndSeed (const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx, KyFloat32 maxProgress) const
 
KyResult GetSectionFromPositionAndSeed_Forward (const Kaim::Vec3f &previousPosition, KyUInt32 previousGateIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newGateIdx, KyFloat32 maxProgress) const
 
KyResult GetSectionFromPositionAndSeed_Backward (const Kaim::Vec3f &previousPosition, KyUInt32 previousGateIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newGateIdx, KyFloat32 maxProgress) const
 
bool IntersectSegmentVsPreChannelPolyline (const Vec2f &A, const Vec2f &B, Vec2f &intersection) const
 
bool IntersectSegmentVsPostChannelPolyline (const Vec2f &A, const Vec2f &B, Vec2f &intersection) const
 
void SendVisualDebug (World *navWorld, const ChannelDisplayConfig &displayConfig=ChannelDisplayConfig(), KyUInt32 indexInChannelArray=0, const char *listBaseName="", const char *groupName="Channel", KyUInt32 visualDebugId=0xFFFFFFFF) const
 

Creation functions

These functions are expected to be used internally in Channel computation classes.

Though you can use them when creating your own Channel.

KyResult InitFromBlob (const ChannelBlob &channelBlob)
 
void Initialize ()
 
void Clear ()
 
void AddGate (const Gate &gate)
 
GateGetGate (KyUInt32 index)
 
void SetPreChannelPolyline (const KyArray< Vec2f > &polyline)
 
void SetPostChannelPolyline (const KyArray< Vec2f > &polyline)
 
void SetPolylineFromBlob (const BlobArray< Vec2f > &polylineBlob, KyArray< Vec2f > &polyline)
 
void SetFirstPathNodeIdx (KyUInt32 firstPathNodeIdx)
 
KyResult ComputeChannelWidth ()
 

Member Function Documentation

const Vec3f & Kaim::Channel::GetEndPos ( ) const
inline

Returns the channel end position, i.e.

the m_pathPos of its last Gate.

Precondition
The Channel must not be empty.
KyUInt32 Kaim::Channel::GetFirstPathNodeIdx ( ) const
inline

Return PathNodeIdx of the first gate.

KyUInt32 Kaim::Channel::GetGatePathNodeIdx ( KyUInt32  gateIndex) const
inline

Return PathNodeIdx of the gate at gateIndex.

KyResult Kaim::Channel::GetSectionFromPositionAndSeed ( const Kaim::Vec3f previousPosition,
KyUInt32  previousSectionIdx,
const Kaim::Vec3f newPosition,
KyUInt32 newSectionIdx 
) const

Given a previous position and its section, computes the section for a new position that is supposed to be near the previous one.

KyResult Kaim::Channel::GetSectionFromPositionAndSeed_AlongBubble ( const Bubble bubble,
const Kaim::Vec3f previousPosition,
KyUInt32  previousSectionIdx,
const Kaim::Vec3f newPosition,
KyUInt32 newSectionIdx 
) const

Given a previous position and its section, computes the section for a new position that is supposed to be accessible from the previous one following a circle arc.

bool Kaim::Channel::IsPositionInSection ( const Vec2f position,
KyUInt32  sectionIndex,
KyUInt32 positionFlags 
) const

Checks a provided 2D position is inside a channel section.

It updates positionFlags with a combination of the RelativePositionToChannelSectionFlag.

bool Kaim::Channel::IsPositionInSection ( const Vec2f position,
KyUInt32  sectionIndex 
) const
inline

Just checks a provided 2D position is inside a channel section.


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