ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Rectangle Class Reference

Represents a rectangle in 2D space. More...

#include <Rectangle.h>

Inheritance diagram for Rectangle:
Collaboration diagram for Rectangle:

Public Member Functions

 Rectangle (Vector2D center, Vector2D size, float rotation)
 Constructs a Rectangle object with specified center, size, and rotation.
 
bool IsInShape (Vector2D point) override
 Checks if a given point lies within the rectangle's boundaries.
 
- Public Member Functions inherited from Shape
 Shape (Vector2D center, Vector2D size, float rotation)
 Constructs a Shape object with specified center, size, and rotation.
 
void SetCenter (Vector2D center)
 Sets the center of the shape.
 
void Translate (Vector2D offset)
 Translates the shape by a given offset.
 
Vector2D GetCenter ()
 Gets the center point of the shape.
 
void SetSize (Vector2D size)
 Sets the size of the shape.
 
void Scale (Vector2D scale)
 Scales the shape by a given factor.
 
Vector2D GetSize ()
 Gets the size of the shape.
 
void SetRotation (float rotation)
 Sets the rotation angle of the shape.
 
void Rotate (float offset)
 Rotates the shape by a given offset angle.
 
float GetRotation ()
 Gets the current rotation angle of the shape.
 

Additional Inherited Members

- Protected Attributes inherited from Shape
Vector2D center
 The center point of the shape.
 
Vector2D size
 The size of the shape, large enough to fit within a bounding rectangle.
 
float rotation
 The rotation of the shape in degrees.
 

Detailed Description

Represents a rectangle in 2D space.

Definition at line 21 of file Rectangle.h.

Constructor & Destructor Documentation

◆ Rectangle()

Rectangle ( Vector2D  center,
Vector2D  size,
float  rotation 
)

Constructs a Rectangle object with specified center, size, and rotation.

Parameters
centerCenter point of the rectangle.
sizeDimensions of the rectangle (width and height).
rotationRotation angle of the rectangle in degrees.

Definition at line 3 of file Rectangle.cpp.

Member Function Documentation

◆ IsInShape()

bool IsInShape ( Vector2D  point)
overridevirtual

Checks if a given point lies within the rectangle's boundaries.

Parameters
pointThe point to check.
Returns
True if the point is within the rectangle, otherwise false.

Implements Shape.

Definition at line 5 of file Rectangle.cpp.

References Shape::center, Mathematics::MPID180, Shape::rotation, Shape::size, Vector2D::X, and Vector2D::Y.


The documentation for this class was generated from the following files: