Daniele Bartolini 8 лет назад
Родитель
Сommit
2535235032
5 измененных файлов с 11 добавлено и 5 удалено
  1. 7 1
      src/core/math/math.h
  2. 1 1
      src/core/math/quaternion.h
  3. 1 1
      src/core/math/vector2.h
  4. 1 1
      src/core/math/vector3.h
  5. 1 1
      src/core/math/vector4.h

+ 7 - 1
src/core/math/math.h

@@ -53,7 +53,13 @@ inline f32 ffract(f32 a)
 /// Returns the absolute value of @a a.
 inline f32 fabs(f32 a)
 {
-	return ::fabs(a);
+	return ::fabsf(a);
+}
+
+/// Returns the arc cosine of @a a.
+inline f32 facos(f32 a)
+{
+	return ::acosf(a);
 }
 
 /// Returns @a deg in radians.

+ 1 - 1
src/core/math/quaternion.h

@@ -133,7 +133,7 @@ inline Quaternion power(const Quaternion& q, f32 exp)
 {
 	if (fabs(q.w) < 0.9999)
 	{
-		const f32 alpha = acos(q.w); // alpha = theta/2
+		const f32 alpha = facos(q.w); // alpha = theta/2
 		const f32 new_alpha = alpha * exp;
 		const f32 mult = sinf(new_alpha) / sinf(alpha);
 

+ 1 - 1
src/core/math/vector2.h

@@ -140,7 +140,7 @@ inline f32 distance(const Vector2& a, const Vector2& b)
 /// Returns the angle between the vectors @a a and @a b.
 inline f32 angle(const Vector2& a, const Vector2& b)
 {
-	return acos(dot(a, b) / (length(a) * length(b)));
+	return facos(dot(a, b) / (length(a) * length(b)));
 }
 
 /// Returns a vector that contains the largest value for each element from @a a and @a b.

+ 1 - 1
src/core/math/vector3.h

@@ -157,7 +157,7 @@ inline f32 distance(const Vector3& a, const Vector3& b)
 /// Returns the angle between the vectors @a a and @a b.
 inline f32 angle(const Vector3& a, const Vector3& b)
 {
-	return acos(dot(a, b) / (length(a) * length(b)));
+	return facos(dot(a, b) / (length(a) * length(b)));
 }
 
 /// Returns a vector that contains the largest value for each element from @a a and @a b.

+ 1 - 1
src/core/math/vector4.h

@@ -158,7 +158,7 @@ inline f32 distance(const Vector4& a, const Vector4& b)
 /// Returns the angle between the vectors @a a and @a b.
 inline f32 angle(const Vector4& a, const Vector4& b)
 {
-	return acos(dot(a, b) / (length(a) * length(b)));
+	return facos(dot(a, b) / (length(a) * length(b)));
 }
 
 /// Returns a vector that contains the largest value for each element from @a a and @a b.