Changeset 336 in flair-src
- Timestamp:
- Oct 8, 2019, 4:41:35 PM (5 years ago)
- Location:
- trunk/lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/Euler.cpp
r157 r336 81 81 */ 82 82 void Euler::ToQuaternion(Quaternion &quaternion) const { 83 quaternion.q0 = cos (yaw / 2) * cos(pitch / 2) * cos(roll / 2) +84 sin (yaw / 2) * sin(pitch / 2) * sin(roll / 2);83 quaternion.q0 = cosf(yaw / 2.0f) * cosf(pitch / 2.0f) * cosf(roll / 2.0f) + 84 sinf(yaw / 2.0f) * sinf(pitch / 2.0f) * sinf(roll / 2.0f); 85 85 86 quaternion.q1 = cos (yaw / 2) * cos(pitch / 2) * sin(roll / 2) -87 sin (yaw / 2) * sin(pitch / 2) * cos(roll / 2);86 quaternion.q1 = cosf(yaw / 2.0f) * cosf(pitch / 2.0f) * sinf(roll / 2.0f) - 87 sinf(yaw / 2.0f) * sinf(pitch / 2.0f) * cosf(roll / 2.0f); 88 88 89 quaternion.q2 = cos (yaw / 2) * sin(pitch / 2) * cos(roll / 2) +90 sin (yaw / 2) * cos(pitch / 2) * sin(roll / 2);89 quaternion.q2 = cosf(yaw / 2.0f) * sinf(pitch / 2.0f) * cosf(roll / 2.0f) + 90 sinf(yaw / 2.0f) * cosf(pitch / 2.0f) * sinf(roll / 2.0f); 91 91 92 quaternion.q3 = sin (yaw / 2) * cos(pitch / 2) * cos(roll / 2) -93 cos (yaw / 2) * sin(pitch / 2) * sin(roll / 2);92 quaternion.q3 = sinf(yaw / 2.0f) * cosf(pitch / 2.0f) * cosf(roll / 2.0f) - 93 cosf(yaw / 2.0f) * sinf(pitch / 2.0f) * sinf(roll / 2.0f); 94 94 } 95 95 -
trunk/lib/FlairCore/src/Quaternion.cpp
r167 r336 39 39 40 40 float Quaternion::GetNorm(void) const { 41 return sqrt (q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3);41 return sqrtf(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3); 42 42 } 43 43 … … 94 94 } 95 95 96 float Quaternion::GetEulerRoll(void) const { 97 return atan2f(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1 * q1 + q2 * q2)); 98 } 99 100 101 float Quaternion::GetEulerPitch(void) const { 102 return asinf(2 * (q0 * q2 - q1 * q3)); 103 } 104 105 106 float Quaternion::GetEulerYaw(void) const { 107 return atan2f(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3)); 108 } 109 96 110 void Quaternion::ToEuler(Euler &euler) const { 97 euler.roll = atan2(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1 * q1 + q2 * q2));98 euler.pitch = asin(2 * (q0 * q2 - q1 * q3));99 euler.yaw = atan2(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3));111 euler.roll = GetEulerRoll(); 112 euler.pitch = GetEulerPitch(); 113 euler.yaw = GetEulerYaw(); 100 114 } 101 115 -
trunk/lib/FlairCore/src/Quaternion.h
r167 r336 115 115 */ 116 116 Euler ToEuler(void) const; 117 118 /*! 119 * \brief Get roll euler angle 120 * 121 * \return roll euler angle 122 */ 123 float GetEulerRoll(void) const; 124 125 /*! 126 * \brief Get pitch euler angle 127 * 128 * \return pitch euler angle 129 */ 130 float GetEulerPitch(void) const; 131 132 /*! 133 * \brief Get yaw euler angle 134 * 135 * \return yaw euler angle 136 */ 137 float GetEulerYaw(void) const; 117 138 118 139 /*! -
trunk/lib/FlairCore/src/Vector2D.cpp
r167 r336 92 92 template <typename T> void Vector2D<T>::RotateDeg(float value) { Rotate(Euler::ToRadian(value)); } 93 93 94 template <typename T> float Vector2D<T>::GetNorm(void) const { return sqrt (x * x + y * y); }94 template <typename T> float Vector2D<T>::GetNorm(void) const { return sqrtf(x * x + y * y); } 95 95 96 96 template <typename T> void Vector2D<T>::Normalize(void) { -
trunk/lib/FlairCore/src/Vector3D.cpp
r167 r336 218 218 } 219 219 220 template <typename T> float Vector3D<T>::GetNorm(void) const { return sqrt (x * x + y * y + z * z); }220 template <typename T> float Vector3D<T>::GetNorm(void) const { return sqrtf(x * x + y * y + z * z); } 221 221 222 222 template <typename T> void Vector3D<T>::Normalize(void) { -
trunk/lib/FlairFilter/src/JoyReference_impl.cpp
r318 r336 174 174 Vector3Df e_bar = theta_xy; 175 175 e_bar.Normalize(); 176 Quaternion q_xy(cos (theta_xy.GetNorm() / 2.0f),177 e_bar.x * sin (theta_xy.GetNorm() / 2.0f),178 e_bar.y * sin (theta_xy.GetNorm() / 2.0f), 0);176 Quaternion q_xy(cosf(theta_xy.GetNorm() / 2.0f), 177 e_bar.x * sinf(theta_xy.GetNorm() / 2.0f), 178 e_bar.y * sinf(theta_xy.GetNorm() / 2.0f), 0); 179 179 q_xy.Normalize(); 180 180 -
trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp
r318 r336 72 72 73 73 // configure trajectory 74 angle_off = atan2 (start_pos.y - pos_off.y, start_pos.x - pos_off.x);74 angle_off = atan2f(start_pos.y - pos_off.y, start_pos.x - pos_off.x); 75 75 CurrentTime = 0; 76 76 } … … 120 120 if (CurrentTime < V / A) { 121 121 theta = angle_off + A / 2 * CurrentTime * CurrentTime / R; 122 pos.x = R * cos (theta);123 pos.y = R * sin (theta);124 v.x = -A * CurrentTime * sin (theta);125 v.y = A * CurrentTime * cos (theta);122 pos.x = R * cosf(theta); 123 pos.y = R * sinf(theta); 124 v.x = -A * CurrentTime * sinf(theta); 125 v.y = A * CurrentTime * cosf(theta); 126 126 } else { 127 127 if (!is_finishing) { 128 128 theta = 129 129 angle_off + V * V / (2 * A * R) + (CurrentTime - V / A) * V / R; 130 pos.x = R * cos (theta);131 pos.y = R * sin (theta);132 v.x = -V * sin (theta);133 v.y = V * cos (theta);130 pos.x = R * cosf(theta); 131 pos.y = R * sinf(theta); 132 v.x = -V * sinf(theta); 133 v.y = V * cosf(theta); 134 134 } else { 135 135 theta = angle_off + V * V / (2 * A * R) + … … 138 138 (FinishTime - CurrentTime) / R + 139 139 V * (CurrentTime - FinishTime) / R; 140 pos.x = R * cos (theta);141 pos.y = R * sin (theta);142 v.x = -(V + A * (FinishTime - CurrentTime)) * sin (theta);143 v.y = (V + A * (FinishTime - CurrentTime)) * cos (theta);140 pos.x = R * cosf(theta); 141 pos.y = R * sinf(theta); 142 v.x = -(V + A * (FinishTime - CurrentTime)) * sinf(theta); 143 v.y = (V + A * (FinishTime - CurrentTime)) * cosf(theta); 144 144 } 145 145 } -
trunk/lib/FlairSensorActuator/src/HostEthController.cpp
r290 r336 90 90 for (unsigned int i = 0; i < axisNumber; i++) { 91 91 // Start a new row or add up to the current row? We try to keep a 4/3 ratio 92 unsigned int columns = sqrt (4.0 * axisNumber / 3.0);92 unsigned int columns = sqrtf(4.0 * axisNumber / 3.0); 93 93 LayoutPosition *position; 94 94 if (i % columns == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.