Reviewed some functions to avoid calling other functions
This commit is contained in:
parent
6ef3ab3d3a
commit
58e9a0894f
1 changed files with 10 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**********************************************************************************************
|
/**********************************************************************************************
|
||||||
*
|
*
|
||||||
* raymath v1.2 - Math functions to work with Vector3, Matrix and Quaternions
|
* raymath v1.3 - Math functions to work with Vector3, Matrix and Quaternions
|
||||||
*
|
*
|
||||||
* CONFIGURATION:
|
* CONFIGURATION:
|
||||||
*
|
*
|
||||||
|
@ -488,14 +488,14 @@ RMDEF Vector3 Vector3Normalize(Vector3 v)
|
||||||
{
|
{
|
||||||
Vector3 result = v;
|
Vector3 result = v;
|
||||||
|
|
||||||
float length, ilength;
|
float length, inverseLength;
|
||||||
length = Vector3Length(v);
|
length = sqrtf(v.x*v.x + v.y*v.y + v.z*v.z);
|
||||||
if (length == 0.0f) length = 1.0f;
|
if (length == 0.0f) length = 1.0f;
|
||||||
ilength = 1.0f/length;
|
inverseLength = 1.0f/length;
|
||||||
|
|
||||||
result.x *= ilength;
|
result.x *= inverseLength;
|
||||||
result.y *= ilength;
|
result.y *= inverseLength;
|
||||||
result.z *= ilength;
|
result.z *= inverseLength;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1429,8 +1429,9 @@ RMDEF Matrix QuaternionToMatrix(Quaternion q)
|
||||||
RMDEF Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
|
RMDEF Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
|
||||||
{
|
{
|
||||||
Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f };
|
Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||||
|
float axisLength = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z);
|
||||||
if (Vector3Length(axis) != 0.0f)
|
|
||||||
|
if (axisLength != 0.0f)
|
||||||
{
|
{
|
||||||
angle *= 0.5f;
|
angle *= 0.5f;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue