MeVisLab Toolbox Reference
mlLine.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2010, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_LINE_H
14 #define ML_LINE_H
15 
17 
18 #include "mlLinearAlgebraSystem.h"
19 #include "mlVector3.h"
20 
21 ML_LA_START_NAMESPACE
22 
23  //----------------------------------------------------------------------------------
26  //----------------------------------------------------------------------------------
28  {
29 
30  public:
32  Line();
33 
35  Line(const Vector3& p0, const Vector3& p1);
36 
40  bool setValue(const Vector3& p0, const Vector3& p1);
41 
43  Vector3 getClosestPoint(const Vector3& point) const;
44 
46  double distance(const Vector3& point) const;
47 
49  inline const Vector3& getPosition() const
50  { return _pos; }
51 
53  inline const Vector3& getDirection() const
54  { return _dir; }
55 
57  inline Vector3 getVector(double lambda) const
58  { return _pos + lambda * _dir; }
59 
62  bool getClosestPoints(const Line& line2, Vector3& pointOnLine, Vector3& pointOnLine2) const;
63 
64  private:
65 
67  Vector3 _pos;
68 
70  Vector3 _dir;
71  };
72 
73 ML_LA_END_NAMESPACE
74 
75 #endif // __mlLine_H
Class to define the geometry primitive "Line" consisting of a position and a direction.
Definition: mlLine.h:28
bool setValue(const Vector3 &p0, const Vector3 &p1)
Initializes line passing through p0 and p1.
Line()
Constructor. Position is set to (0,0,0) and dir is set to (1,0,0).
const Vector3 & getDirection() const
Returns the direction of the line.
Definition: mlLine.h:53
Vector3 getClosestPoint(const Vector3 &point) const
Returns the point on the line which is closest to point.
const Vector3 & getPosition() const
Returns the reference point on the line.
Definition: mlLine.h:49
Vector3 getVector(double lambda) const
Returns a point on line parametrized by lambda.
Definition: mlLine.h:57
bool getClosestPoints(const Line &line2, Vector3 &pointOnLine, Vector3 &pointOnLine2) const
Finds the two closest points on this and line2 and stores them in pointOnLine and pointOnLine2,...
Line(const Vector3 &p0, const Vector3 &p1)
Constructor for line passing p0 and p1.
double distance(const Vector3 &point) const
Returns the distance of point to the line.
#define ML_LINEAR_ALGEBRA_EXPORT
Defines all system specific settings for all linear algebra classes.