Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Bernal <jbernalmartinez@gmail.com>2015-12-16 03:52:30 +0300
committerJorge Bernal <jbernalmartinez@gmail.com>2015-12-16 03:53:48 +0300
commitee59df521f2af10d6a34158a39bf21dd5ae847a3 (patch)
treef48810bfb9d6df03542517d575d61b46b3584d89 /intern/moto
parent0c19a043e8198018ae794145fc4f1e78d5f00923 (diff)
BGE clean up: use float version of trigonometric functions
Diffstat (limited to 'intern/moto')
-rw-r--r--intern/moto/include/MT_Matrix3x3.h22
-rw-r--r--intern/moto/include/MT_Matrix3x3.inl4
-rw-r--r--intern/moto/include/MT_Quaternion.h16
-rw-r--r--intern/moto/include/MT_Quaternion.inl18
-rw-r--r--intern/moto/include/MT_Vector2.inl6
-rw-r--r--intern/moto/include/MT_Vector3.inl10
-rw-r--r--intern/moto/include/MT_Vector4.inl2
7 files changed, 39 insertions, 39 deletions
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h
index 8832fd56bf4..6f965f59069 100644
--- a/intern/moto/include/MT_Matrix3x3.h
+++ b/intern/moto/include/MT_Matrix3x3.h
@@ -151,12 +151,12 @@ public:
**/
void setEuler(const MT_Vector3& euler) {
- MT_Scalar ci = cos(euler[0]);
- MT_Scalar cj = cos(euler[1]);
- MT_Scalar ch = cos(euler[2]);
- MT_Scalar si = sin(euler[0]);
- MT_Scalar sj = sin(euler[1]);
- MT_Scalar sh = sin(euler[2]);
+ MT_Scalar ci = cosf(euler[0]);
+ MT_Scalar cj = cosf(euler[1]);
+ MT_Scalar ch = cosf(euler[2]);
+ MT_Scalar si = sinf(euler[0]);
+ MT_Scalar sj = sinf(euler[1]);
+ MT_Scalar sh = sinf(euler[2]);
MT_Scalar cc = ci * ch;
MT_Scalar cs = ci * sh;
MT_Scalar sc = si * ch;
@@ -170,19 +170,19 @@ public:
void getEuler(MT_Scalar& yaw, MT_Scalar& pitch, MT_Scalar& roll) const
{
if (m_el[2][0] != -1.0f && m_el[2][0] != 1.0f) {
- pitch = MT_Scalar(-asin(m_el[2][0]));
- yaw = MT_Scalar(atan2(m_el[2][1] / cos(pitch), m_el[2][2] / cos(pitch)));
- roll = MT_Scalar(atan2(m_el[1][0] / cos(pitch), m_el[0][0] / cos(pitch)));
+ pitch = MT_Scalar(-asinf(m_el[2][0]));
+ yaw = MT_Scalar(atan2f(m_el[2][1] / cosf(pitch), m_el[2][2] / cosf(pitch)));
+ roll = MT_Scalar(atan2f(m_el[1][0] / cosf(pitch), m_el[0][0] / cosf(pitch)));
}
else {
roll = MT_Scalar(0);
if (m_el[2][0] == -1.0f) {
pitch = (float)MT_PI / 2.0f;
- yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ yaw = MT_Scalar(atan2f(m_el[0][1], m_el[0][2]));
}
else {
pitch = (float)-MT_PI / 2.0f;
- yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ yaw = MT_Scalar(atan2f(m_el[0][1], m_el[0][2]));
}
}
}
diff --git a/intern/moto/include/MT_Matrix3x3.inl b/intern/moto/include/MT_Matrix3x3.inl
index 088c4b098c8..614e4f93a81 100644
--- a/intern/moto/include/MT_Matrix3x3.inl
+++ b/intern/moto/include/MT_Matrix3x3.inl
@@ -9,7 +9,7 @@ GEN_INLINE MT_Quaternion MT_Matrix3x3::getRotation() const {
if (trace > 0.0f)
{
- MT_Scalar s = sqrt(trace + MT_Scalar(1.0f));
+ MT_Scalar s = sqrtf(trace + MT_Scalar(1.0f));
result[3] = s * MT_Scalar(0.5f);
s = MT_Scalar(0.5f) / s;
@@ -28,7 +28,7 @@ GEN_INLINE MT_Quaternion MT_Matrix3x3::getRotation() const {
int j = next[i];
int k = next[j];
- MT_Scalar s = sqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + MT_Scalar(1.0f));
+ MT_Scalar s = sqrtf(m_el[i][i] - m_el[j][j] - m_el[k][k] + MT_Scalar(1.0f));
result[i] = s * MT_Scalar(0.5f);
diff --git a/intern/moto/include/MT_Quaternion.h b/intern/moto/include/MT_Quaternion.h
index b7703fe57d6..6aabb1f2ed4 100644
--- a/intern/moto/include/MT_Quaternion.h
+++ b/intern/moto/include/MT_Quaternion.h
@@ -70,18 +70,18 @@ public:
void setRotation(const MT_Vector3& axis, MT_Scalar mt_angle) {
MT_Scalar d = axis.length();
MT_assert(!MT_fuzzyZero(d));
- MT_Scalar s = sin(mt_angle * MT_Scalar(0.5f)) / d;
+ MT_Scalar s = sinf(mt_angle * MT_Scalar(0.5f)) / d;
setValue(axis[0] * s, axis[1] * s, axis[2] * s,
- cos(mt_angle * MT_Scalar(0.5f)));
+ cosf(mt_angle * MT_Scalar(0.5f)));
}
void setEuler(MT_Scalar yaw, MT_Scalar pitch, MT_Scalar roll) {
- MT_Scalar cosYaw = cos(yaw * MT_Scalar(0.5f));
- MT_Scalar sinYaw = sin(yaw * MT_Scalar(0.5f));
- MT_Scalar cosPitch = cos(pitch * MT_Scalar(0.5f));
- MT_Scalar sinPitch = sin(pitch * MT_Scalar(0.5f));
- MT_Scalar cosRoll = cos(roll * MT_Scalar(0.5f));
- MT_Scalar sinRoll = sin(roll * MT_Scalar(0.5f));
+ MT_Scalar cosYaw = cosf(yaw * MT_Scalar(0.5f));
+ MT_Scalar sinYaw = sinf(yaw * MT_Scalar(0.5f));
+ MT_Scalar cosPitch = cosf(pitch * MT_Scalar(0.5f));
+ MT_Scalar sinPitch = sinf(pitch * MT_Scalar(0.5f));
+ MT_Scalar cosRoll = cosf(roll * MT_Scalar(0.5f));
+ MT_Scalar sinRoll = sinf(roll * MT_Scalar(0.5f));
setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw,
cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw,
sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw,
diff --git a/intern/moto/include/MT_Quaternion.inl b/intern/moto/include/MT_Quaternion.inl
index dcd991096ea..8fe71b7b214 100644
--- a/intern/moto/include/MT_Quaternion.inl
+++ b/intern/moto/include/MT_Quaternion.inl
@@ -29,10 +29,10 @@ GEN_INLINE MT_Quaternion MT_Quaternion::inverse() const {
// pg. 124-132
GEN_INLINE MT_Quaternion MT_Quaternion::random() {
MT_Scalar x0 = MT_random();
- MT_Scalar r1 = sqrt(MT_Scalar(1.0f) - x0), r2 = sqrt(x0);
+ MT_Scalar r1 = sqrtf(MT_Scalar(1.0f) - x0), r2 = sqrtf(x0);
MT_Scalar t1 = (float)MT_2_PI * MT_random(), t2 = (float)MT_2_PI * MT_random();
- MT_Scalar c1 = cos(t1), s1 = sin(t1);
- MT_Scalar c2 = cos(t2), s2 = sin(t2);
+ MT_Scalar c1 = cosf(t1), s1 = sinf(t1);
+ MT_Scalar c2 = cosf(t2), s2 = sinf(t2);
return MT_Quaternion(s1 * r1, c1 * r1, s2 * r2, c2 * r2);
}
@@ -62,14 +62,14 @@ GEN_INLINE MT_Quaternion operator*(const MT_Vector3& w, const MT_Quaternion& q)
GEN_INLINE MT_Scalar MT_Quaternion::angle(const MT_Quaternion& q) const
{
- MT_Scalar s = sqrt(length2() * q.length2());
+ MT_Scalar s = sqrtf(length2() * q.length2());
assert(s != MT_Scalar(0.0f));
s = dot(q) / s;
s = MT_clamp(s, -1.0f, 1.0f);
- return acos(s);
+ return acosf(s);
}
GEN_INLINE MT_Quaternion MT_Quaternion::slerp(const MT_Quaternion& q, const MT_Scalar& t) const
@@ -82,10 +82,10 @@ GEN_INLINE MT_Quaternion MT_Quaternion::slerp(const MT_Quaternion& q, const MT_S
s = -s;
if ((1.0f - s) > 0.0001f)
{
- MT_Scalar theta = acos(s);
- d = MT_Scalar(1.0f) / sin(theta);
- s0 = sin((MT_Scalar(1.0f) - t) * theta);
- s1 = sin(t * theta);
+ MT_Scalar theta = acosf(s);
+ d = MT_Scalar(1.0f) / sinf(theta);
+ s0 = sinf((MT_Scalar(1.0f) - t) * theta);
+ s1 = sinf(t * theta);
}
else
{
diff --git a/intern/moto/include/MT_Vector2.inl b/intern/moto/include/MT_Vector2.inl
index c975558b770..ed16025e733 100644
--- a/intern/moto/include/MT_Vector2.inl
+++ b/intern/moto/include/MT_Vector2.inl
@@ -48,7 +48,7 @@ GEN_INLINE MT_Scalar MT_Vector2::dot(const MT_Vector2& vv) const {
}
GEN_INLINE MT_Scalar MT_Vector2::length2() const { return dot(*this); }
-GEN_INLINE MT_Scalar MT_Vector2::length() const { return sqrt(length2()); }
+GEN_INLINE MT_Scalar MT_Vector2::length() const { return sqrtf(length2()); }
GEN_INLINE MT_Vector2 MT_Vector2::absolute() const {
return MT_Vector2(MT_abs(m_co[0]), MT_abs(m_co[1]));
@@ -68,9 +68,9 @@ GEN_INLINE MT_Vector2 MT_Vector2::scaled(MT_Scalar xx, MT_Scalar yy) const {
}
GEN_INLINE MT_Scalar MT_Vector2::angle(const MT_Vector2& vv) const {
- MT_Scalar s = sqrt(length2() * vv.length2());
+ MT_Scalar s = sqrtf(length2() * vv.length2());
MT_assert(!MT_fuzzyZero(s));
- return acos(dot(vv) / s);
+ return acosf(dot(vv) / s);
}
diff --git a/intern/moto/include/MT_Vector3.inl b/intern/moto/include/MT_Vector3.inl
index 8a2328fa295..7994bf7c55c 100644
--- a/intern/moto/include/MT_Vector3.inl
+++ b/intern/moto/include/MT_Vector3.inl
@@ -52,7 +52,7 @@ GEN_INLINE MT_Scalar MT_Vector3::dot(const MT_Vector3& v) const {
}
GEN_INLINE MT_Scalar MT_Vector3::length2() const { return dot(*this); }
-GEN_INLINE MT_Scalar MT_Vector3::length() const { return sqrt(length2()); }
+GEN_INLINE MT_Scalar MT_Vector3::length() const { return sqrtf(length2()); }
GEN_INLINE MT_Vector3 MT_Vector3::absolute() const {
return MT_Vector3(MT_abs(m_co[0]), MT_abs(m_co[1]), MT_abs(m_co[2]));
@@ -93,9 +93,9 @@ GEN_INLINE MT_Vector3 MT_Vector3::scaled(MT_Scalar xx, MT_Scalar yy, MT_Scalar z
}
GEN_INLINE MT_Scalar MT_Vector3::angle(const MT_Vector3& v) const {
- MT_Scalar s = sqrt(length2() * v.length2());
+ MT_Scalar s = sqrtf(length2() * v.length2());
MT_assert(!MT_fuzzyZero(s));
- return acos(dot(v) / s);
+ return acosf(dot(v) / s);
}
GEN_INLINE MT_Vector3 MT_Vector3::cross(const MT_Vector3& v) const {
@@ -117,9 +117,9 @@ GEN_INLINE int MT_Vector3::closestAxis() const {
GEN_INLINE MT_Vector3 MT_Vector3::random() {
MT_Scalar z = MT_Scalar(2.0f) * MT_random() - MT_Scalar(1.0f);
- MT_Scalar r = sqrt(MT_Scalar(1.0f) - z * z);
+ MT_Scalar r = sqrtf(MT_Scalar(1.0f) - z * z);
MT_Scalar t = (float)MT_2_PI * MT_random();
- return MT_Vector3(r * cos(t), r * sin(t), z);
+ return MT_Vector3(r * cosf(t), r * sinf(t), z);
}
GEN_INLINE MT_Scalar MT_dot(const MT_Vector3& v1, const MT_Vector3& v2) {
diff --git a/intern/moto/include/MT_Vector4.inl b/intern/moto/include/MT_Vector4.inl
index 1196745e4be..5b6e6766416 100644
--- a/intern/moto/include/MT_Vector4.inl
+++ b/intern/moto/include/MT_Vector4.inl
@@ -48,7 +48,7 @@ GEN_INLINE MT_Scalar MT_Vector4::dot(const MT_Vector4& v) const {
}
GEN_INLINE MT_Scalar MT_Vector4::length2() const { return MT_dot(*this, *this); }
-GEN_INLINE MT_Scalar MT_Vector4::length() const { return sqrt(length2()); }
+GEN_INLINE MT_Scalar MT_Vector4::length() const { return sqrtf(length2()); }
GEN_INLINE MT_Vector4 MT_Vector4::absolute() const {
return MT_Vector4(MT_abs(m_co[0]), MT_abs(m_co[1]), MT_abs(m_co[2]), MT_abs(m_co[3]));