gwnavruntime/queries/utils/baseinsideposfromoutsideposquery.h Source File

baseinsideposfromoutsideposquery.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_BaseInsidePosFromOutsidePosQuery_H
10 #define Navigation_BaseInsidePosFromOutsidePosQuery_H
11 
16 
17 
18 
19 namespace Kaim
20 {
21 
22 class BaseNearestBorderHalfEdgeFromPosQuery;
23 
24 
27 {
30 
32 
35 };
36 
37 enum InsidePosFromOutsidePosQueryMode
38 {
39  INSIDEPOSFROMOUTSIDE_FROM_NEAREST_HALFEDGE,
40  INSIDEPOSFROMOUTSIDE_FROM_RAYCAST
41 };
42 
45 {
46 public:
47  static QueryType GetStaticType() { return TypeInsidePosFromOutsidePos; }
48  virtual QueryType GetType() const { return TypeInsidePosFromOutsidePos; }
49  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
50  virtual void InitFromQueryBlob(World* world, void* blob);
51  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
52  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
53 
54 
55  // ---------------------------------- Main API Functions ----------------------------------
56 
57  InsidePosFromOutsidePosQueryResult GetResult() const;
58  InsidePosFromOutsidePosQueryMode GetQueryMode() const;
59  const Vec3f& GetInputPos() const;
60  const Vec3f& GetInsidePos() const;
61  const Vec2f& GetCastDirection() const;
62  const NavTrianglePtr& GetInsidePosTrianglePtr() const;
63  KyFloat32 GetHorizontalTolerance() const;
64  KyFloat32 GetDistFromObstacle() const;
65  const WorldIntegerPos& GetInputIntegerPos() const;
66  const WorldIntegerPos& GetInsideIntegerPos() const;
67 
68  const PositionSpatializationRange& GetPositionSpatializationRange() const;
69 
70 protected:
73 
74  void BindToDatabase(Database* database);
75  void Initialize(const Vec3f& inputPos);
76  void Initialize(const Vec3f& inputPos, const Vec2f& direction);
77 
78  void SetHorizontalTolerance(KyFloat32 horizontalTolerance);
79  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
80  void SetDistFromObstacle(KyFloat32 distFromObstacle);
81  void SetInputIntegerPos(const WorldIntegerPos& inputIntegerPos);
82  void SetResult(InsidePosFromOutsidePosQueryResult result);
83 
84  KyResult ComputeInsidePosFromBordersAndPos(WorkingMemory* workingMemory, const NavHalfEdgeRawPtr& prevBorderHalfEdgerawPtr,
85  const NavHalfEdgeRawPtr& borderHalfEdgerawPtr, const NavHalfEdgeRawPtr& nextBorderHalfEdgerawPtr, const Vec3f& posOnBorderEdge, Vec3f& startToEndNormalInside2d);
86 
87 protected:
88  WorldIntegerPos m_inputIntegerPos;
89  WorldIntegerPos m_insideIntegerPos;
90 
92 
94  PositionSpatializationRange m_positionSpatializationRange;
95 
100 
101  InsidePosFromOutsidePosQueryMode m_queryMode;
102  Vec2f m_castDirection;
103 
105 
107 
109 };
110 
111 }
112 
114 
116 
117 #endif //Navigation_BaseInsidePosFromOutsidePosQuery_H
118 
Base class for InsidePosFromOutsidePosQuery.
Definition: baseinsideposfromoutsideposquery.h:44
InsidePosFromOutsidePosQueryResult
Enumerates the possible results of an InsidePosFromOutsidePosQuery.
Definition: baseinsideposfromoutsideposquery.h:26
Indicates that the query was completed successfully, and a valid position on the NavMesh was found wi...
Definition: baseinsideposfromoutsideposquery.h:34
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Indicates the query has not yet been initialized.
Definition: baseinsideposfromoutsideposquery.h:28
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:289
PositionSpatializationRange m_positionSpatializationRange
The Z extent from m_inputPos3f of the axis-aligned bounding box within which the search is performed...
Definition: baseinsideposfromoutsideposquery.h:101
KyFloat32 m_distFromObstacle
Specifies a preferred distance between the final chosen point and the border of the NavMesh...
Definition: baseinsideposfromoutsideposquery.h:106
Indicates that insufficient working memory caused the query to stop.
Definition: baseinsideposfromoutsideposquery.h:31
This class is a runtime container for Gameware Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:54
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
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
NavTrianglePtr m_insidePosTrianglePtr
Updated during processing to store the NavMesh triangle that contains m_insidePos3f.
Definition: baseinsideposfromoutsideposquery.h:113
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
Vec3f m_insidePos3f
Updated during processing to store the valid point found inside the NavMesh, if any.
Definition: baseinsideposfromoutsideposquery.h:111
Indicates the query has not yet been launched.
Definition: baseinsideposfromoutsideposquery.h:29
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 NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
InsidePosFromOutsidePosQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: baseinsideposfromoutsideposquery.h:115
Indicates that the query has not yet been launched.
Definition: iquery.h:347
KyFloat32 m_horizontalTolerance
The horizontal half-width (along both the X and Y axes) of the axis-aligned bounding box within which...
Definition: baseinsideposfromoutsideposquery.h:100
Indicates that a valid position was not found within the query's bounding box.
Definition: baseinsideposfromoutsideposquery.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
Vec3f m_inputPos3f
The starting position for the query.
Definition: baseinsideposfromoutsideposquery.h:98