All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
ignition::math::Line3< T > Class Template Reference

A three dimensional line segment. More...

#include <ignition/math/Line3.hh>

Public Member Functions

 Line3 ()=default
 Line Constructor. More...
 
 Line3 (const Line3< T > &_line)
 Copy constructor. More...
 
 Line3 (const math::Vector3< T > &_ptA, const math::Vector3< T > &_ptB)
 Constructor. More...
 
 Line3 (const double _x1, const double _y1, const double _x2, const double _y2)
 2D Constructor where Z coordinates are 0 More...
 
 Line3 (const double _x1, const double _y1, const double _z1, const double _x2, const double _y2, const double _z2)
 Constructor. More...
 
math::Vector3< T > Direction () const
 Get the direction of the line. More...
 
Length () const
 Get the length of the line. More...
 
bool operator!= (const Line3< T > &_line) const
 Inequality operator. More...
 
Line3operator= (const Line3< T > &_line)
 Assignment operator. More...
 
bool operator== (const Line3< T > &_line) const
 Equality operator. More...
 
math::Vector3< T > operator[] (const size_t _index) const
 Get the start or end point. More...
 
void Set (const math::Vector3< T > &_ptA, const math::Vector3< T > &_ptB)
 Set the start and end point of the line segment. More...
 
void Set (const double _x1, const double _y1, const double _x2, const double _y2, const double _z=0)
 Set the start and end point of the line segment, assuming that both points have the same height. More...
 
void Set (const double _x1, const double _y1, const double _z1, const double _x2, const double _y2, const double _z2)
 Set the start and end point of the line segment. More...
 
void SetA (const math::Vector3< T > &_ptA)
 Set the start point of the line segment. More...
 
void SetB (const math::Vector3< T > &_ptB)
 Set the end point of the line segment. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const Line3< T > &_line)
 Stream extraction operator. More...
 

Detailed Description

template<typename T>
class ignition::math::Line3< T >

A three dimensional line segment.

The line is defined by a start and end point.

Constructor & Destructor Documentation

template<typename T>
ignition::math::Line3< T >::Line3 ( )
default

Line Constructor.

template<typename T>
ignition::math::Line3< T >::Line3 ( const Line3< T > &  _line)
inline

Copy constructor.

Parameters
[in]_linea line object
template<typename T>
ignition::math::Line3< T >::Line3 ( const math::Vector3< T > &  _ptA,
const math::Vector3< T > &  _ptB 
)
inline

Constructor.

Parameters
[in]_ptAStart point of the line segment
[in]_ptBEnd point of the line segment

References ignition::math::Line3< T >::Set().

template<typename T>
ignition::math::Line3< T >::Line3 ( const double  _x1,
const double  _y1,
const double  _x2,
const double  _y2 
)
inline

2D Constructor where Z coordinates are 0

Parameters
[in]_x1X coordinate of the start point.
[in]_y1Y coordinate of the start point.
[in]_x2X coordinate of the end point.
[in]_y2Y coordinate of the end point.

References ignition::math::Line3< T >::Set().

template<typename T>
ignition::math::Line3< T >::Line3 ( const double  _x1,
const double  _y1,
const double  _z1,
const double  _x2,
const double  _y2,
const double  _z2 
)
inline

Constructor.

Parameters
[in]_x1X coordinate of the start point.
[in]_y1Y coordinate of the start point.
[in]_z1Z coordinate of the start point.
[in]_x2X coordinate of the end point.
[in]_y2Y coordinate of the end point.
[in]_z2Z coordinate of the end point.

References ignition::math::Line3< T >::Set().

Member Function Documentation

template<typename T>
math::Vector3<T> ignition::math::Line3< T >::Direction ( ) const
inline

Get the direction of the line.

Returns
The direction vector
template<typename T>
T ignition::math::Line3< T >::Length ( ) const
inline

Get the length of the line.

Returns
The length of the line.
template<typename T>
bool ignition::math::Line3< T >::operator!= ( const Line3< T > &  _line) const
inline

Inequality operator.

Parameters
[in]_lineLine to compare for inequality.
Returns
True if the given line is not to this line
template<typename T>
Line3& ignition::math::Line3< T >::operator= ( const Line3< T > &  _line)
inline

Assignment operator.

Parameters
[in]_linea new value
Returns
this
template<typename T>
bool ignition::math::Line3< T >::operator== ( const Line3< T > &  _line) const
inline

Equality operator.

Parameters
[in]_lineLine to compare for equality.
Returns
True if the given line is equal to this line
template<typename T>
math::Vector3<T> ignition::math::Line3< T >::operator[] ( const size_t  _index) const
inline

Get the start or end point.

Parameters
[in]_index0 = start point, 1 = end point.
Exceptions
IndexExceptionif _index is > 1.
template<typename T>
void ignition::math::Line3< T >::Set ( const math::Vector3< T > &  _ptA,
const math::Vector3< T > &  _ptB 
)
inline

Set the start and end point of the line segment.

Parameters
[in]_ptAStart point of the line segment
[in]_ptBEnd point of the line segment

Referenced by ignition::math::Line3< T >::Line3().

template<typename T>
void ignition::math::Line3< T >::Set ( const double  _x1,
const double  _y1,
const double  _x2,
const double  _y2,
const double  _z = 0 
)
inline

Set the start and end point of the line segment, assuming that both points have the same height.

Parameters
[in]_x1X coordinate of the start point.
[in]_y1Y coordinate of the start point.
[in]_x2X coordinate of the end point.
[in]_y2Y coordinate of the end point.
[in]_zZ coordinate of both points, by default _z is set to 0.
template<typename T>
void ignition::math::Line3< T >::Set ( const double  _x1,
const double  _y1,
const double  _z1,
const double  _x2,
const double  _y2,
const double  _z2 
)
inline

Set the start and end point of the line segment.

Parameters
[in]_x1X coordinate of the start point.
[in]_y1Y coordinate of the start point.
[in]_z1Z coordinate of the start point.
[in]_x2X coordinate of the end point.
[in]_y2Y coordinate of the end point.
[in]_z2Z coordinate of the end point.
template<typename T>
void ignition::math::Line3< T >::SetA ( const math::Vector3< T > &  _ptA)
inline

Set the start point of the line segment.

Parameters
[in]_ptAStart point of the line segment
template<typename T>
void ignition::math::Line3< T >::SetB ( const math::Vector3< T > &  _ptB)
inline

Set the end point of the line segment.

Parameters
[in]_ptBEnd point of the line segment

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  _out,
const Line3< T > &  _line 
)
friend

Stream extraction operator.

Parameters
[in]_outoutput stream
[in]_lineLine3 to output
Returns
The stream

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