stuff-from-scratch/src/base/geometry/Rotation.h
2023-01-30 14:53:49 +00:00

45 lines
757 B
C++

#pragma once
#include "Point.h"
#include "Vector.h"
#include "Matrix.h"
class Rotation
{
public:
enum class Axis
{
X,
Y,
Z,
USER
};
Rotation(double angle = 0.0, Axis axis = Axis::Z, const Point3& loc = {}, const Vector3& customAxis = {});
const SquareMatrix3& getMatrix() const;
bool isIdentity() const;
bool isEqual(const Rotation& rotation) const;
bool operator==(const Rotation& rhs) const
{
return isEqual(rhs);
}
bool operator!=(const Rotation& rhs) const
{
return !operator==(rhs);
}
private:
void updateMatrix();
double mAngle{ 0 };
Axis mAxis{ Axis::Z };
Point3 mPoint;
Vector3 mCustomAxis;
SquareMatrix3 mMatrix;
};