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

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

#include <dataobjects/Line.h>

Classes

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

Public Member Functions

 Line ()
 Default Constructor. More...
 
 Line (const Line &other)=default
 Default copy constructor. More...
 
 Line (Line &&other)=default
 Default move constructor. More...
 
Lineoperator= (const Line &other)=default
 Default copy assignment. More...
 
Lineoperator= (Line &&other)=default
 Default move assignment. More...
 
 Line (Point point, Vec3D direction)
 Constructor. More...
 
 Line (const Point &point, float polar, float azimuth)
 Constructor. More...
 
 Line (const Line2D &proj1, RefFrame::View view1, const Line2D &proj2, RefFrame::View view2)
 Constructor. More...
 
virtual ~Line ()=default
 Virtual destructor. More...
 
float Polar () const
 Returns the polar angle of the line with respect to the NEGATIVE Z axis. More...
 
float Azimuth () const
 Returns the azimuth angle of the line. More...
 
Point Origin () const
 Returns the "point of origin" of the line. More...
 
Vec3D Direction () const
 Returns direction of the line. More...
 
Point Intersection (RefFrame::Axis axis, float coo) const
 Returns the line coordinate at given plane, defined by its normal axis and the coordinate along that axis. More...
 
Point Intersection (const Line &line) const
 Returns the coordinate of the vertex between two lines: the intersection point if the lines are secant and the point at the midle of the minimal segment between the two lines if they are not secant. More...
 
Line Projection (const Plane &plane) const
 Computes the projection of the line on a given plane. More...
 
Line Projection (const Point p, RefFrame::View view) const
 Computes the projection of the line on a given view plane, passing for a given point. More...
 
Line2D Projection2D (RefFrame::View view) const
 Computes the 2D projection of the line on a given view. More...
 
double DistanceToPoint (const Point p) const
 Computes the distance of a point to the line. More...
 
double MinimumDistanceToLine (const Line line) const
 Computes the minimum distance between two lines. More...
 
bool operator== (const Line &rhs) const
 Comparison operators. More...
 
bool operator!= (const Line &rhs) const
 

Private Attributes

Point _point
 
Vec3D _direction
 

Detailed Description

Class describing a line in the 3D space.

Constructor & Destructor Documentation

◆ Line() [1/6]

Herd::Line::Line ( )
inline

Default Constructor.

◆ Line() [2/6]

Herd::Line::Line ( const Line other)
default

Default copy constructor.

◆ Line() [3/6]

Herd::Line::Line ( Line &&  other)
default

Default move constructor.

◆ Line() [4/6]

Herd::Line::Line ( Point  point,
Vec3D  direction 
)
inline

Constructor.

Constructs a line starting from a point and a vector.

Parameters
pointA point on the line [cm].
directionthe direction of the line.

◆ Line() [5/6]

Herd::Line::Line ( const Point point,
float  polar,
float  azimuth 
)

Constructor.

Constructs a line starting from a point and two angles.

Parameters
pointA point on the line [cm].
polarThe polar angle of the line [rad].
azimuthThe azimuth angle of the line [rad].

◆ Line() [6/6]

Herd::Line::Line ( const Line2D proj1,
RefFrame::View  view1,
const Line2D proj2,
RefFrame::View  view2 
)

Constructor.

Constructs a 3D line starting from two 2D projections.

Parameters
proj1The first projection.
view1The view of the first projection.
proj2The second projection.
view1The view of the second projection.

◆ ~Line()

virtual Herd::Line::~Line ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ Azimuth()

float Herd::Line::Azimuth ( ) const
inline

Returns the azimuth angle of the line.

If the line is parallel to the Z axis an exception is thrown

Returns
the azimuth angle (rad) in the range [0,2pi].
Exceptions
Line::Degenerateif the line is parallel to the Z axis.

◆ Direction()

Vec3D Herd::Line::Direction ( ) const
inline

Returns direction of the line.

Returns
the direction vector.

◆ DistanceToPoint()

double Herd::Line::DistanceToPoint ( const Point  p) const

Computes the distance of a point to the line.

Parameters
ppoint
Returns
the distance of the point from the line

◆ Intersection() [1/2]

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

Returns the line coordinate at given plane, defined by its normal axis and the coordinate along that axis.

Parameters
axisThe normal axis of the plane.
cooThe coordinate of the requested point along the normal axis to the plane.
Returns
The coordinate of the line at intersection point.
Exceptions
Degenerateif the line is parallel to the given plane.

◆ Intersection() [2/2]

Point Herd::Line::Intersection ( const Line line) const

Returns the coordinate of the vertex between two lines: the intersection point if the lines are secant and the point at the midle of the minimal segment between the two lines if they are not secant.

Parameters
lineLine to compute the vertex point with
Returns
The coordinate of vertex point with the previous line.
Exceptions
Herd::Exceptionif the two lines are parallel.

◆ MinimumDistanceToLine()

double Herd::Line::MinimumDistanceToLine ( const Line  line) const

Computes the minimum distance between two lines.

Parameters
lineLine
Returns
the minimum distance between the two lines

◆ operator!=()

bool Herd::Line::operator!= ( const Line rhs) const
inline

◆ operator=() [1/2]

Line& Herd::Line::operator= ( const Line other)
default

Default copy assignment.

◆ operator=() [2/2]

Line& Herd::Line::operator= ( Line &&  other)
default

Default move assignment.

◆ operator==()

bool Herd::Line::operator== ( const Line rhs) const
inline

Comparison operators.

Parameters
rhsThe right-hand-side of the comparison operation.
Returns
true if the two Line are equal.

◆ Origin()

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

Returns the "point of origin" of the line.

This is arbitrarily chosen to lie on the line

Returns
the "origin point" (cm, cm).

◆ Polar()

float Herd::Line::Polar ( ) const
inline

Returns the polar angle of the line with respect to the NEGATIVE Z axis.

The angle is 0 for lines whose direction if towards the negative Z axis.

Returns
the polar angle (rad) in the range [0,pi].

◆ Projection() [1/2]

Line Herd::Line::Projection ( const Plane plane) const

Computes the projection of the line on a given plane.

Parameters
planeThe projection plane.
Returns
a The projected line.

◆ Projection() [2/2]

Line Herd::Line::Projection ( const Point  p,
RefFrame::View  view 
) const

Computes the projection of the line on a given view plane, passing for a given point.

Parameters
pThe plane point.
viewThe plane orientation.
Returns
a The projected line.

◆ Projection2D()

Line2D Herd::Line::Projection2D ( RefFrame::View  view) const

Computes the 2D projection of the line on a given view.

Parameters
viewThe projection plane.
Returns
a The projected line.

Member Data Documentation

◆ _direction

Vec3D Herd::Line::_direction
private

◆ _point

Point Herd::Line::_point
private

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