Base class for geometric shapes in 3D space with common functionality.
The Shape class serves as the foundation for the geometric primitive hierarchy in the SaturnMath library. It provides core functionality that all shapes share:
This abstract base class enables polymorphic usage of different shape types in collision detection systems, spatial partitioning structures, and physics simulations. By inheriting from Shape, derived classes gain consistent interfaces for position manipulation and testing operations.
Key design features:
Common derived classes include:
#include <shape.hpp>
Public Member Functions | |
constexpr | Shape () |
Creates shape at origin (0,0,0). | |
constexpr | Shape (const Vector3D &pos) |
Creates shape at specified position. | |
virtual | ~Shape ()=default |
Virtual destructor for proper cleanup. | |
virtual bool | Contains (const Vector3D &point) const =0 |
Tests if point is inside shape. | |
constexpr Vector3D | GetPosition () const |
Gets shape center position. | |
virtual bool | Intersects (const Plane &plane) const =0 |
Tests intersection with plane. | |
constexpr void | SetPosition (const Vector3D &pos) |
Sets shape center position. | |
Protected Attributes | |
Vector3D | position |