gwnavruntime/queries/raycastonsegmentquery.h Source File

raycastonsegmentquery.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
9 
10 
16 
17 
18 namespace Kaim
19 {
20 
28 template<class TraverseLogic>
30 {
31 public:
32  // ------------------------------ Functions -----------------------------
33 
35  virtual ~RayCastOnSegmentQuery() {}
36 
37  // ---------------------------------- Functions to set up the query ----------------------------------
38 
42  void BindToDatabase(Database* database);
43 
52  void Initialize(const Vec3f& startPos, const NavTrianglePtr& startTrianglePtr, const Vec3f& segmentStartPos, const Vec3f& segmentEndPos, KyFloat32 maxDist);
53 
54  // ---------------------------------- write accessors for query inputs ----------------------------------
55 
58  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
59 
60  // ---------------------------------- write accessors for query parameters ----------------------------------
61 
64  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
65 
68  void SetDynamicOutputMode(DynamicOutputMode savingMode);
69 
70  // ---------------------------------- Query framework functions ----------------------------------
71 
72  virtual void Advance(WorkingMemory* workingMemory);
73 
75  void PerformQuery(WorkingMemory* workingMemory = nullptr);
76 
77  // ---------------------------------- Accessors ----------------------------------
78 
79  RayCastOnSegmentQueryResult GetResult() const;
80  const Vec3f& GetStartPos() const;
81  const Vec3f& GetSegmentStartPos() const;
82  const Vec3f& GetSegmentEndPos() const;
83  const Vec3f& GetArrivalPos() const;
84  const NavTrianglePtr& GetStartTrianglePtr() const;
85  const NavTrianglePtr& GetArrivalTrianglePtr() const;
86  KyFloat32 GetMaxDist() const;
87  DynamicOutputMode GetDynamicOutputMode() const;
88  QueryDynamicOutput* GetQueryDynamicOutput() const;
89 
90  const PositionSpatializationRange& GetPositionSpatializationRange() const;
91 
92 public: // internal
93  void PerformQueryWithInputCoordPos(WorkingMemory* workingMemory);
94  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
95  void SetSegmentStartIntegerPos(const WorldIntegerPos& segmentStartIntegerPos);
96  void SetSegmentEndIntegerPos(const WorldIntegerPos& segmentEndIntegerPos);
97  const WorldIntegerPos& GetStartIntegerPos() const;
98  const WorldIntegerPos& GetArrivalIntegerPos() const;
99  const WorldIntegerPos& GetSegmentStartIntegerPos() const;
100  const WorldIntegerPos& GetSegmentEndIntegerPos() const;
101 
102 private:
103  void RayCast_BorderHit(QueryUtils& queryUtils, const NavHalfEdgeRawPtr& halfEdgeIdRawPtrHit, const CoordPos64& destCoordPos64,
104  CompositeSubSegment& subSegment, ScopedDynamicOutput& scopedDynamicOutput);
105 };
106 
107 }
108 
110 
111 
112 
113 
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:57
void SetDynamicOutputMode(DynamicOutputMode savingMode)
Write accessor for m_dynamicOutputMode.
Definition: raycastonsegmentquery.inl:38
Vertical range (above, below) that represents the altitude tolerance for a position to be inside the ...
Definition: positionspatializationrange.h:17
RayCastOnSegmentQueryResult
Enumerates the possible results of a RayCastOnSegmentQuery.
Definition: baseraycastonsegmentquery.h:27
2d vector using KyInt64
Definition: vec2ll.h:18
void SetPositionSpatializationRange(const PositionSpatializationRange &positionSpatializationRange)
Write accessor for m_positionSpatializationRange.
Definition: raycastonsegmentquery.inl:33
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Write accessor for m_queryDynamicOutput.
Definition: raycastonsegmentquery.inl:43
DynamicOutputMode
Enumerates possible ways of storing collected data by a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:21
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: raycastonsegmentquery.inl:26
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
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:14
void PerformQuery(WorkingMemory *workingMemory=nullptr)
If workingMemory param is nullptr, m_database.GetWorkingMemory() will be used.
Definition: raycastonsegmentquery.inl:97
Base class for RayCastOnSegmentQuery.
Definition: baseraycastonsegmentquery.h:45
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:19
This class is an helper used internally by the Queries to factorize Code that is used in many Queries...
Definition: queryutils.h:28
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
The RayCastOnSegmentQuery class tests whether a ray (with a width of 0) can be cast from a starting p...
Definition: raycastonsegmentquery.h:29
void Initialize()
Should be called by the derived class prior to perform the query or to push it in a QueryQueue...
Definition: iquery.h:220
Each instance of this class uniquely identifies a single NavHalfEdge in a NavFloor.
Definition: navhalfedgerawptr.h:23
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16