|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Describes a line in N-dimensional space. 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 (const). More... | |
| itk::Point< TCoordRep, NPointDimension > & | GetPoint () |
| Get start point of the line (non-const). More... | |
| const itk::Point< TCoordRep, NPointDimension > | GetPoint (TCoordRep t) const |
| Get point on the line at 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 (const). More... | |
| itk::Vector< TCoordRep, NPointDimension > & | GetDirection () |
| Get the direction vector of the line (non-const). 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 an ITK 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 |
| Compute the distance of a point from the line. More... | |
| itk::Point< TCoordRep, NPointDimension > | Project (const itk::Point< TCoordRep, NPointDimension > &point) const |
| Project a point onto the line. More... | |
| bool | IsPartOfStraightLine (const itk::Point< TCoordRep, NPointDimension > &point) const |
| Test if a point is part of the line segment. 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 line is parallel to this line. More... | |
| bool | IsPartOfLine (const Line< TCoordRep, NPointDimension > &line) const |
| Test if another line is part of this 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 (copy assignment). 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 |
Describes a line in N-dimensional space.
A line is defined by a start point and a direction vector. The length of the direction vector defines the length of the line segment for methods like IsPartOfStraightLine().
| TCoordRep | The coordinate representation type. |
| NPointDimension | The dimensionality of the space (default is 3). |
Definition at line 36 of file mitkLine.h.
|
inline |
Definition at line 39 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Define line by point and direction.
Length of direction defines the length of the line.
| point | Start point of the line. |
| direction | Direction vector of the line. |
Definition at line 52 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inlinestatic |
Calculates the intersection points of a straight line in 3D with a box.
| x1,y1,z1 | first corner of the box |
| x2,y2,z2 | second corner of the box |
| p,d | straight line: p point on it, d direction of line |
| s1 | first intersection point (valid only if s_num>0) |
| s2 | second intersection point (valid only if s_num==2) |
Definition at line 427 of file mitkLine.h.
References mitk::eps.
|
inline |
Compute the distance of a point from the line.
| point | The point to compute the distance for. |
Definition at line 191 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::Project().
Referenced by mitk::Line< TCoordRep, NPointDimension >::IsPartOfLine(), and mitk::Line< TCoordRep, NPointDimension >::IsPartOfStraightLine().
|
inline |
Get the direction vector of the line (non-const).
Definition at line 90 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction.
|
inline |
Get the direction vector of the line (const).
Definition at line 87 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction.
Referenced by mitk::Line< TCoordRep, NPointDimension >::IsParallel(), and mitk::Line< TCoordRep, NPointDimension >::operator=().
|
inline |
Get start point of the line (non-const).
Definition at line 62 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Get start point of the line (const).
Definition at line 59 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Point.
Referenced by mitk::Line< TCoordRep, NPointDimension >::IsPartOfLine(), and mitk::Line< TCoordRep, NPointDimension >::operator=().
|
inline |
Get point on the line at parameter t.
| t | Parameter along the line direction. |
Definition at line 69 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Get start point of the line.
Definition at line 142 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Point.
Referenced by mitk::Line< TCoordRep, NPointDimension >::operator==().
|
inline |
Get end point of the line.
Definition at line 156 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
Referenced by mitk::Line< TCoordRep, NPointDimension >::operator==().
|
inline |
Test if a line is parallel to this line.
Uses the cross product of direction vectors (3D only).
| line | The other line to compare. |
Definition at line 266 of file mitkLine.h.
References mitk::eps, mitk::Line< TCoordRep, NPointDimension >::GetDirection(), and mitk::Line< TCoordRep, NPointDimension >::m_Direction.
Referenced by mitk::Line< TCoordRep, NPointDimension >::IsPartOfLine().
|
inline |
Test if a point is part of the line (line having infinite length).
| point | The point to test. |
Definition at line 251 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::Distance(), and mitk::eps.
|
inline |
Test if another line is part of this line (line having infinite length).
The other line must be parallel and share a common point.
| line | The other line to test. |
Definition at line 285 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::Distance(), mitk::Line< TCoordRep, NPointDimension >::GetPoint(), and mitk::Line< TCoordRep, NPointDimension >::IsParallel().
|
inline |
Test if a point is part of the line segment.
The length of the direction vector defines the length of the line segment. The point must lie on the line and within the segment bounds.
| point | The point to test. |
Definition at line 229 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.
|
inline |
|
inline |
Set the line by another line (copy assignment).
| line | The line to copy from. |
Definition at line 315 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::GetDirection(), mitk::Line< TCoordRep, NPointDimension >::GetPoint(), mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Test if the two lines are identical.
Start point and direction and length of direction vector must be equal for identical lines.
| line | The other line to compare. |
Definition at line 298 of file mitkLine.h.
References mitk::eps, mitk::Line< TCoordRep, NPointDimension >::GetPoint1(), and mitk::Line< TCoordRep, NPointDimension >::GetPoint2().
|
inline |
Project a point onto the line.
If the direction vector has zero norm, the start point is returned.
| point | The point to project. |
Definition at line 205 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
Referenced by mitk::Line< TCoordRep, NPointDimension >::Distance().
|
inlinestatic |
Calculates the intersection points of a straight line in 2D with a rectangle.
| x1 | Left boundary of the rectangle. |
| y1 | Bottom boundary of the rectangle. |
| x2 | Right boundary of the rectangle. |
| y2 | Top boundary of the rectangle. |
| p | A point on the straight line. |
| d | Direction vector of the straight line. |
| s1 | First intersection point (valid only if return value > 0). |
| s2 | Second intersection point (valid only if return value == 2). |
Definition at line 341 of file mitkLine.h.
References mitk::eps.
|
inline |
Define line by point and direction.
Length of direction defines the length of the line.
| point | Start point of the line. |
| direction | Direction vector of the line. |
Definition at line 105 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Set the direction vector of the line.
| direction | New direction vector. |
Definition at line 96 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction.
|
inline |
Set/change start point of the line.
The end point of the line is preserved, so the direction vector is recomputed accordingly.
| point1 | New start point. |
Definition at line 78 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Set/change start point of the line.
The end point of the line is preserved, so the direction vector is recomputed accordingly.
| point1 | New start point. |
Definition at line 132 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Set/change end point of the line.
The start point is preserved, so the direction vector is recomputed.
| point2 | New end point. |
Definition at line 150 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Define line by two points.
| point1 | Start point of the line. |
| point2 | End point of the line. |
Definition at line 117 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
inline |
Transform the line with a matrix.
Only the direction will be changed, not the start point.
| matrix | The transformation matrix to apply. |
Definition at line 181 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction.
|
inline |
Transform the line with an ITK Transform.
Both the start point and the direction vector are transformed.
| transform | The ITK transform to apply. |
Definition at line 169 of file mitkLine.h.
References mitk::Line< TCoordRep, NPointDimension >::m_Direction, and mitk::Line< TCoordRep, NPointDimension >::m_Point.
|
protected |
Definition at line 487 of file mitkLine.h.
Referenced by mitk::Line< TCoordRep, NPointDimension >::GetDirection(), mitk::Line< TCoordRep, NPointDimension >::GetPoint(), mitk::Line< TCoordRep, NPointDimension >::GetPoint2(), mitk::Line< TCoordRep, NPointDimension >::IsParallel(), mitk::Line< TCoordRep, NPointDimension >::IsPartOfStraightLine(), mitk::Line< TCoordRep, NPointDimension >::Line(), mitk::Line< TCoordRep, NPointDimension >::operator=(), mitk::Line< TCoordRep, NPointDimension >::Project(), mitk::Line< TCoordRep, NPointDimension >::Set(), mitk::Line< TCoordRep, NPointDimension >::SetDirection(), mitk::Line< TCoordRep, NPointDimension >::SetPoint(), mitk::Line< TCoordRep, NPointDimension >::SetPoint1(), mitk::Line< TCoordRep, NPointDimension >::SetPoint2(), mitk::Line< TCoordRep, NPointDimension >::SetPoints(), and mitk::Line< TCoordRep, NPointDimension >::Transform().
|
protected |
Definition at line 486 of file mitkLine.h.
Referenced by mitk::Line< TCoordRep, NPointDimension >::GetPoint(), mitk::Line< TCoordRep, NPointDimension >::GetPoint1(), mitk::Line< TCoordRep, NPointDimension >::GetPoint2(), mitk::Line< TCoordRep, NPointDimension >::IsPartOfStraightLine(), mitk::Line< TCoordRep, NPointDimension >::Line(), mitk::Line< TCoordRep, NPointDimension >::operator=(), mitk::Line< TCoordRep, NPointDimension >::Project(), mitk::Line< TCoordRep, NPointDimension >::Set(), mitk::Line< TCoordRep, NPointDimension >::SetPoint(), mitk::Line< TCoordRep, NPointDimension >::SetPoint1(), mitk::Line< TCoordRep, NPointDimension >::SetPoint2(), mitk::Line< TCoordRep, NPointDimension >::SetPoints(), and mitk::Line< TCoordRep, NPointDimension >::Transform().