SaturnRingLibrary 0.9.1
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::Math::Types::Shape Class Referenceabstract

Detailed Description

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:

  • Positional data (center point)
  • Intersection testing framework
  • Containment testing framework

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:

  • Minimal memory footprint (only stores position vector)
  • Virtual methods for shape-specific operations
  • Consistent coordinate system across all shape types
  • Optimized for performance-critical collision detection pipelines

Common derived classes include:

Note
This class uses fixed-point arithmetic for all operations to ensure consistent behavior across platforms and to optimize for Saturn hardware.

#include <shape.hpp>

Inheritance diagram for SRL::Math::Types::Shape:
SRL::Math::Types::AABB SRL::Math::Types::Sphere

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