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

Represents a polygon primitive for 3D rendering. More...

#include <polygon.hpp>

Inheritance diagram for Polygon:
Collaboration diagram for Polygon:

Public Member Functions

 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 polygon primitive for 3D rendering.

The Polygon class is a derived class of Primitive that represents a polygon shape defined by a series of 3D vertices. It provides methods to manage the vertices for support 3D rendering.

Constructor & Destructor Documentation

◆ Polygon()

Polygon::Polygon ( const std::vector< Vertex > &  vertices,
const Vector< float, 3 > &  rotation = Vector<float, 3>() 
)
inline

Constructor from a list of vertices.

Initializes the polygon with the specified vertices.

Parameters
verticesA vector of Vertex objects defining the polygon vertices in 3D space

Member Function Documentation

◆ addVertex()

Polygon & Polygon::addVertex ( const Vertex vertex)
inline

Adds a vertex to the polygon.

Parameters
vertexThe Vertex object to add to the polygon
Returns
Reference to the current Polygon object to allow method chaining

◆ getRotation()

const Vector< float, 3 > & Polygon::getRotation ( void  ) const
inline

Gets the rotation of the polygon in Euler angles (radians)

Returns
A const reference to the Vector<float, 3> representing rotation

◆ getTranslation()

const Vector< float, 3 > & Polygon::getTranslation ( void  ) const
inline

Gets the translation of the polygon in 3D space.

Returns
A const reference to the Vector<float, 3> representing translation

◆ getVertices()

const std::vector< Vertex > & Polygon::getVertices ( void  ) const
inline

Gets the vertices defining the polygon.

Returns
A const reference to the vector of Vertex objects

◆ setRotation()

Polygon & Polygon::setRotation ( const Vector< float, 3 > &  rotation)
inline

Sets the rotation of the polygon in Euler angles (radians)

Parameters
rotationA Vector<float, 3> representing the new rotation
Returns
Reference to the current Polygon object to allow method chaining

◆ setTranslation()

Polygon & Polygon::setTranslation ( const Vector< float, 3 > &  translation)
inline

Sets the translation of the polygon in 3D space.

Parameters
translationA Vector<float, 3> representing the new translation
Returns
Reference to the current Polygon object to allow method chaining

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