CVB++ 15.0
Line2D Class Referencefinal

Object representing an infinite line in 2 dimensional space. More...

#include <cvb/line_2d.hpp>

Public Member Functions

 Line2D (Point2D< double > normal, double distance) noexcept
 Create a line object. More...
 
 Line2D (Point2D< double > p1, Point2D< double > p2) noexcept
 Create a line object. More...
 
Point2D< double > Normal () const noexcept
 Gets the normal vector of the line. More...
 
void SetNormal (Point2D< double > normal)
 Sets the normal vector of the line. More...
 
double Distance () const noexcept
 Gets the distance of the line from the origin. More...
 
void SetDistance (double distance) noexcept
 Sets the distance of the line from the origin. More...
 
bool operator== (const Line2D &line) const noexcept
 Compares to an other line. More...
 
bool operator!= (const Line2D &line) const noexcept
 Compares to an other line. More...
 

Detailed Description

Object representing an infinite line in 2 dimensional space.

Constructor & Destructor Documentation

◆ Line2D() [1/2]

Line2D ( Point2D< double >  normal,
double  distance 
)
inlinenoexcept

Create a line object.

Parameters
[in]normalThe normal vector of the line.
[in]distanceDistance between the line and the origin.
Exceptions
Doesnot throw any exception.

◆ Line2D() [2/2]

Line2D ( Point2D< double >  p1,
Point2D< double >  p2 
)
inlinenoexcept

Create a line object.

Parameters
[in]p1The first point the line is supposed to cross.
[in]p2The second point the line is supposed to cross.
Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ Distance()

double Distance ( ) const
inlinenoexcept

Gets the distance of the line from the origin.

Returns
The distance.
Exceptions
Doesnot throw any exception.

◆ Normal()

Point2D< double > Normal ( ) const
inlinenoexcept

Gets the normal vector of the line.

Returns
The normal vector of the line.
Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const Line2D line) const
inlinenoexcept

Compares to an other line.

Parameters
[in]lineOther line.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator==()

bool operator== ( const Line2D line) const
inlinenoexcept

Compares to an other line.

Parameters
[in]lineOther line.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ SetDistance()

void SetDistance ( double  distance)
inlinenoexcept

Sets the distance of the line from the origin.

Parameters
[in]distanceThe distance.
Exceptions
Doesnot throw any exception.

◆ SetNormal()

void SetNormal ( Point2D< double >  normal)
inline

Sets the normal vector of the line.

Parameters
[in]normalThe normal vector - it will automatically normalized to a length of 1.0.
Exceptions
Doesnot throw any exception.