#pragma once #include "Point.h" #include "Vector.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 = {}) { } private: double mAngle{ 0 }; Axis mAxis{ Axis::Z }; Point mPoint; Vector mCustomAxis; }; struct Scale { }; class Transform { public: Transform(const Point& location = {}, double scaleX = 1.0, double scaleY = 1.0, double scaleZ = 1.0); void applyPre(const Transform& transform) { mLocation.move(transform.getLocation().getX(), transform.getLocation().getY(), transform.getLocation().getZ()); mScaleX *= transform.getScaleX(); mScaleY *= transform.getScaleY(); mScaleZ *= transform.getScaleZ(); } void setLocation(const Point& loc); void setScale(double scaleX, double scaleY = 1.0, double scaleZ = 1.0); const Point& getLocation() const; double getScaleX() const; double getScaleY() const; double getScaleZ() const; bool operator==(const Transform& rhs) const { return (mLocation == rhs.mLocation) && (mScaleX == rhs.mScaleX) && (mScaleY == rhs.mScaleY) && (mScaleZ == rhs.mScaleZ); } bool operator!=(const Transform& rhs) const { return !operator==(rhs); } bool hasDefaultLocation() const { return mLocation.getX() == 0.0 && mLocation.getY() == 0.0 && mLocation.getZ() == 0.0; } bool hasDefaultScale() const { return mScaleX == 1.0 && mScaleY == 1.0 && mScaleZ == 1.0; } bool isDefaultTransform() const { return hasDefaultLocation() && hasDefaultScale(); } private: Point mLocation; double mScaleX{1}; double mScaleY{1}; double mScaleZ{1}; };