|
HerdSoftware
0.4.0
|
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 Line2D &other)=default | |
| Default copy constructor. More... | |
| Line2D (Line2D &&other)=default | |
| Default move constructor. More... | |
| Line2D & | operator= (const Line2D &other)=default |
| Default copy assignment. More... | |
| Line2D & | operator= (Line2D &&other)=default |
| Default move assignment. 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... | |
| std::optional< 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... | |
| bool | operator== (const Line2D &rhs) const |
| Comparison operator. More... | |
Private Attributes | |
| Point | _point |
| float | _polar |
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).
|
inline |
Default constructor.
Creates a line with undefined properties.
|
default |
Default copy constructor.
|
default |
Default move constructor.
| 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.
| point | A point on the line (X->abscissa, Y->ordinate, Z->not used, in cm). |
| polar | The angle between the line and the positive abscissa (rad). |
| 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.
| point | The A point on the line (X->abscissa, Y->ordinate, Z->not used, in cm). |
|
virtualdefault |
Virtual destructor
| std::optional< 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)
| coo | The coordinate along the orthogonal axis w.r.t. the desired intersection (cm). |
| axis | The second line axis. |
|
inline |
Checks if the line is degenerate.
|
inline |
Comparison operator.
| rhs | The right-hand-side of the comparison operation. |
|
inline |
Returns a point on the line.
The returned point lies on line, and together with the angle with the abscissa defines the line.
| 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.
| Line2D::Degenerate | if the line is degenerate. |
|
private |
|
private |
1.8.17