Gorgon Game Engine
Line< P_ > Class Template Reference

This class represents a set of points. More...

Public Member Functions

 Line ()=default
 Empty constructor. More...
 
 Line (P_ start, P_ end)
 
P_::BaseType MaxX () const
 Returns maximum X point. More...
 
P_::BaseType MaxY () const
 Returns maximum Y point. More...
 
P_::BaseType MinX () const
 Returns minimum X point. More...
 
P_::BaseType MinY () const
 Returns minimum Y point. More...
 
Float Offset () const
 Returns the offset of the line. Assumes the line is 2D. More...
 
Float OffsetInv () const
 Returns the inverse offset of the line, where the line formula is now x = a * y + b. More...
 
Float Slope () const
 Returns the slope of the line. Assumes the line is 2D. More...
 
Float SlopeInv () const
 Returns the inverse slope of the line, where the line formula is now x = a * y + b. More...
 
int XDirection () const
 Returns whether the line is moving left or right. More...
 
int YDirection () const
 Returns whether the line is moving up or down. More...
 

Public Attributes

P_ End
 Ending point of the line. More...
 
P_ Start
 Starting point of the line. More...
 

Detailed Description

template<class P_ = Pointf>
class Gorgon::Geometry::Line< P_ >

This class represents a set of points.

This class can be used for contours, line lists, polygons, or even point clouds. Some of the functions may be meaningful for some of these uses.

Constructor & Destructor Documentation

◆ Line() [1/2]

Line ( )
default

Empty constructor.

◆ Line() [2/2]

Line ( P_  start,
P_  end 
)

Member Function Documentation

◆ MaxX()

P_::BaseType MaxX ( ) const

Returns maximum X point.

References Line< P_ >::End, and Line< P_ >::Start.

◆ MaxY()

P_::BaseType MaxY ( ) const

Returns maximum Y point.

References Line< P_ >::End, and Line< P_ >::Start.

◆ MinX()

P_::BaseType MinX ( ) const

Returns minimum X point.

References Line< P_ >::End, and Line< P_ >::Start.

◆ MinY()

P_::BaseType MinY ( ) const

Returns minimum Y point.

References Line< P_ >::End, and Line< P_ >::Start.

◆ Offset()

Float Offset ( ) const

Returns the offset of the line. Assumes the line is 2D.

References Line< P_ >::Slope(), and Line< P_ >::Start.

◆ OffsetInv()

Float OffsetInv ( ) const

Returns the inverse offset of the line, where the line formula is now x = a * y + b.

References Line< P_ >::SlopeInv(), and Line< P_ >::Start.

◆ Slope()

Float Slope ( ) const

Returns the slope of the line. Assumes the line is 2D.

References Line< P_ >::End, and Line< P_ >::Start.

◆ SlopeInv()

Float SlopeInv ( ) const

Returns the inverse slope of the line, where the line formula is now x = a * y + b.

References Line< P_ >::End, and Line< P_ >::Start.

◆ XDirection()

int XDirection ( ) const

Returns whether the line is moving left or right.

Left movement is -1 right movement is 1 and if line is vertical this function will return 0

References Line< P_ >::End, Gorgon::Sign(), and Line< P_ >::Start.

◆ YDirection()

int YDirection ( ) const

Returns whether the line is moving up or down.

Up movement is -1 down movement is 1 and if line is horizontal this function will return 0

References Line< P_ >::End, Gorgon::Sign(), and Line< P_ >::Start.

Member Data Documentation

◆ End

P_ End

Ending point of the line.

◆ Start

P_ Start

Starting point of the line.


The documentation for this class was generated from the following file: