gwnavruntime/math/rotation.h Source File

rotation.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 #pragma once
8 
10 
11 namespace Kaim
12 {
13 
16 {
17  UninitializedRotationDirection, // Default RotationDirection value when not initialized.
18  UndefinedRotationDirection, // The element has no rotation constraints and can turn in both direction.
19  Clockwise, // The element can turn only clockwise.
20  CounterClockwise // The element can turn only counter clockwise.
21 };
22 
23 KY_INLINE bool IsADefinedRotationDirection(RotationDirection rotDir) { return rotDir == Clockwise || rotDir == CounterClockwise; }
24 
25 KY_INLINE const char* GetRotationDirectionLabel(RotationDirection rotationDirection)
26 {
27  switch (rotationDirection)
28  {
29  case UninitializedRotationDirection : return "!!! Not initialized !!! ";
30  case UndefinedRotationDirection : return "UndefinedRotationDirection";
31  case Clockwise : return "Clockwise ";
32  case CounterClockwise : return "CounterClockwise ";
33  default:
34  break;
35  }
36 
37  return "";
38 }
39 
40 
43 {
44  InTurnRange,
45  SmallTurnRange,
46  NearTurnRangeStart,
47  NearTurnRangeEnd,
48  OutOfTurnRange
49 };
50 
51 template<typename OSTREAM>
52 KY_INLINE void GetTurnRangeResultLabel(const IsInTurnRangeResult result, OSTREAM& ostream)
53 {
54  switch (result)
55  {
56  case InTurnRange: ostream << "InTurnRange "; break;
57  case SmallTurnRange: ostream << "SmallTurnRange "; break;
58  case NearTurnRangeStart: ostream << "NearTurnRangeStart"; break;
59  case NearTurnRangeEnd: ostream << "NearTurnRangeEnd "; break;
60  case OutOfTurnRange: ostream << "OutOfTurnRange "; break;
61  }
62 }
63 
64 IsInTurnRangeResult IsInTurnRange(const Vec2f& entryDir, const Vec2f& exitDir, RotationDirection rotDir, const Vec2f& dir2d, KyFloat32 fullTurnToleranceSin = 0.0f);
65 
66 } // namespace Kaim
67 
RotationDirection
Defines the 4 possible cases of possibly constrained rotation in the horizontal plane for a given ele...
Definition: rotation.h:15
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
IsInTurnRangeResult
Defines the relative position of a direction, given a rotation direction and bounding directions...
Definition: rotation.h:42
float KyFloat32
float
Definition: types.h:32