gwnavruntime/queries/raycastonsegmentquery.h Source File

raycastonsegmentquery.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_RayCastOnSegmentQuery_H
10 #define Navigation_RayCastOnSegmentQuery_H
11 
12 
18 
19 
20 namespace Kaim
21 {
22 
30 template<class TraverseLogic>
31 class RayCastOnSegmentQuery : public BaseRayCastOnSegmentQuery
32 {
33 public:
34  // ---------------------------------- Public Member Functions ----------------------------------
35 
37  virtual ~RayCastOnSegmentQuery() {}
38 
39  // ---------------------------------- Functions to set up the query ----------------------------------
40 
44  void BindToDatabase(Database* database);
45 
54  void Initialize(const Vec3f& startPos, const NavTrianglePtr& startTrianglePtr, const Vec3f& segmentStartPos, const Vec3f& segmentEndPos, KyFloat32 maxDist);
55 
56  // ---------------------------------- write accessors for query inputs ----------------------------------
57 
60  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
61 
62  // ---------------------------------- write accessors for query parameters ----------------------------------
63 
66  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
67 
70  void SetDynamicOutputMode(DynamicOutputMode savingMode);
71 
72  // ---------------------------------- Query framework functions ----------------------------------
73 
74  virtual void Advance(WorkingMemory* workingMemory);
75 
79  void PerformQuery(WorkingMemory* workingMemory = KY_NULL);
80 
81  // ---------------------------------- Accessors ----------------------------------
82 
83  RayCastOnSegmentQueryResult GetResult() const;
84  const Vec3f& GetStartPos() const;
85  const Vec3f& GetSegmentStartPos() const;
86  const Vec3f& GetSegmentEndPos() const;
87  const Vec3f& GetArrivalPos() const;
88  const NavTrianglePtr& GetStartTrianglePtr() const;
89  const NavTrianglePtr& GetArrivalTrianglePtr() const;
90  KyFloat32 GetMaxDist() const;
91  DynamicOutputMode GetDynamicOutputMode() const;
92  QueryDynamicOutput* GetQueryDynamicOutput() const;
93 
94  const PositionSpatializationRange& GetPositionSpatializationRange() const;
95 
96 public : // internal
97  void PerformQueryWithInputCoordPos(WorkingMemory* workingMemory);
98  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
99  void SetSegmentStartIntegerPos(const WorldIntegerPos& segmentStartIntegerPos);
100  void SetSegmentEndIntegerPos(const WorldIntegerPos& segmentEndIntegerPos);
101  const WorldIntegerPos& GetStartIntegerPos() const;
102  const WorldIntegerPos& GetArrivalIntegerPos() const;
103  const WorldIntegerPos& GetSegmentStartIntegerPos() const;
104  const WorldIntegerPos& GetSegmentEndIntegerPos() const;
105 
106 private:
107  void RayCast_BorderHit(QueryUtils& queryUtils, const NavHalfEdgeRawPtr& halfEdgeIdRawPtrHit, const CoordPos64& destCoordPos64,
108  CompositeSubSegment& subSegment, ScopedDynamicOutput& scopedDynamicOutput);
109 };
110 
111 }
112 
114 
115 
116 
117 #endif //Navigation_RayCastOnSegmentQuery_H
118 
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
void SetDynamicOutputMode(DynamicOutputMode savingMode)
Write accessor for m_dynamicOutputMode.
Definition: raycastonsegmentquery.inl:41
RayCastOnSegmentQueryResult
Enumerates the possible results of a RayCastOnSegmentQuery.
Definition: baseraycastonsegmentquery.h:29
#define KY_NULL
Null value.
Definition: types.h:247
void PerformQuery(WorkingMemory *workingMemory=0)
Performs the query.
Definition: raycastonsegmentquery.inl:100
This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers...
Definition: vec2ll.h:27
void SetPositionSpatializationRange(const PositionSpatializationRange &positionSpatializationRange)
Write accessor for m_positionSpatializationRange.
Definition: raycastonsegmentquery.inl:36
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Write accessor for m_queryDynamicOutput.
Definition: raycastonsegmentquery.inl:46
DynamicOutputMode
Enumerates possible ways of storing crossed data from a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:26
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: raycastonsegmentquery.inl:29
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
Definition: gamekitcrowddispersion.h:20
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: raycastonsegmentquery.inl:17
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
This class is an helper used internally by the Queries to factorize Code that is used in many Queries...
Definition: queryutils.h:30
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
The RayCastOnSegmentQuery class tests whether a ray (with a width of 0) can be cast from a starting p...
Definition: raycastonsegmentquery.h: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
Each instance of this class uniquely identifies a singleNavHalfEdge in a NavFloor.
Definition: navhalfedgerawptr.h:34
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