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

#include <Line.hpp>

+ Inheritance diagram for Kale::Line:

Public Member Functions

 Line ()
 
 Line (const Vector2f &point1, const Vector2f &point2)
 
Vector2f getNormal () const
 
bool isPerpendicular (Ray ray) const
 
bool isPerpendicular (Line line) const
 
bool isParallel (Ray ray) const
 
bool isParallel (Line line) 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
 

Detailed Description

Represents a line formed by two points

Definition at line 26 of file Line.hpp.

Constructor & Destructor Documentation

◆ Line() [1/2]

Line::Line ( )

Initializes the line from 0, 0 to 0, 0

Definition at line 32 of file Line.cpp.

◆ Line() [2/2]

Line::Line ( const Vector2f & point1,
const Vector2f & point2 )

Creates a new line given the two endpoints

Parameters
point1The first endpoint
point2The second endpoint

Definition at line 41 of file Line.cpp.

Member Function Documentation

◆ circleCollision()

bool Line::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 139 of file Line.cpp.

◆ getBoundingBox()

Rect Line::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 94 of file Line.cpp.

◆ getNormal()

Vector2f Line::getNormal ( ) const

Returns the normal unit vector of the direction of this line

Returns
The normal unit vector

Definition at line 49 of file Line.cpp.

◆ isParallel() [1/2]

bool Line::isParallel ( Line line) const

Checks whether or not the line is parallel with this line

Parameters
lineThe line to check with
Returns
Whether or not the line is parallel with this line

Definition at line 86 of file Line.cpp.

◆ isParallel() [2/2]

bool Line::isParallel ( Ray ray) const

Checks whether or not the ray is parallel with this line

Parameters
rayThe ray to check with
Returns
Whether or not the ray is parallel with this line

Definition at line 77 of file Line.cpp.

◆ isPerpendicular() [1/2]

bool Line::isPerpendicular ( Line line) const

Checks whether or not the line is perpendicular with this line

Parameters
lineThe line to check with
Returns
Whether or not the line is perpendicular with this line

Definition at line 68 of file Line.cpp.

◆ isPerpendicular() [2/2]

bool Line::isPerpendicular ( Ray ray) const

Checks whether or not the ray is perpendicular with this line

Parameters
rayThe ray to check with
Returns
Whether or not the ray is perpendicular with this line

Definition at line 59 of file Line.cpp.

◆ lineCollision()

bool Line::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 157 of file Line.cpp.

◆ pointCollision()

bool Line::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 106 of file Line.cpp.

◆ rayCollision()

bool Line::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 148 of file Line.cpp.

◆ rectCollision() [1/2]

bool Line::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 128 of file Line.cpp.

◆ rectCollision() [2/2]

bool Line::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 117 of file Line.cpp.

Member Data Documentation

◆ point1

Vector2f Kale::Line::point1

The first point of the line

Definition at line 31 of file Line.hpp.

◆ point2

Vector2f Kale::Line::point2

The second point of the line

Definition at line 36 of file Line.hpp.


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