HerdSoftware  0.1.1
Classes | Public Member Functions | Private Attributes | List of all members
Herd::Line2D Class Reference

Class describing a line in the 2D space. More...

#include <dataobjects/Line2D.h>

Classes

class  Degenerate
 Exception class for invalid operations on a degenerate line. More...
 

Public Member Functions

 Line2D ()
 Default constructor. More...
 
 Line2D (const Point &point, float polar)
 Constructor. More...
 
 Line2D (const Point &point)
 Constructor for degenerate line. More...
 
virtual ~Line2D ()=default
 Virtual destructor. More...
 
float Polar () const
 Returns the angle of the line with respect to the positive abscissa. More...
 
Point Origin () const
 Returns a point on the line. More...
 
Point Intersection (float coo, RefFrame::Axis axis) const
 Returns the line intersection with a given line parallel to one of the main axes, passing for a given coordinate. (Only X (abscissa) and Y (ordinate) axes are allowed) More...
 
bool IsDegenerate () const
 Checks if the line is degenerate. More...
 

Private Attributes

Point _point
 
float _polar
 

Detailed Description

Class describing a line in the 2D space.

This class describes a line in a two dimensional coordinate space. This space can optionally be one of the three main projection layers (XY, XZ, YZ).

Constructor & Destructor Documentation

◆ Line2D() [1/3]

Herd::Line2D::Line2D ( )
inline

Default constructor.

Creates a line with undefined properties.

◆ Line2D() [2/3]

Herd::Line2D::Line2D ( const Point point,
float  polar 
)

Constructor.

Constructs a line passing from a given point in the two-dimensional space and forming a given angle with the abscissa. The given point parameter must have the X and Y coordinates set to the abscissa and ordinate coordinates, respectively; the Z coordinate will be ignored.

Parameters
pointA point on the line (X->abscissa, Y->ordinate, Z->not used, in cm).
polarThe angle between the line and the positive abscissa (rad).

◆ Line2D() [3/3]

Herd::Line2D::Line2D ( const Point point)

Constructor for degenerate line.

This constructor build a special Line2D that does not represent a conventional line in the 2D space, but rather the result of projecting a line on a perpendicular plane. This operation does not produce a line but a point, so the resulting Line2D has a definite origin point but indefinite angle.

Parameters
pointThe A point on the line (X->abscissa, Y->ordinate, Z->not used, in cm).

◆ ~Line2D()

virtual Herd::Line2D::~Line2D ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ Intersection()

Point Herd::Line2D::Intersection ( float  coo,
RefFrame::Axis  axis 
) const

Returns the line intersection with a given line parallel to one of the main axes, passing for a given coordinate. (Only X (abscissa) and Y (ordinate) axes are allowed)

Parameters
cooThe coordinate along the orthogonal axis w.r.t. the desired intersection (cm).
axisThe second line axis.
Returns
The point (X->abscissa, Y->ordinate, Z->not used, in cm) on the line at the given intersection point.
Exceptions
Line2D::Degenerateif the line is degenerate.
See also
Line2D::Line2D(const Point &).

◆ IsDegenerate()

bool Herd::Line2D::IsDegenerate ( ) const
inline

Checks if the line is degenerate.

Returns
true if the line is degenerate.
See also
Line2D::Line2D(const Point &)

◆ Origin()

Point Herd::Line2D::Origin ( ) const
inline

Returns a point on the line.

The returned point lies on line, and together with the angle with the abscissa defines the line.

Returns
a point on the line (X->abscissa, Y->ordinate, Z->not used, in cm).

◆ Polar()

float Herd::Line2D::Polar ( ) const

Returns the angle of the line with respect to the positive abscissa.

If the line object is degenerate then an exception will be thrown.

Returns
the angle between the line and the positive abscissa in the range [0, 2pi] (rad).
Exceptions
Line2D::Degenerateif the line is degenerate.
See also
Line2D::Line2D(const Point &)

Member Data Documentation

◆ _point

Point Herd::Line2D::_point
private

◆ _polar

float Herd::Line2D::_polar
private

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