gwnavruntime/math/rotation.h Source File

rotation.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 #ifndef Navigation_Rotation_H
8 #define Navigation_Rotation_H
9 
10 
14 
15 
16 namespace Kaim
17 {
18 
21 {
22  UninitializedRotationDirection, // Default RotationDirection value when not initialized.
23  UndefinedRotationDirection, // The element has no rotation constraints and can turn in both direction.
24  Clockwise, // The element can turn only clockwise.
25  CounterClockwise // The element can turn only counter clockwise.
26 };
27 
28 KY_INLINE bool IsADefinedRotationDirection(RotationDirection rotDir) { return rotDir == Clockwise || rotDir == CounterClockwise; }
29 
30 KY_INLINE const char* GetRotationDirectionLabel(RotationDirection rotationDirection)
31 {
32  switch (rotationDirection)
33  {
34  case UninitializedRotationDirection : return "!!! Not initialized !!! ";
35  case UndefinedRotationDirection : return "UndefinedRotationDirection";
36  case Clockwise : return "Clockwise ";
37  case CounterClockwise : return "CounterClockwise ";
38  default:
39  break;
40  }
41 
42  return "";
43 }
44 
45 KY_INLINE FunnelSide GetFunnelSideFromRotationDirection(RotationDirection rotDir)
46 {
47  return (
48  (rotDir == Clockwise ) ? FunnelRight :
49  (rotDir == CounterClockwise) ? FunnelLeft :
50  UndefinedFunnelSide);
51 }
52 
53 
56 {
57  InTurnRange,
58  SmallTurnRange,
59  NearTurnRangeStart,
60  NearTurnRangeEnd,
61  OutOfTurnRange
62 };
63 
64 KY_INLINE void GetTurnRangeResultLabel(const IsInTurnRangeResult result, StringStream& text)
65 {
66  switch (result)
67  {
68  case InTurnRange: text << "InTurnRange "; break;
69  case SmallTurnRange: text << "SmallTurnRange "; break;
70  case NearTurnRangeStart: text << "NearTurnRangeStart"; break;
71  case NearTurnRangeEnd: text << "NearTurnRangeEnd "; break;
72  case OutOfTurnRange: text << "OutOfTurnRange "; break;
73  }
74 }
75 
76 IsInTurnRangeResult IsInTurnRange(const Vec2f& entryDir, const Vec2f& exitDir, RotationDirection rotDir, const Vec2f& dir2d, KyFloat32 fullTurnToleranceSin = 0.0f);
77 
78 } // namespace Kaim
79 
80 #endif // Navigation_Rotation_H
RotationDirection
Defines the 4 possible cases of possibly constrained rotation in the horizontal plane for a given ele...
Definition: rotation.h:20
Definition: gamekitcrowddispersion.h:20
IsInTurnRangeResult
Defines the relative position of a direction, given a rotation direction and bounding directions...
Definition: rotation.h:55
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43