Guillaume 1.0.0
Guillaume.
Loading...
Searching...
No Matches
Rectangle Class Reference

Represents a rectangle primitive. The Rectangle class is a derived class of Polygon that represents a rectangle shape defined by its width and height. It provides methods to manage the points and render the rectangle. More...

#include <rectangle.hpp>

Inheritance diagram for Rectangle:
Collaboration diagram for Rectangle:

Public Member Functions

 Rectangle (void)
 Default constructor - initializes an square centered at origin with width and height of 1 unit.
 
 ~Rectangle (void) override=default
 Destructor.
 
float getWidth () const
 Accessors.
 
float getHeight () const
 Accessors.
 
RectanglesetDimensions (float width, float height)
 Sets the dimensions of the rectangle.
 
RectanglesetHeight (float height)
 Sets the height of the rectangle.
 
RectanglesetWidth (float width)
 Sets the width of the rectangle.
 
- Public Member Functions inherited from Polygon
 Polygon (void)
 Default constructor - initializes an empty polygon.
 
 Polygon (const std::vector< Vertex > &vertices, const Vector< float, 3 > &rotation=Vector< float, 3 >())
 Constructor from a list of vertices.
 
 ~Polygon (void) override=default
 Destroy the Polygon object.
 
PolygonaddVertex (const Vertex &vertex)
 Adds a vertex to the polygon.
 
const std::vector< Vertex > & getVertices (void) const
 Gets the vertices defining the polygon.
 
const Vector< float, 3 > & getRotation (void) const
 Gets the rotation of the polygon in Euler angles (radians)
 
const Vector< float, 3 > & getTranslation (void) const
 Gets the translation of the polygon in 3D space.
 
PolygonsetRotation (const Vector< float, 3 > &rotation)
 Sets the rotation of the polygon in Euler angles (radians)
 
PolygonsetTranslation (const Vector< float, 3 > &translation)
 Sets the translation of the polygon in 3D space.
 
- Public Member Functions inherited from Primitive
 Primitive (void)
 Constructs a Primitive object.
 
virtual ~Primitive (void)=default
 Destroy the Primitive object.
 

Detailed Description

Represents a rectangle primitive. The Rectangle class is a derived class of Polygon that represents a rectangle shape defined by its width and height. It provides methods to manage the points and render the rectangle.

Member Function Documentation

◆ setDimensions()

Rectangle & Rectangle::setDimensions ( float  width,
float  height 
)
inline

Sets the dimensions of the rectangle.

This method sets the width and height of the rectangle.

Parameters
widthThe width of the rectangle.
heightThe height of the rectangle.
Returns
Reference to the current Rectangle object to allow method chaining

◆ setHeight()

Rectangle & Rectangle::setHeight ( float  height)
inline

Sets the height of the rectangle.

This method sets the height of the rectangle.

Parameters
heightThe height of the rectangle.
Returns
Reference to the current Rectangle object to allow method chaining

◆ setWidth()

Rectangle & Rectangle::setWidth ( float  width)
inline

Sets the width of the rectangle.

This method sets the width of the rectangle.

Parameters
widthThe width of the rectangle.
Returns
Reference to the current Rectangle object to allow method chaining

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