removed spacing around *, standardizing it.
This commit is contained in:
parent
c21d7b70a9
commit
f85f9d4c4f
|
|
@ -785,7 +785,7 @@ RMAPI Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle)
|
||||||
Vector3 result = v;
|
Vector3 result = v;
|
||||||
|
|
||||||
// Vector3Normalize(axis);
|
// Vector3Normalize(axis);
|
||||||
float length = sqrtf(axis.x * axis.x + axis.y * axis.y + axis.z * axis.z);
|
float length = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z);
|
||||||
if (length == 0.0f) length = 1.0f;
|
if (length == 0.0f) length = 1.0f;
|
||||||
float ilength = 1.0f / length;
|
float ilength = 1.0f / length;
|
||||||
axis.x *= ilength;
|
axis.x *= ilength;
|
||||||
|
|
@ -794,19 +794,19 @@ RMAPI Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle)
|
||||||
|
|
||||||
angle /= 2.0f;
|
angle /= 2.0f;
|
||||||
float a = sinf(angle);
|
float a = sinf(angle);
|
||||||
float b = axis.x * a;
|
float b = axis.x*a;
|
||||||
float c = axis.y * a;
|
float c = axis.y*a;
|
||||||
float d = axis.z * a;
|
float d = axis.z*a;
|
||||||
a = cosf(angle);
|
a = cosf(angle);
|
||||||
Vector3 w = { b, c, d };
|
Vector3 w = { b, c, d };
|
||||||
|
|
||||||
// Vector3CrossProduct(w, v)
|
// Vector3CrossProduct(w, v)
|
||||||
Vector3 wv = { w.y * v.z - w.z * v.y, w.z * v.x - w.x * v.z, w.x * v.y - w.y * v.x };
|
Vector3 wv = { w.y*v.z - w.z*v.y, w.z*v.x - w.x*v.z, w.x*v.y - w.y*v.x };
|
||||||
|
|
||||||
// Vector3CrossProduct(w, wv)
|
// Vector3CrossProduct(w, wv)
|
||||||
Vector3 wwv = { w.y * wv.z - w.z * wv.y, w.z * wv.x - w.x * wv.z, w.x * wv.y - w.y * wv.x };
|
Vector3 wwv = { w.y*wv.z - w.z*wv.y, w.z*wv.x - w.x*wv.z, w.x*wv.y - w.y*wv.x };
|
||||||
|
|
||||||
// Vector3Scale(wv, 2 * a)
|
// Vector3Scale(wv, 2*a)
|
||||||
a *= 2;
|
a *= 2;
|
||||||
wv.x *= a;
|
wv.x *= a;
|
||||||
wv.y *= a;
|
wv.y *= a;
|
||||||
|
|
@ -1906,34 +1906,34 @@ RMAPI Quaternion QuaternionFromMatrix(Matrix mat)
|
||||||
biggestIndex = 3;
|
biggestIndex = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
float biggestVal = sqrtf(fourBiggestSquaredMinus1 + 1.0f) * 0.5f;
|
float biggestVal = sqrtf(fourBiggestSquaredMinus1 + 1.0f)*0.5f;
|
||||||
float mult = 0.25f / biggestVal;
|
float mult = 0.25f / biggestVal;
|
||||||
|
|
||||||
switch (biggestIndex)
|
switch (biggestIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
result.w = biggestVal;
|
result.w = biggestVal;
|
||||||
result.x = (mat.m6 - mat.m9) * mult;
|
result.x = (mat.m6 - mat.m9)*mult;
|
||||||
result.y = (mat.m8 - mat.m2) * mult;
|
result.y = (mat.m8 - mat.m2)*mult;
|
||||||
result.z = (mat.m1 - mat.m4) * mult;
|
result.z = (mat.m1 - mat.m4)*mult;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
result.x = biggestVal;
|
result.x = biggestVal;
|
||||||
result.w = (mat.m6 - mat.m9) * mult;
|
result.w = (mat.m6 - mat.m9)*mult;
|
||||||
result.y = (mat.m1 + mat.m4) * mult;
|
result.y = (mat.m1 + mat.m4)*mult;
|
||||||
result.z = (mat.m8 + mat.m2) * mult;
|
result.z = (mat.m8 + mat.m2)*mult;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
result.y = biggestVal;
|
result.y = biggestVal;
|
||||||
result.w = (mat.m8 - mat.m2) * mult;
|
result.w = (mat.m8 - mat.m2)*mult;
|
||||||
result.x = (mat.m1 + mat.m4) * mult;
|
result.x = (mat.m1 + mat.m4)*mult;
|
||||||
result.z = (mat.m6 + mat.m9) * mult;
|
result.z = (mat.m6 + mat.m9)*mult;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
result.z = biggestVal;
|
result.z = biggestVal;
|
||||||
result.w = (mat.m1 - mat.m4) * mult;
|
result.w = (mat.m1 - mat.m4)*mult;
|
||||||
result.x = (mat.m8 + mat.m2) * mult;
|
result.x = (mat.m8 + mat.m2)*mult;
|
||||||
result.y = (mat.m6 + mat.m9) * mult;
|
result.y = (mat.m6 + mat.m9)*mult;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user