libdonut  2.3.2
Application framework for cross-platform game development in C++20
Public Member Functions | Public Attributes | List of all members
donut::Rectangle< T > Struct Template Reference

Flat 2D axis-aligned rectangle shape with a position and size. More...

#include <donut/shapes.hpp>

Public Member Functions

constexpr operator Box< 2, T > () const noexcept
 Convert this rectangle to an equivalent 2D axis-aligned box. More...
 
constexpr bool contains (const Point< 2, T > &point) const noexcept
 Check if a given point is contained within the extents of this rectangle. More...
 

Public Attributes

Point< 2, T > position
 Position of the bottom left corner of the rectangle. More...
 
Length< 2, T > size
 Width and height of the rectangle. More...
 

Detailed Description

template<typename T>
struct donut::Rectangle< T >

Flat 2D axis-aligned rectangle shape with a position and size.

Template Parameters
Tcomponent type for vector coordinates.

Member Function Documentation

◆ operator Box< 2, T >()

template<typename T >
constexpr donut::Rectangle< T >::operator Box< 2, T > ( ) const
inlineconstexprnoexcept

Convert this rectangle to an equivalent 2D axis-aligned box.

Returns
the rectangle as an axis-aligned box.

◆ contains()

template<typename T >
constexpr bool donut::Rectangle< T >::contains ( const Point< 2, T > &  point) const
constexprnoexcept

Check if a given point is contained within the extents of this rectangle.

Returns
true if the rectangle contains the given point, false otherwise.

Member Data Documentation

◆ position

template<typename T >
Point<2, T> donut::Rectangle< T >::position

Position of the bottom left corner of the rectangle.

◆ size

template<typename T >
Length<2, T> donut::Rectangle< T >::size

Width and height of the rectangle.


The documentation for this struct was generated from the following files: