Fix code style

This commit is contained in:
Wojtek Figat
2020-12-30 11:20:37 +01:00
parent 4ec3e6aed9
commit 4c205be617
56 changed files with 608 additions and 1139 deletions

View File

@@ -3,6 +3,46 @@
#include "Math.h"
#include "Vector3.h"
void Math::SinCos(float angle, float& sine, float& cosine)
{
sine = sin(angle);
cosine = cos(angle);
}
uint32 Math::FloorLog2(uint32 value)
{
// References:
// http://codinggorilla.domemtech.com/?p=81
// http://en.wikipedia.org/wiki/Binary_logarithm
uint32 pos = 0;
if (value >= 1 << 16)
{
value >>= 16;
pos += 16;
}
if (value >= 1 << 8)
{
value >>= 8;
pos += 8;
}
if (value >= 1 << 4)
{
value >>= 4;
pos += 4;
}
if (value >= 1 << 2)
{
value >>= 2;
pos += 2;
}
if (value >= 1 << 1)
{
pos += 1;
}
return value == 0 ? 0 : pos;
}
Vector3 Math::RotateAboutAxis(const Vector3& normalizedRotationAxis, float angle, const Vector3& positionOnAxis, const Vector3& position)
{
// Project position onto the rotation axis and find the closest point on the axis to Position