ML Reference
MeVis/Foundation/Sources/MLLinearAlgebra/mlLine.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00009 //----------------------------------------------------------------------------------
00010 #ifndef __mlLine_H
00011 #define __mlLine_H
00012 
00013 #include "mlLinearAlgebraSystem.h"
00014 #include "mlVector3.h"
00015 
00016 ML_LA_START_NAMESPACE
00017 
00018   //----------------------------------------------------------------------------------
00021   //----------------------------------------------------------------------------------
00022   class ML_LINEAR_ALGEBRA_EXPORT Line {
00023 
00024   public:
00026     Line();
00027 
00029     Line(const Vector3& p0, const Vector3& p1);
00030 
00034     bool setValue(const Vector3& p0, const Vector3& p1);
00035 
00037     Vector3 getClosestPoint(const Vector3& point) const;
00038 
00040     double distance(const Vector3& point) const;
00041 
00043     inline const Vector3& getPosition() const
00044     { return _pos; }
00045 
00047     inline const Vector3& getDirection() const
00048     { return _dir; }
00049 
00051     inline Vector3 getVector(double lambda) const
00052     { return _pos + static_cast<double>(lambda) * _dir; }
00053 
00056     bool getClosestPoints(const Line& line2, Vector3& pointOnLine, Vector3& pointOnLine2) const;
00057 
00058   private:
00059 
00061     Vector3 _pos;
00062 
00064     Vector3 _dir;
00065   };
00066 
00067 ML_LA_END_NAMESPACE
00068 
00069 #endif // __mlLine_H