Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/axis.cc')
-rw-r--r--src/math/axis.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/math/axis.cc b/src/math/axis.cc
index 31ba26a..402b2f6 100644
--- a/src/math/axis.cc
+++ b/src/math/axis.cc
@@ -30,7 +30,7 @@ void Axis::clear()
void Axis::assign(const Axis & other)
{
- for (size_t i=0; i < 3; i++) {
+ for (size_t i = 0; i < 3; i++) {
axis_vector[i].assign(other.axis_vector[i]);
}
}
@@ -46,10 +46,10 @@ void Axis::change_direction(const float angle)
{
float cosa = cosf(angle * M_PI / 180.0f);
float sina = sinf(angle * M_PI / 180.0f);
-
+
Vector3f forward = axis_vector[0] * cosa + axis_vector[1] * sina;
- Vector3f left = axis_vector[1] *cosa - axis_vector[0] * sina;
-
+ Vector3f left = axis_vector[1] * cosa - axis_vector[0] * sina;
+
axis_vector[0].assign(forward);
axis_vector[1].assign(left);
}
@@ -59,10 +59,10 @@ void Axis::change_pitch(const float angle)
{
float cosa = cosf(angle * M_PI / 180.0f);
float sina = sinf(angle * M_PI / 180.0f);
-
+
Vector3f forward = axis_vector[0] * cosa + axis_vector[2] * sina;
Vector3f up = axis_vector[2] * cosa - axis_vector[0] * sina;
-
+
axis_vector[0].assign(forward);
axis_vector[2].assign(up);
}
@@ -72,10 +72,10 @@ void Axis::change_roll(const float angle)
{
float cosa = cosf(angle * M_PI / 180.0f);
float sina = sinf(angle * M_PI / 180.0f);
-
+
Vector3f forward = axis_vector[2] * cosa + axis_vector[1] * sina;
Vector3f up = axis_vector[1] * cosa - axis_vector[2] * sina;
-
+
axis_vector[2].assign(forward);
axis_vector[1].assign(up);
}
@@ -88,19 +88,19 @@ void Axis::rotate(Vector3f const &normal, float angle)
{
float cosa = cosf(angle);
float sina = sinf(angle);
-
- for (size_t i =0; i < 3; i++) {
+
+ for (size_t i = 0; i < 3; i++) {
axis_vector[i] =
- axis_vector[i]*cosa +
+ axis_vector[i] * cosa +
normal * dotproduct(normal, axis_vector[i]) * (1 - cosa) +
- crossproduct(axis_vector[i], normal)*sina;
+ crossproduct(axis_vector[i], normal) * sina;
}
}
const Axis Axis::transpose() const
{
Axis t;
-
+
for (size_t i = 0; i < 3; i++)
for (size_t j = 0; j < 3; j++)
t.axis_vector[i][j] = axis_vector[j][i];