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

#include <RotatedRect.hpp>

+ Inheritance diagram for Kale::RotatedRect:

Public Member Functions

 RotatedRect ()
 
 RotatedRect (const Vector2f &point1, const Vector2f &point2, const Vector2f &point3, const Vector2f &point4)
 
 RotatedRect (const Vector2f &topLeft, const Vector2f &bottomRight)
 
Vector2f center () 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 point1
 
Vector2f point2
 
Vector2f point3
 
Vector2f point4
 

Detailed Description

Represents a rectangular structure of float vectors

Definition at line 26 of file RotatedRect.hpp.

Constructor & Destructor Documentation

◆ RotatedRect() [1/3]

RotatedRect::RotatedRect ( )

Creates a rectangle with all points at 0, 0

Definition at line 31 of file RotatedRect.cpp.

◆ RotatedRect() [2/3]

RotatedRect::RotatedRect ( const Vector2f & point1,
const Vector2f & point2,
const Vector2f & point3,
const Vector2f & point4 )

Creates a new rectangle given four points. Points must be specified in clockwise order.

Parameters
point1The first point
point2The second point
point3The third point
point4The fourth point

Creates a new rectangle given four points

Parameters
point1The first point
point2The second point
point3The third point
point4The fourth point

Definition at line 42 of file RotatedRect.cpp.

◆ RotatedRect() [3/3]

RotatedRect::RotatedRect ( const Vector2f & point1,
const Vector2f & point3 )

Creates a new rectangle from the topLeft and bottomRight points

Parameters
topLeftThe top left point
bottomRightThe bottom right point

Definition at line 52 of file RotatedRect.cpp.

Member Function Documentation

◆ center()

Vector2f RotatedRect::center ( ) const

Gets the center of the rectangle

Returns
the center of the rectangle

Definition at line 60 of file RotatedRect.cpp.

◆ circleCollision()

bool RotatedRect::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 113 of file RotatedRect.cpp.

◆ getBoundingBox()

Rect RotatedRect::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 68 of file RotatedRect.cpp.

◆ lineCollision()

bool RotatedRect::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 131 of file RotatedRect.cpp.

◆ pointCollision()

bool RotatedRect::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 80 of file RotatedRect.cpp.

◆ rayCollision()

bool RotatedRect::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 122 of file RotatedRect.cpp.

◆ rectCollision() [1/2]

bool RotatedRect::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 104 of file RotatedRect.cpp.

◆ rectCollision() [2/2]

bool RotatedRect::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 92 of file RotatedRect.cpp.

Member Data Documentation

◆ point1

Vector2f Kale::RotatedRect::point1

The first point in the rectangle

Definition at line 31 of file RotatedRect.hpp.

◆ point2

Vector2f Kale::RotatedRect::point2

The second point in the rectangle

Definition at line 36 of file RotatedRect.hpp.

◆ point3

Vector2f Kale::RotatedRect::point3

The third point in the rectangle

Definition at line 41 of file RotatedRect.hpp.

◆ point4

Vector2f Kale::RotatedRect::point4

The fourth point in the rectangle

Definition at line 46 of file RotatedRect.hpp.


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