19 #ifndef _OBJECT_POS_SELECTOR_H
20 #define _OBJECT_POS_SELECTOR_H
37 UsedPos(
float sign_,
float size_,
float dist_) :
sign(sign_), size(size_), dist(dist_) { }
49 void AddUsedPos(
float size,
float angle,
float dist);
50 void InitializeAngle();
52 bool FirstAngle(
float& angle);
53 bool NextAngle(
float& angle);
54 bool NextUsedAngle(
float& angle);
56 bool NextPosibleAngle(
float& angle);
58 bool CheckAngle(UsedPosList::value_type
const& nextUsedPos,
float sign,
float angle )
const
60 float angle_step2 = GetAngle(nextUsedPos.second);
62 float next_angle = nextUsedPos.first;
63 if (nextUsedPos.second.sign * sign < 0)
64 next_angle = 2 * float(
M_PI) - next_angle;
66 return std::fabs(angle) + angle_step2 <= next_angle;
79 float angle_step = GetAngle(usedPos.second);
82 angle = usedPos.first * usedPos.second.sign + angle_step *
sign;
84 UsedPosList::value_type
const* nextNode = nextUsedPos(uptype);
88 if (!CheckAngle(*nextNode, sign, angle))
90 m_smallStepOk[uptype] =
false;
96 m_smallStepOk[uptype] =
true;
97 m_smallStepAngle[uptype] = angle;
98 m_smallStepNextUsedPos[uptype] = nextNode;
106 angle = m_smallStepAngle[uptype] + m_anglestep *
sign;
108 if (std::fabs(angle) >
float(
M_PI))
110 m_smallStepOk[uptype] =
false;
114 if (m_smallStepNextUsedPos[uptype])
116 if (std::fabs(angle) >= m_smallStepNextUsedPos[uptype]->first)
118 m_smallStepOk[uptype] =
false;
123 if (!CheckAngle(*m_smallStepNextUsedPos[uptype], sign, angle))
125 m_smallStepOk[uptype] =
false;
131 m_smallStepAngle[uptype] = angle;
136 UsedPosList::value_type
const* nextUsedPos(
UsedPosType uptype);
147 UsedPosList m_UsedPosLists[2];
148 UsedPosList::const_iterator m_nextUsedPos[2];
151 float m_smallStepAngle[2];
152 bool m_smallStepOk[2];
153 UsedPosList::value_type
const* m_smallStepNextUsedPos[2];
bool IsNonBalanced() const
Definition: ObjectPosSelector.h:75
Definition: ObjectPosSelector.h:26
#define M_PI
Definition: Common.h:163
Definition: ObjectPosSelector.h:35
UsedPosType operator~(UsedPosType uptype)
Definition: ObjectPosSelector.h:28
bool NextSmallStepAngle(float sign, UsedPosType uptype, float &angle)
Definition: ObjectPosSelector.h:103
bool CheckOriginal() const
Definition: ObjectPosSelector.h:69
float size
Definition: ObjectPosSelector.h:41
float sign
Definition: ObjectPosSelector.h:39
bool CheckAngle(UsedPosList::value_type const &nextUsedPos, float sign, float angle) const
Definition: ObjectPosSelector.h:58
float m_center_x
Definition: ObjectPosSelector.h:141
float m_anglestep
Definition: ObjectPosSelector.h:145
bool NextAngleFor(UsedPosList::value_type const &usedPos, float sign, UsedPosType uptype, float &angle)
Definition: ObjectPosSelector.h:77
float m_dist
Definition: ObjectPosSelector.h:144
float GetAngle(UsedPos const &usedPos) const
Definition: ObjectPosSelector.h:139
float dist
Definition: ObjectPosSelector.h:42
G3D::int16 y
Definition: Vector2int16.h:38
Definition: ObjectPosSelector.h:26
float acos(float fValue)
Definition: g3dmath.h:633
UsedPosType
Definition: ObjectPosSelector.h:26
#define TC_GAME_API
Definition: Define.h:134
float m_center_y
Definition: ObjectPosSelector.h:142
G3D::int16 x
Definition: Vector2int16.h:37
double sign(double fValue)
Definition: g3dmath.h:669
Definition: ObjectPosSelector.h:33
std::multimap< float, UsedPos > UsedPosList
Definition: ObjectPosSelector.h:45
UsedPos(float sign_, float size_, float dist_)
Definition: ObjectPosSelector.h:37
float m_size
Definition: ObjectPosSelector.h:143