1
This commit is contained in:
parent
3e5ad07a23
commit
9b63b8fee2
31
a8/vec3.cc
31
a8/vec3.cc
@ -5,9 +5,40 @@
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
|
||||
#include <a8/vec3.h>
|
||||
|
||||
namespace a8
|
||||
{
|
||||
|
||||
void Vec3::RotateX(float angle)
|
||||
{
|
||||
Eigen::Vector3f v(x, y, z);
|
||||
v = Eigen::AngleAxisf(angle * 3.1415926f, Eigen::Vector3f::UnitX()) * v;
|
||||
x = v[0];
|
||||
y = v[1];
|
||||
z = v[2];
|
||||
}
|
||||
|
||||
void Vec3::RotateY(float angle)
|
||||
{
|
||||
Eigen::Vector3f v(x, y, z);
|
||||
v = Eigen::AngleAxisf(angle * 3.1415926f, Eigen::Vector3f::UnitY()) * v;
|
||||
x = v[0];
|
||||
y = v[1];
|
||||
z = v[2];
|
||||
}
|
||||
|
||||
void Vec3::RotateZ(float angle)
|
||||
{
|
||||
Eigen::Vector3f v(x, y, z);
|
||||
v = Eigen::AngleAxisf(angle * 3.1415926f, Eigen::Vector3f::UnitZ()) * v;
|
||||
x = v[0];
|
||||
y = v[1];
|
||||
z = v[2];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,10 @@ namespace a8
|
||||
float y = 0.0f;
|
||||
float z = 0.0f;
|
||||
|
||||
Vec3(float _x = 0.0f, float _y = 0.0f, float _z = 0.0f):x(_x), y(_y), z(_z) {};
|
||||
Vec3(float _x = 0.0f, float _y = 0.0f, float _z = 0.0f):x(_x), y(_y), z(_z) {};
|
||||
void RotateX(float angle);
|
||||
void RotateY(float angle);
|
||||
void RotateZ(float angle);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user