stuff-from-scratch/src/base/geometry/Rotation.h
2023-01-28 16:58:26 +00:00

45 lines
739 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 Point& loc = {}, const Vector& customAxis = {});
const Matrix& 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 };
Point mPoint;
Vector mCustomAxis;
Matrix mMatrix;
};