libdonut  2.3.2
Application framework for cross-platform game development in C++20
Classes | Namespaces | Typedefs | Functions
shapes.hpp File Reference
#include <donut/math.hpp>

Go to the source code of this file.

Classes

struct  donut::LineSegment< L, T >
 Generic line segment between two points. More...
 
struct  donut::Sphere< L, T >
 Generic sphere shape with a center and radius. More...
 
struct  donut::Circle< T >
 Flat 2D circle shape with a center and radius. More...
 
struct  donut::Capsule< L, T >
 Generic capsule shape with a center line segment and radius. More...
 
struct  donut::Box< L, T >
 Generic axis-aligned box shape with minimum and maximum extents. More...
 
struct  donut::Rectangle< T >
 Flat 2D axis-aligned rectangle shape with a position and size. More...
 

Namespaces

 donut
 

Typedefs

template<length_t L, typename T >
using donut::Point = vec< L, T >
 Generic point in space. More...
 
template<length_t L, typename T >
using donut::Length = vec< L, T >
 Generic length in space. More...
 

Functions

template<length_t L, typename T >
constexpr Box< L, T > donut::getAabbOf (const LineSegment< L, T > &line) noexcept
 Get the axis-aligned bounding box of a line segment. More...
 
template<length_t L, typename T >
constexpr Box< L, T > donut::getAabbOf (const Sphere< L, T > &sphere) noexcept
 Get the axis-aligned bounding box of a sphere. More...
 
template<typename T >
constexpr Box< 2, T > donut::getAabbOf (const Circle< T > &circle) noexcept
 Get the axis-aligned bounding box of a circle. More...
 
template<length_t L, typename T >
constexpr Box< L, T > donut::getAabbOf (const Capsule< L, T > &capsule) noexcept
 Get the axis-aligned bounding box of a capsule. More...
 
template<length_t L, typename T >
constexpr Box< L, T > donut::getAabbOf (const Box< L, T > &box) noexcept
 Get the axis-aligned bounding box of an axis-aligned box. More...
 
template<typename T >
constexpr Box< 2, T > donut::getAabbOf (const Rectangle< T > &rectangle) noexcept
 Get the axis-aligned bounding box of a rectangle. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Sphere< L, T > &a, const Sphere< L, T > &b) noexcept
 Check if two spheres intersect. More...
 
template<typename T >
constexpr bool donut::intersects (const Circle< T > &a, const Circle< T > &b) noexcept
 Check if two cirlces intersect. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Box< L, T > &a, const Box< L, T > &b) noexcept
 Check if two axis-aligned boxes intersect. More...
 
template<typename T >
constexpr bool donut::intersects (const Rectangle< T > &a, const Rectangle< T > &b) noexcept
 Check if two rectangles intersect. More...
 
template<typename T >
constexpr bool donut::intersects (const Circle< T > &a, const Sphere< 2, T > &b) noexcept
 Check if a circle intersects with a sphere. More...
 
template<typename T >
constexpr bool donut::intersects (const Sphere< 2, T > &a, const Circle< T > &b) noexcept
 Check if a sphere intersects with a circle. More...
 
template<typename T >
constexpr bool donut::intersects (const Rectangle< T > &a, const Box< 2, T > &b) noexcept
 Check if a rectangle intersects with an axis-aligned box. More...
 
template<typename T >
constexpr bool donut::intersects (const Box< 2, T > &a, const Rectangle< T > &b) noexcept
 Check if an axis-aligned box intersects with a rectangle. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Sphere< L, T > &a, const Box< L, T > &b) noexcept
 Check if a sphere intersects with an axis-aligned box. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Box< L, T > &a, const Sphere< L, T > &b) noexcept
 Check if an axis-aligned box intersects with a sphere. More...
 
template<typename T >
constexpr bool donut::intersects (const Circle< T > &a, const Box< 2, T > &b) noexcept
 Check if a circle intersects with an axis-aligned box. More...
 
template<typename T >
constexpr bool donut::intersects (const Box< 2, T > &a, const Circle< T > &b) noexcept
 Check if an axis-aligned box intersects with a circle. More...
 
template<typename T >
constexpr bool donut::intersects (const Sphere< 2, T > &a, const Rectangle< T > &b) noexcept
 Check if a sphere intersects with a rectangle. More...
 
template<typename T >
constexpr bool donut::intersects (const Rectangle< T > &a, const Sphere< 2, T > &b) noexcept
 Check if a rectangle intersects with a sphere. More...
 
template<typename T >
constexpr bool donut::intersects (const Circle< T > &a, const Rectangle< T > &b) noexcept
 Check if a circle intersects with a rectangle. More...
 
template<typename T >
constexpr bool donut::intersects (const Rectangle< T > &a, const Circle< T > &b) noexcept
 Check if a rectangle intersects with a circle. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Sphere< L, T > &a, const Capsule< L, T > &b) noexcept
 Check if a sphere intersects with a capsule. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Capsule< L, T > &a, const Sphere< L, T > &b) noexcept
 Check if a capsule intersects with a sphere. More...
 
template<typename T >
constexpr bool donut::intersects (const Circle< T > &a, const Capsule< 2, T > &b) noexcept
 Check if a circle intersects with a capsule. More...
 
template<typename T >
constexpr bool donut::intersects (const Capsule< 2, T > &a, const Circle< T > &b) noexcept
 Check if a capsule intersects with a circle. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const Sphere< L, T > &a, const LineSegment< L, T > &b) noexcept
 Check if a sphere intersects with a line segment. More...
 
template<length_t L, typename T >
constexpr bool donut::intersects (const LineSegment< L, T > &a, const Sphere< L, T > &b) noexcept
 Check if a line segment intersects with a sphere. More...
 
template<typename T >
constexpr bool donut::intersects (const Circle< T > &a, const LineSegment< 2, T > &b) noexcept
 Check if a circle intersects with a line segment. More...
 
template<typename T >
constexpr bool donut::intersects (const LineSegment< 2, T > &a, const Circle< T > &b) noexcept
 Check if a line segment intersects with a circle. More...