3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Math::RectangleF Struct Reference

Floating point version of the Rectangle structure, representing an axis-aligned rectangle in 2D space with floating-point precision. It is defined by its top-left corner (X, Y) and its dimensions (Width, Height). More...

#include <Rectangle.hpp>

Public Member Functions

constexpr RectangleF (float x=0, float y=0, float w=0, float h=0)
 Constructs an axis-aligned rectangle with the specified top-left corner and dimensions. If no values are provided, it creates a rectangle at the origin with zero width and height.
 RectangleF (Vector2 min, Vector2 max)
 Creates a rectangle from two points, where 'min' is the top-left corner and 'max' is the bottom-right corner. The width and height are calculated based on these points.
Vector2 TopLeft () const
 The top left corner of the rectangle.
Vector2 TopRight () const
 The top right corner of the rectangle.
Vector2 BottomLeft () const
 The bottom left corner of the rectangle.
Vector2 BottomRight () const
 The bottom right corner of the rectangle.
Vector2 Center () const
 The center point of the rectangle.
bool Contains (Vector2 p) const noexcept
 Does this rectangle contain the specified point p?
float Area () const noexcept
 Returns the area of the rectangle as a floating-point value.
bool operator== (const RectangleF &r) const =default
 Compares this rectangle with another rectangle for equality. Two rectangles are considered equal if they have the same top-left corner and dimensions.
bool operator!= (const RectangleF &r) const =default
 Compares this rectangle with another rectangle for inequality. Two rectangles are considered not equal if they differ in either their top-left corner or dimensions.

Public Attributes

float X
 The X coordinate of the top-left corner of the rectangle.
float Y
 The Y coordinate of the top-left corner of the rectangle.
float Width
 The width of the rectangle.
float Height
 The height of the rectangle.

Detailed Description

Floating point version of the Rectangle structure, representing an axis-aligned rectangle in 2D space with floating-point precision. It is defined by its top-left corner (X, Y) and its dimensions (Width, Height).

Constructor & Destructor Documentation

◆ RectangleF() [1/2]

Engine3DRadSpace.Math::RectangleF::RectangleF ( float x = 0,
float y = 0,
float w = 0,
float h = 0 )
inlineexplicitconstexpr

Constructs an axis-aligned rectangle with the specified top-left corner and dimensions. If no values are provided, it creates a rectangle at the origin with zero width and height.

Parameters
xThe X coordinate of the top-left corner of the rectangle.
yThe Y coordinate of the top-left corner of the rectangle.
wThe width of the rectangle.
hThe height of the rectangle.

◆ RectangleF() [2/2]

Engine3DRadSpace.Math::RectangleF::RectangleF ( Vector2 min,
Vector2 max )
inlineexplicit

Creates a rectangle from two points, where 'min' is the top-left corner and 'max' is the bottom-right corner. The width and height are calculated based on these points.

Parameters
minMinimal point (top-left corner)
maxMaximum point (bottom-right corner)

Member Function Documentation

◆ Area()

float RectangleF::Area ( ) const
noexcept

Returns the area of the rectangle as a floating-point value.

Returns
Width*Height

◆ BottomLeft()

Vector2 RectangleF::BottomLeft ( ) const

The bottom left corner of the rectangle.

Returns
The bottom left corner.

◆ BottomRight()

Vector2 RectangleF::BottomRight ( ) const

The bottom right corner of the rectangle.

Returns
The bottom right corner.

◆ Center()

Vector2 RectangleF::Center ( ) const

The center point of the rectangle.

Returns
The center point.

◆ Contains()

bool RectangleF::Contains ( Vector2 p) const
noexcept

Does this rectangle contain the specified point p?

Parameters
pPoint in floating point precision.
Returns
True if the rectangle contains the point; otherwise, false.

◆ operator!=()

bool Engine3DRadSpace.Math::RectangleF::operator!= ( const RectangleF & r) const
default

Compares this rectangle with another rectangle for inequality. Two rectangles are considered not equal if they differ in either their top-left corner or dimensions.

Parameters
rThe rectangle to compare with.
Returns
True if the rectangles are not equal; otherwise, false.

◆ operator==()

bool Engine3DRadSpace.Math::RectangleF::operator== ( const RectangleF & r) const
default

Compares this rectangle with another rectangle for equality. Two rectangles are considered equal if they have the same top-left corner and dimensions.

Parameters
rThe rectangle to compare with.
Returns
True if the rectangles are equal; otherwise, false.

◆ TopLeft()

Vector2 RectangleF::TopLeft ( ) const

The top left corner of the rectangle.

Returns
The top left corner.

◆ TopRight()

Vector2 RectangleF::TopRight ( ) const

The top right corner of the rectangle.

Returns
The top right corner.

Member Data Documentation

◆ Height

float Engine3DRadSpace.Math::RectangleF::Height

The height of the rectangle.

◆ Width

float Engine3DRadSpace.Math::RectangleF::Width

The width of the rectangle.

◆ X

float Engine3DRadSpace.Math::RectangleF::X

The X coordinate of the top-left corner of the rectangle.

◆ Y

float Engine3DRadSpace.Math::RectangleF::Y

The Y coordinate of the top-left corner of the rectangle.


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