ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Shape.cpp
Go to the documentation of this file.
1#include "Shape.h"
2
3Shape::Shape(Vector2D center, Vector2D size, float rotation)
4 : center(center), size(size), rotation(rotation) {
5}
6
8 this->center = center;
9}
10
12 this->center = center + offset;
13}
14
16 return center;
17}
18
20 this->size = size;
21}
22
24 this->size = size * scale;
25}
26
28 return size;
29}
30
31void Shape::SetRotation(float rotation) {
32 this->rotation = rotation;
33}
34
35void Shape::Rotate(float offset) {
36 this->rotation = rotation + offset;
37}
38
40 return rotation;
41}
Defines the Shape base class for representing geometric shapes in 2D space.
float GetRotation()
Gets the current rotation angle of the shape.
Definition Shape.cpp:39
Vector2D GetCenter()
Gets the center point of the shape.
Definition Shape.cpp:15
void Translate(Vector2D offset)
Translates the shape by a given offset.
Definition Shape.cpp:11
float rotation
The rotation of the shape in degrees.
Definition Shape.h:26
void Scale(Vector2D scale)
Scales the shape by a given factor.
Definition Shape.cpp:23
void SetRotation(float rotation)
Sets the rotation angle of the shape.
Definition Shape.cpp:31
Vector2D GetSize()
Gets the size of the shape.
Definition Shape.cpp:27
void Rotate(float offset)
Rotates the shape by a given offset angle.
Definition Shape.cpp:35
void SetSize(Vector2D size)
Sets the size of the shape.
Definition Shape.cpp:19
void SetCenter(Vector2D center)
Sets the center of the shape.
Definition Shape.cpp:7
Shape(Vector2D center, Vector2D size, float rotation)
Constructs a Shape object with specified center, size, and rotation.
Definition Shape.cpp:3
Vector2D center
The center point of the shape.
Definition Shape.h:24
Vector2D size
The size of the shape, large enough to fit within a bounding rectangle.
Definition Shape.h:25
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27