7 #ifndef Navigation_Bubble_H
8 #define Navigation_Bubble_H
20 class ScopedDisplayList;
44 void InitFromBlob(
const BubbleBlob& blob);
46 void SetCenter(
const Vec3f& center);
51 void SetCenterAltitude(
KyFloat32 newCenterAltitude);
53 const Vec3f& GetCenter()
const;
57 FunnelSide GetFunnelSide()
const;
59 bool IsInitialized()
const;
87 bool operator==(
const Bubble& other)
const;
95 KY_INLINE Bubble::Bubble() { Reset(); }
98 Set(center, radius, rotationDirection, type);
100 KY_INLINE
void Bubble::Reset()
102 Set(
Vec3f::Zero(), 0.0f, UninitializedRotationDirection, UndefinedBubbleType);
108 SetRotationDirection(rotationDirection);
112 KY_INLINE
void Bubble::SetCenter(
const Vec3f& center) { m_center = center; }
113 KY_INLINE
void Bubble::SetRadius(
KyFloat32 radius) { m_radius = radius; }
114 KY_INLINE
void Bubble::SetRotationDirection(
RotationDirection rotationDirection) { m_rotationDirection = rotationDirection; }
115 KY_INLINE
void Bubble::SetType(
BubbleType type) { m_type = type; }
116 KY_INLINE
void Bubble::SetCenterAltitude(
KyFloat32 newCenterAltitude) { m_center.
z = newCenterAltitude; }
118 KY_INLINE
const Vec3f& Bubble::GetCenter()
const {
return m_center; }
119 KY_INLINE
KyFloat32 Bubble::GetRadius()
const {
return m_radius; }
120 KY_INLINE
RotationDirection Bubble::GetRotationDirection()
const {
return m_rotationDirection; }
121 KY_INLINE
BubbleType Bubble::GetType()
const {
return m_type; }
123 KY_INLINE
bool Bubble::IsInitialized()
const {
return m_rotationDirection != UninitializedRotationDirection; }
128 return ComputeBiTangent(arrivalBubble, biTangentStart, biTangentEnd, unused);
130 KY_INLINE FunnelSide Bubble::GetFunnelSide()
const
132 if (m_type != IntermediaryBubble)
133 return FunnelBothSides;
136 (m_rotationDirection == Clockwise ) ? FunnelRight :
137 (m_rotationDirection == CounterClockwise) ? FunnelLeft :
138 UndefinedFunnelSide);
143 return ComputeBiTangent(arrivalBubble, biTangentStart, biTangentEnd, unused);
146 inline bool Bubble::operator==(
const Bubble& other)
const
149 m_center == other.m_center &&
150 m_radius == other.m_radius &&
151 m_rotationDirection == other.m_rotationDirection &&
152 m_type == other.m_type ;
157 template <
class OSTREAM>
158 inline OSTREAM& operator<<(OSTREAM& os,
const Bubble& bubble)
160 os <<
"center=" << bubble.GetCenter() <<
" radius=" << bubble.GetRadius() <<
" direction=" << GetRotationDirectionLabel(bubble.GetRotationDirection());
166 #endif // Navigation_Bubble_H
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
KyFloat32 z
The size of the vector along the Z axis.
Definition: vec3f.h:229
KyResult ComputeBiTangentBubble(const Vec3f &tangencyPosition, const Bubble &secondBubble, Vec3f &tangencyPositionOnSecondBubble, Bubble &biTangentBubble) const
Computes the Bubble tangent to this Bubble at the provided position and tangent to arrivalBubble...
KyResult ComputeBiTangent(const Bubble &arrivalBubble, Vec2f &biTangentStart, Vec2f &biTangentEnd, Vec2f &biTangentNormalizedDir) const
Computes the segment starting from this Bubble and arriving on , tangent to both Bubbles and respecti...
static Vec3f Zero()
Returns a vector of zero size: (0,0,0).
Definition: vec3f.h:209
KyResult ComputeTangentBubble(const Vec3f &tangencyPosition, const Vec3f &position, Bubble &tangentBubble) const
Computes the Bubble tangent to this Bubble at the provided tangencyPosition and passing through an ar...
RotationDirection
Defines the 4 possible cases of possibly constrained rotation in the horizontal plane for a given ele...
Definition: rotation.h:20
BubbleType
Defines the type of a bubble accordingly to the place it has in a BubbleArray, a BubbleList, etc.
Definition: bubble.h:26
This class represents a circle with potential rotation limitation.
Definition: bubble.h:35
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
Definition: gamekitcrowddispersion.h:20
ScopedDisplayList is used to push text, lines or shapes for rendering in the NavigationLab e...
Definition: displaylist.h:136
KyResult ComputeBiTangentDirection(const Bubble &arrivalBubble, Vec2f &biTangentDir) const
Computes the normalized direction of the segment starting from this Bubble and arriving on ...
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
void ComputeMedianTurnAxisAndPoint(const Vec2f &entryDir, const Vec2f &exitDir, Vec2f &medianTurnAxis, Vec3f &midPoint) const
Computes median turn axis and position accordingly to provided entry and exit axis.