Kale
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Kale::Rect Struct Reference

#include <Rect.hpp>

+ Inheritance diagram for Kale::Rect:

Public Member Functions

 Rect ()
 
 Rect (const Vector2f &topLeft, const Vector2f &bottomRight)
 
Vector2f center () const
 
Vector2f topRight () const
 
Vector2f bottomLeft () const
 
Rect getBoundingBox () const override
 
bool pointCollision (Vector2f point) const override
 
bool rectCollision (RotatedRect rect) const override
 
bool rectCollision (Rect rect) const override
 
bool circleCollision (Circle circle) const override
 
bool rayCollision (Ray ray) const override
 
bool lineCollision (Line line) const override
 

Public Attributes

Vector2f topLeft
 
Vector2f bottomRight
 

Detailed Description

Represents a rectangular structure of float vectors

Definition at line 26 of file Rect.hpp.

Constructor & Destructor Documentation

◆ Rect() [1/2]

Rect::Rect ( )

Creates a rectangle with all points at 0, 0

Definition at line 31 of file Rect.cpp.

◆ Rect() [2/2]

Rect::Rect ( const Vector2f & topLeft,
const Vector2f & bottomRight )

Creates a new rectangle from the topLeft and bottomRight points

Parameters
topLeftThe top left point
bottomRightThe bottom right point

Definition at line 40 of file Rect.cpp.

Member Function Documentation

◆ bottomLeft()

Vector2f Rect::bottomLeft ( ) const

Gets the bottom left point of the rectangle

Returns
the bottom left point of the rectangle

Definition at line 64 of file Rect.cpp.

◆ center()

Vector2f Rect::center ( ) const

Gets the center of the rectangle

Returns
the center of the rectangle

Definition at line 48 of file Rect.cpp.

◆ circleCollision()

bool Rect::circleCollision ( Circle circle) const
overridevirtual

Checks for collision with a circle

Parameters
circleThe circle to check collision for
Returns
True if there is a collision, false for no collision

Implements Kale::Geometry.

Definition at line 108 of file Rect.cpp.

◆ getBoundingBox()

Rect Rect::getBoundingBox ( ) const
overridevirtual

Gets a bounding box for this geometry to check for quick and inaccurate collisions

Returns
The bounding box

Implements Kale::Geometry.

Definition at line 72 of file Rect.cpp.

◆ lineCollision()

bool Rect::lineCollision ( Line line) const
overridevirtual

Checks for collision with a line

Parameters
lineThe line to check collision for
Returns
True if there is a collision, false for no collision

Implements Kale::Geometry.

Definition at line 127 of file Rect.cpp.

◆ pointCollision()

bool Rect::pointCollision ( Vector2f point) const
overridevirtual

Checks for collision with a point

Parameters
pointThe point to check collision for
Returns
True if there is a collision, false for no collision

Implements Kale::Geometry.

Definition at line 81 of file Rect.cpp.

◆ rayCollision()

bool Rect::rayCollision ( Ray ray) const
overridevirtual

Checks for collision with a ray

Parameters
rayThe ray to check collision for
Returns
True if there is a collision, false for no collision

Implements Kale::Geometry.

Definition at line 118 of file Rect.cpp.

◆ rectCollision() [1/2]

bool Rect::rectCollision ( Rect rect) const
overridevirtual

Checks for collision with a rectangle

Parameters
rectThe rectangle to check collision for
Returns
True if there is a collision, false for no collision

Implements Kale::Geometry.

Definition at line 99 of file Rect.cpp.

◆ rectCollision() [2/2]

bool Rect::rectCollision ( RotatedRect rect) const
overridevirtual

Checks for collision with a rectangle

Parameters
rectThe rectangle to check collision for
Returns
True if there is a collision, false for no collision

Implements Kale::Geometry.

Definition at line 90 of file Rect.cpp.

◆ topRight()

Vector2f Rect::topRight ( ) const

Gets the top right point of the rectangle

Returns
the top right point of the rectangle

Definition at line 56 of file Rect.cpp.

Member Data Documentation

◆ bottomRight

Vector2f Kale::Rect::bottomRight

The bottom right point in the rectangle

Definition at line 36 of file Rect.hpp.

◆ topLeft

Vector2f Kale::Rect::topLeft

The top left point in the rectangle

Definition at line 31 of file Rect.hpp.


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