1 #ifndef UGDK_MATH_GEOMETRY_H_
2 #define UGDK_MATH_GEOMETRY_H_
7 #define GLM_FORCE_RADIANS
30 matrix_(float(scale.x*cos(-rot)), -float(scale.x*sin(-rot)), 0.0f, 0.0f,
31 float(scale.y*sin(-rot)), float(scale.y*cos(-rot)), 0.0f, 0.0f,
32 0.0f, 0.0f, 1.0f, 0.0f,
33 float(offset.x), float(offset.y), 0.0f, 1.0f) {}
50 matrix_[3] = glm::vec4(_offset.
x, _offset.
y, 0.0, 1.0);
54 rotation_ += other.rotation_;
55 matrix_ *= other.matrix_;
74 double c = cos(rotation_);
76 return math::Vector2D( matrix_[0].x / cos(rotation_), matrix_[1].y / cos(rotation_));
78 return math::Vector2D(-matrix_[1].x / sin(rotation_), matrix_[0].y / sin(rotation_));
Definition: vector2D.h:18
Geometry()
Creates an identity Geometry;.
Definition: geometry.h:18
Geometry(const math::Vector2D &offset, const math::Vector2D scale=math::Vector2D(1.0, 1.0), double rot=0.0)
Creates a new Geometry object with the specified values.
Definition: geometry.h:28
double x
Definition: vector2D.h:45
void ChangeOffset(const math::Vector2D &_offset)
Definition: geometry.h:49
math::Vector2D CalculateScale() const
Definition: geometry.h:73
ugdk::math::Vector2D offset() const
Calculates by how much this Geometry translates the rendering.
Definition: geometry.h:41
Definition: animation.h:11
double rotation() const
Definition: geometry.h:38
Geometry operator*(const Geometry &rhs) const
Definition: geometry.h:63
Geometry & operator*=(const Geometry &rhs)
Definition: geometry.h:58
~Geometry()
Definition: geometry.h:36
Definition: geometry.h:15
double y
Definition: vector2D.h:45
void set_offset(const ugdk::math::Vector2D &_offset)
Definition: geometry.h:45
void Compose(const Geometry &other)
Definition: geometry.h:53
const glm::mat4 & AsMat4() const
Definition: geometry.h:69