gwnavruntime/queries/utils/basesegmentcastquery.h Source File

basesegmentcastquery.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_BaseSegmentCastQuery_H
10 #define Navigation_BaseSegmentCastQuery_H
11 
17 
18 
19 namespace Kaim
20 {
21 
24 {
27 
34 
37 };
38 
41 {
42 public :
43  static QueryType GetStaticType() { return TypeSegmentCast; }
44  virtual QueryType GetType() const { return TypeSegmentCast; }
45  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
46  virtual void InitFromQueryBlob(World* world, void* blob);
47  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
48  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
49 
50 
51  // ---------------------------------- Main API Functions ----------------------------------
52 
53  SegmentCastQueryResult GetResult() const;
54  const Vec3f& GetStartPos() const;
55  const Vec3f& GetCollisionPos() const;
56  const Vec3f& GetArrivalPos() const;
57  const Vec2f& GetNormalizedDir2d() const;
58  const NavTrianglePtr& GetStartTrianglePtr() const;
59  const NavTrianglePtr& GetArrivalTrianglePtr() const;
60  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
61  KyFloat32 GetRadius() const;
62  KyFloat32 GetMaxDist() const;
63  KyFloat32 GetSafetyDist() const;
64  DynamicOutputMode GetDynamicOutputMode() const;
65  QueryDynamicOutput* GetQueryDynamicOutput() const;
66 
67  const PositionSpatializationRange& GetPositionSpatializationRange() const;
68 
69  const WorldIntegerPos& GetStartIntegerPos() const;
70  const WorldIntegerPos& GetArrivalIntegerPos() const;
71 
72 protected:
74  virtual ~BaseSegmentCastQuery(){}
75 
76  void BindToDatabase(Database* database);
77  void Initialize(const Vec3f& startPos, KyFloat32 radius, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
78 
79  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
80  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
81  void SetSafetyDist(KyFloat32 safetyDist);
82  void SetDynamicOutputMode(DynamicOutputMode savingMode);
83  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
84 
85  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
86  void SetResult(SegmentCastQueryResult result);
87  SegmentCastQueryResult ConvertTraversalResultToSegmentCastResult(TraversalResult traversalRC);
88 
89 protected:
90  WorldIntegerPos m_startIntegerPos;
91  WorldIntegerPos m_arrivalIntegerPos;
92 
98 
104  PositionSpatializationRange m_positionSpatializationRange;
105 
109 
117 
121 
124 
126 
128 
135  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
136 };
137 
138 }
139 
141 
142 #endif //Navigation_BaseSegmentCastQuery_H
143 
Indicates that insufficient working memory caused the query to stop.
Definition: basesegmentcastquery.h:32
Vec3f m_startPos3f
The starting position of the segment.
Definition: basesegmentcastquery.h:100
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
Indicates that an error occured during the query computation.
Definition: basesegmentcastquery.h:33
Indicates that the NavTag at the starting point was forbidden.
Definition: basesegmentcastquery.h:29
KyFloat32 m_radius
The half-width of the segment .
Definition: basesegmentcastquery.h:102
NavTrianglePtr m_startTrianglePtr
The NavMesh triangle that corresponds to m_startPos3f. You can set it as an input or retrieve it as a...
Definition: basesegmentcastquery.h:104
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:289
Indicates that the query has not yet been initialized.
Definition: basesegmentcastquery.h:25
Indicates that the query has not yet been launched.
Definition: basesegmentcastquery.h:26
This class is a runtime container for Gameware Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:54
Vec2f m_normalizedDir2d
A normalized vector that represents the direction in which the segment is cast.
Definition: basesegmentcastquery.h:101
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
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
NavTrianglePtr m_arrivalTrianglePtr
Updated during processing to indicate the NavMesh triangle that corresponds to m_arrivalPos3f.
Definition: basesegmentcastquery.h:127
Indicates that moving back the collision point resulted in an arrival position that is outside of the...
Definition: basesegmentcastquery.h:31
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
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: basesegmentcastquery.h:28
Definition: gamekitcrowddispersion.h:20
Vec3f m_collisionPos3f
Updated during processing to indicate the position of the collision point between the segment and the...
Definition: basesegmentcastquery.h:115
Indicates that the segment was able to travel its maximum distance without collision.
Definition: basesegmentcastquery.h:35
KyFloat32 m_safetyDist
When a collision is detected, the collision point is moved back along m_normalizedDir2d by this dista...
Definition: basesegmentcastquery.h:108
SegmentCastQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: basesegmentcastquery.h:132
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
Vec3f m_arrivalPos3f
Updated during processing to indicate the final position of the segment at the end of the cast...
Definition: basesegmentcastquery.h:123
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
Indicates that the starting point is very close to a NavMesh border. Either the segment does not fit ...
Definition: basesegmentcastquery.h:30
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
Base class for SegmentCastQuery.
Definition: basesegmentcastquery.h:40
Indicates that the query has not yet been launched.
Definition: iquery.h:347
PositionSpatializationRange m_positionSpatializationRange
The altitude range around the position to use when determining m_startTrianglePtr from the m_startPos...
Definition: basesegmentcastquery.h:111
Ptr< QueryDynamicOutput > m_queryDynamicOutput
A ref-counted Ptr to a QueryDynamicOutput instance, used to store the data encountered during the que...
Definition: basesegmentcastquery.h:144
KyFloat32 m_maxDist
Determines the maximum distance the segment will travel.
Definition: basesegmentcastquery.h:103
Indicates that a final arrival position was calculated successfully.
Definition: basesegmentcastquery.h:36
DynamicOutputMode m_dynamicOutputMode
Specifies the type of data stored in m_queryDynamicOutput.
Definition: basesegmentcastquery.h:134
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
NavHalfEdgePtr m_collisionHalfEdgePtr
Updated during processing to indicate the triangle edge that the segment collided with...
Definition: basesegmentcastquery.h:130
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