Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitk::Line< TCoordRep, NPointDimension > Class Template Reference

Describes a line. More...

#include <mitkLine.h>

Public Member Functions

 Line ()
 
 Line (const itk::Point< TCoordRep, NPointDimension > &point, const itk::Vector< TCoordRep, NPointDimension > &direction)
 Define line by point and direction. More...
 
const itk::Point< TCoordRep, NPointDimension > & GetPoint () const
 Get start point of the line. More...
 
itk::Point< TCoordRep, NPointDimension > & GetPoint ()
 Get start point of the line. More...
 
const itk::Point< TCoordRep, NPointDimension > GetPoint (TCoordRep t) const
 Get point on the line with parameter t. More...
 
void SetPoint (const itk::Point< TCoordRep, NPointDimension > &point1)
 Set/change start point of the line. More...
 
const itk::Vector< TCoordRep, NPointDimension > & GetDirection () const
 Get the direction vector of the line. More...
 
itk::Vector< TCoordRep, NPointDimension > & GetDirection ()
 Get the direction vector of the line. More...
 
void SetDirection (const itk::Vector< TCoordRep, NPointDimension > &direction)
 Set the direction vector of the line. More...
 
void Set (const itk::Point< TCoordRep, NPointDimension > &point, const itk::Vector< TCoordRep, NPointDimension > &direction)
 Define line by point and direction. More...
 
void SetPoints (const itk::Point< TCoordRep, NPointDimension > &point1, const itk::Point< TCoordRep, NPointDimension > &point2)
 Define line by two points. More...
 
void SetPoint1 (const itk::Point< TCoordRep, NPointDimension > &point1)
 Set/change start point of the line. More...
 
const itk::Point< TCoordRep, NPointDimension > & GetPoint1 () const
 Get start point of the line. More...
 
void SetPoint2 (const itk::Point< TCoordRep, NPointDimension > &point2)
 Set/change end point of the line. More...
 
itk::Point< TCoordRep, NPointDimension > GetPoint2 () const
 Get end point of the line. More...
 
void Transform (itk::Transform< TCoordRep, NPointDimension, NPointDimension > &transform)
 Transform the line with a Transform. More...
 
void Transform (const itk::Matrix< TCoordRep, NPointDimension, NPointDimension > &matrix)
 Transform the line with a matrix. More...
 
double Distance (const itk::Point< TCoordRep, NPointDimension > &point) const
 Distance of a point from the line. More...
 
itk::Point< TCoordRep, NPointDimension > Project (const itk::Point< TCoordRep, NPointDimension > &point) const
 Project a point on the line. More...
 
bool IsPartOfStraightLine (const itk::Point< TCoordRep, NPointDimension > &point) const
 Test if a point is part of the line. More...
 
bool IsPartOfLine (const itk::Point< TCoordRep, NPointDimension > &point) const
 Test if a point is part of the line (line having infinite length) More...
 
bool IsParallel (const Line< TCoordRep, NPointDimension > &line) const
 Test if a lines is parallel to this line. More...
 
bool IsPartOfLine (const Line< TCoordRep, NPointDimension > &line) const
 Test if a line is part of the line (line having infinite length) More...
 
bool operator== (const Line< TCoordRep, NPointDimension > &line) const
 Test if the two lines are identical. More...
 
const Line< TCoordRep, NPointDimension > & operator= (const Line< TCoordRep, NPointDimension > &line)
 Set the line by another line. More...
 
bool operator!= (const Line< TCoordRep, NPointDimension > &line) const
 Test if two lines are not identical. More...
 

Static Public Member Functions

static int RectangleLineIntersection (TCoordRep x1, TCoordRep y1, TCoordRep x2, TCoordRep y2, itk::Point< TCoordRep, 2 > p, itk::Vector< TCoordRep, 2 > d, itk::Point< TCoordRep, 2 > &s1, itk::Point< TCoordRep, 2 > &s2)
 Calculates the intersection points of a straight line in 2D with a rectangle. More...
 
static int BoxLineIntersection (TCoordRep x1, TCoordRep y1, TCoordRep z1, TCoordRep x2, TCoordRep y2, TCoordRep z2, itk::Point< TCoordRep, 3 > p, itk::Vector< TCoordRep, 3 > d, itk::Point< TCoordRep, 3 > &s1, itk::Point< TCoordRep, 3 > &s2)
 Calculates the intersection points of a straight line in 3D with a box. More...
 

Protected Attributes

itk::Point< TCoordRep, NPointDimension > m_Point
 
itk::Vector< TCoordRep, NPointDimension > m_Direction
 

Detailed Description

template<class TCoordRep, unsigned int NPointDimension = 3>
class mitk::Line< TCoordRep, NPointDimension >

Describes a line.

Definition at line 28 of file mitkLine.h.

Constructor & Destructor Documentation

◆ Line() [1/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
mitk::Line< TCoordRep, NPointDimension >::Line ( )
inline

◆ Line() [2/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
mitk::Line< TCoordRep, NPointDimension >::Line ( const itk::Point< TCoordRep, NPointDimension > &  point,
const itk::Vector< TCoordRep, NPointDimension > &  direction 
)
inline

Define line by point and direction.

Length of direction defines the the length of the line

Definition at line 41 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

Member Function Documentation

◆ BoxLineIntersection()

template<class TCoordRep , unsigned int NPointDimension = 3>
static int mitk::Line< TCoordRep, NPointDimension >::BoxLineIntersection ( TCoordRep  x1,
TCoordRep  y1,
TCoordRep  z1,
TCoordRep  x2,
TCoordRep  y2,
TCoordRep  z2,
itk::Point< TCoordRep, 3 >  p,
itk::Vector< TCoordRep, 3 >  d,
itk::Point< TCoordRep, 3 > &  s1,
itk::Point< TCoordRep, 3 > &  s2 
)
inlinestatic

Calculates the intersection points of a straight line in 3D with a box.

Parameters
x1,y1,z1first corner of the box
x2,y2,z2second corner of the box
p,dstraight line: p point on it, d direction of line
s1first intersection point (valid only if s_num>0)
s2second intersection point (valid only if s_num==2)
Returns
number of intersection points (0<=s_num<=2)

Definition at line 346 of file mitkLine.h.

References mitk::eps.

◆ Distance()

template<class TCoordRep , unsigned int NPointDimension = 3>
double mitk::Line< TCoordRep, NPointDimension >::Distance ( const itk::Point< TCoordRep, NPointDimension > &  point) const
inline

◆ GetDirection() [1/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
itk::Vector<TCoordRep, NPointDimension>& mitk::Line< TCoordRep, NPointDimension >::GetDirection ( )
inline

Get the direction vector of the line.

Definition at line 73 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction.

◆ GetDirection() [2/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
const itk::Vector<TCoordRep, NPointDimension>& mitk::Line< TCoordRep, NPointDimension >::GetDirection ( ) const
inline

◆ GetPoint() [1/3]

template<class TCoordRep , unsigned int NPointDimension = 3>
itk::Point<TCoordRep, NPointDimension>& mitk::Line< TCoordRep, NPointDimension >::GetPoint ( )
inline

Get start point of the line.

Definition at line 52 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ GetPoint() [2/3]

template<class TCoordRep , unsigned int NPointDimension = 3>
const itk::Point<TCoordRep, NPointDimension>& mitk::Line< TCoordRep, NPointDimension >::GetPoint ( ) const
inline

◆ GetPoint() [3/3]

template<class TCoordRep , unsigned int NPointDimension = 3>
const itk::Point<TCoordRep, NPointDimension> mitk::Line< TCoordRep, NPointDimension >::GetPoint ( TCoordRep  t) const
inline

Get point on the line with parameter t.

Returns
m_Point+t*m_Direction

Definition at line 57 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ GetPoint1()

template<class TCoordRep , unsigned int NPointDimension = 3>
const itk::Point<TCoordRep, NPointDimension>& mitk::Line< TCoordRep, NPointDimension >::GetPoint1 ( ) const
inline

Get start point of the line.

Definition at line 111 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Point.

Referenced by mitk::Line< TCoordRep, NPointDimension >::operator==().

◆ GetPoint2()

template<class TCoordRep , unsigned int NPointDimension = 3>
itk::Point<TCoordRep, NPointDimension> mitk::Line< TCoordRep, NPointDimension >::GetPoint2 ( ) const
inline

◆ IsParallel()

template<class TCoordRep , unsigned int NPointDimension = 3>
bool mitk::Line< TCoordRep, NPointDimension >::IsParallel ( const Line< TCoordRep, NPointDimension > &  line) const
inline

◆ IsPartOfLine() [1/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
bool mitk::Line< TCoordRep, NPointDimension >::IsPartOfLine ( const itk::Point< TCoordRep, NPointDimension > &  point) const
inline

Test if a point is part of the line (line having infinite length)

Definition at line 191 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::Distance(), and mitk::eps.

◆ IsPartOfLine() [2/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
bool mitk::Line< TCoordRep, NPointDimension >::IsPartOfLine ( const Line< TCoordRep, NPointDimension > &  line) const
inline

Test if a line is part of the line (line having infinite length)

Definition at line 215 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::Distance(), mitk::Line< TCoordRep, NPointDimension >::GetPoint(), and mitk::Line< TCoordRep, NPointDimension >::IsParallel().

◆ IsPartOfStraightLine()

template<class TCoordRep , unsigned int NPointDimension = 3>
bool mitk::Line< TCoordRep, NPointDimension >::IsPartOfStraightLine ( const itk::Point< TCoordRep, NPointDimension > &  point) const
inline

Test if a point is part of the line.

Length of the direction vector defines the length of the line

Definition at line 172 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::Distance(), mitk::eps, mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ operator!=()

template<class TCoordRep , unsigned int NPointDimension = 3>
bool mitk::Line< TCoordRep, NPointDimension >::operator!= ( const Line< TCoordRep, NPointDimension > &  line) const
inline

Test if two lines are not identical.

See also
operator==

Definition at line 250 of file mitkLine.h.

◆ operator=()

template<class TCoordRep , unsigned int NPointDimension = 3>
const Line<TCoordRep, NPointDimension>& mitk::Line< TCoordRep, NPointDimension >::operator= ( const Line< TCoordRep, NPointDimension > &  line)
inline

◆ operator==()

template<class TCoordRep , unsigned int NPointDimension = 3>
bool mitk::Line< TCoordRep, NPointDimension >::operator== ( const Line< TCoordRep, NPointDimension > &  line) const
inline

Test if the two lines are identical.

Start point and direction and length of direction vector must be equal for identical lines.

Definition at line 225 of file mitkLine.h.

References mitk::eps, mitk::Line< TCoordRep, NPointDimension >::GetPoint1(), and mitk::Line< TCoordRep, NPointDimension >::GetPoint2().

◆ Project()

template<class TCoordRep , unsigned int NPointDimension = 3>
itk::Point<TCoordRep, NPointDimension> mitk::Line< TCoordRep, NPointDimension >::Project ( const itk::Point< TCoordRep, NPointDimension > &  point) const
inline

◆ RectangleLineIntersection()

template<class TCoordRep , unsigned int NPointDimension = 3>
static int mitk::Line< TCoordRep, NPointDimension >::RectangleLineIntersection ( TCoordRep  x1,
TCoordRep  y1,
TCoordRep  x2,
TCoordRep  y2,
itk::Point< TCoordRep, 2 >  p,
itk::Vector< TCoordRep, 2 >  d,
itk::Point< TCoordRep, 2 > &  s1,
itk::Point< TCoordRep, 2 > &  s2 
)
inlinestatic

Calculates the intersection points of a straight line in 2D with a rectangle.

Parameters
x1,y1,x2,y2rectangle
p,dstraight line: p point on it, d direction of line
s1first intersection point (valid only if s_num>0)
s2second intersection point (valid only if s_num==2)
Returns
number of intersection points (0<=s_num<=2)

Definition at line 260 of file mitkLine.h.

References mitk::eps.

◆ Set()

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::Set ( const itk::Point< TCoordRep, NPointDimension > &  point,
const itk::Vector< TCoordRep, NPointDimension > &  direction 
)
inline

Define line by point and direction.

Length of direction defines the the length of the line

Definition at line 81 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ SetDirection()

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::SetDirection ( const itk::Vector< TCoordRep, NPointDimension > &  direction)
inline

Set the direction vector of the line.

Definition at line 76 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction.

◆ SetPoint()

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::SetPoint ( const itk::Point< TCoordRep, NPointDimension > &  point1)
inline

Set/change start point of the line.

Definition at line 60 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ SetPoint1()

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::SetPoint1 ( const itk::Point< TCoordRep, NPointDimension > &  point1)
inline

Set/change start point of the line.

Definition at line 100 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ SetPoint2()

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::SetPoint2 ( const itk::Point< TCoordRep, NPointDimension > &  point2)
inline

Set/change end point of the line.

Definition at line 114 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ SetPoints()

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::SetPoints ( const itk::Point< TCoordRep, NPointDimension > &  point1,
const itk::Point< TCoordRep, NPointDimension > &  point2 
)
inline

Define line by two points.

Definition at line 90 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

◆ Transform() [1/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::Transform ( const itk::Matrix< TCoordRep, NPointDimension, NPointDimension > &  matrix)
inline

Transform the line with a matrix.

Only the direction will be changed, not the start point.

Definition at line 136 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction.

◆ Transform() [2/2]

template<class TCoordRep , unsigned int NPointDimension = 3>
void mitk::Line< TCoordRep, NPointDimension >::Transform ( itk::Transform< TCoordRep, NPointDimension, NPointDimension > &  transform)
inline

Transform the line with a Transform.

Definition at line 126 of file mitkLine.h.

References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.

Member Data Documentation

◆ m_Direction

◆ m_Point


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