gwnavruntime/queries/segmentcastquery.h Source File

segmentcastquery.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 // Primary contact: JUBA - secondary contact: NOBODY
9 #ifndef Navigation_SegmentCastQuery_H
10 #define Navigation_SegmentCastQuery_H
11 
17 
18 namespace Kaim
19 {
20 
41 template <class TraverseLogic>
42 class SegmentCastQuery : public BaseSegmentCastQuery
43 {
44 public:
45  // ---------------------------------- Public Member Functions ----------------------------------
46 
48  virtual ~SegmentCastQuery() {}
49 
50  // ---------------------------------- Functions to set up the query ----------------------------------
51 
55  void BindToDatabase(Database* database);
56 
64  void Initialize(const Vec3f& startPos, KyFloat32 radius, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
65 
66  // ---------------------------------- write accessors for query inputs ----------------------------------
67 
71  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
72 
75  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
76 
77  // ---------------------------------- write accessors for query parameters ----------------------------------
78 
81  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
82 
85  void SetSafetyDist(KyFloat32 safetyDist);
86 
89  void SetDynamicOutputMode(DynamicOutputMode savingMode);
90 
91  // ---------------------------------- Query framework functions ----------------------------------
92 
93  virtual void Advance(WorkingMemory* workingMemory);
94 
98  void PerformQuery(WorkingMemory* workingMemory = KY_NULL);
99 
100  // ---------------------------------- Accessors ----------------------------------
101 
102  SegmentCastQueryResult GetResult() const;
103  const Vec3f& GetStartPos() const;
104  const Vec3f& GetCollisionPos() const;
105  const Vec3f& GetArrivalPos() const;
106  const Vec2f& GetNormalizedDir2d() const;
107  const NavTrianglePtr& GetStartTrianglePtr() const;
108  const NavTrianglePtr& GetArrivalTrianglePtr() const;
109  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
110  KyFloat32 GetRadius() const;
111  KyFloat32 GetMaxDist() const;
112  KyFloat32 GetSafetyDist() const;
113  DynamicOutputMode GetDynamicOutputMode() const;
114  QueryDynamicOutput* GetQueryDynamicOutput() const;
115 
116  const PositionSpatializationRange& GetPositionSpatializationRange() const;
117 
118 public : // internal
119  void PerformQueryWithInputCoordPos(WorkingMemory* workingMemory);
120  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
121  const WorldIntegerPos& GetStartIntegerPos() const;
122  const WorldIntegerPos& GetArrivalIntegerPos() const;
123 };
124 
125 }
126 
128 
129 #endif //Navigation_SegmentCastQuery_H
130 
void SetDynamicOutputMode(DynamicOutputMode savingMode)
Write accessor for m_dynamicOutputMode.
Definition: segmentcastquery.inl:35
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
#define KY_NULL
Null value.
Definition: types.h:247
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Write accessor for m_queryDynamicOutput.
Definition: segmentcastquery.inl:37
DynamicOutputMode
Enumerates possible ways of storing crossed data from a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:26
SegmentCastQueryResult
Enumerates the possible results of a SegmentCastQuery.
Definition: basesegmentcastquery.h:23
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: segmentcastquery.inl:80
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
Definition: gamekitcrowddispersion.h:20
The SegmentCastQuery class casts a line segment in a given direction, and records any collisions it d...
Definition: segmentcastquery.h:44
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
The NavMesh triangle that corresponds to m_startPos3f.
Definition: segmentcastquery.inl:29
void PerformQuery(WorkingMemory *workingMemory=0)
Performs the query.
Definition: segmentcastquery.inl:87
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
Each instance of this class uniquely identifies a single NavHalfEdge in a NavFloor.
Definition: navhalfedgeptr.h:19
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: segmentcastquery.inl:17
void SetSafetyDist(KyFloat32 safetyDist)
Write accessor for m_safetyDist.
Definition: segmentcastquery.inl:33
void Initialize()
Should be called by the derived class before trying to perform the query or to push it in a QueryQueu...
Definition: iquery.h:372
void SetPositionSpatializationRange(const PositionSpatializationRange &positionSpatializationRange)
Write accessor for m_positionSpatializationRange.
Definition: segmentcastquery.inl:42
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23