ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Rectangle.h
Go to the documentation of this file.
1/**
2 * @file Rectangle.h
3 * @brief Defines the Rectangle class for representing rectangular shapes in 2D space.
4 *
5 * The Rectangle class provides functionality to define a rectangle by its center, size, and rotation,
6 * and check if a given point lies within the rectangle's boundaries.
7 *
8 * @date 22/12/2024
9 * @version 1.0
10 * @author Coela Can't
11 */
12
13#pragma once
14
15#include "Shape.h"
16
17/**
18 * @class Rectangle
19 * @brief Represents a rectangle in 2D space.
20 */
21class Rectangle : public Shape {
22public:
23 /**
24 * @brief Constructs a Rectangle object with specified center, size, and rotation.
25 * @param center Center point of the rectangle.
26 * @param size Dimensions of the rectangle (width and height).
27 * @param rotation Rotation angle of the rectangle in degrees.
28 */
30
31 /**
32 * @brief Checks if a given point lies within the rectangle's boundaries.
33 * @param point The point to check.
34 * @return True if the point is within the rectangle, otherwise false.
35 */
36 bool IsInShape(Vector2D point) override;
37};
Defines the Shape base class for representing geometric shapes in 2D space.
Represents a rectangle in 2D space.
Definition Rectangle.h:21
bool IsInShape(Vector2D point) override
Checks if a given point lies within the rectangle's boundaries.
Definition Rectangle.cpp:5
Abstract base class for 2D geometric shapes.
Definition Shape.h:22
float rotation
The rotation of the shape in degrees.
Definition Shape.h:26
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