1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GeomAPI_Lin_H_
21 #define GeomAPI_Lin_H_
23 #include <GeomAPI_Interface.h>
34 class GeomAPI_Lin : public GeomAPI_Interface
37 /// Creation of line defined by cordinates of start and end points
39 GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ,
40 const double theEndX, const double theEndY, const double theEndZ);
41 /// Creation of line defined by start and end points
43 GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theStart,
44 const std::shared_ptr<GeomAPI_Pnt>& theEnd);
45 /// Creation of line defined by origin and direction
47 GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
48 const std::shared_ptr<GeomAPI_Dir>& theDirection);
50 /// Returns point on the line (first point)
52 std::shared_ptr<GeomAPI_Pnt> location();
54 /// Returns a line direction
56 std::shared_ptr<GeomAPI_Dir> direction();
58 /// Distance between two points
60 double distance(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
61 /// Intersection of two lines
63 const std::shared_ptr<GeomAPI_Pnt> intersect(
64 const std::shared_ptr<GeomAPI_Lin>& theLine) const;
65 /// Project point on line
67 const std::shared_ptr<GeomAPI_Pnt> project(
68 const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
70 /// Returns parameter of the point projection
72 double projParam(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
74 /// \return true if this line contains thePoint, that is,
75 /// if the distance between thePoint and this line
76 /// is less than or equal to theLinearTolerance.
78 bool contains(const std::shared_ptr<GeomAPI_Pnt> thePoint,
79 const double theLinearTolerance = 1.e-7) const;
81 /// \return true if lines are parallel.
83 bool isParallel(const std::shared_ptr<GeomAPI_Lin> theLin) const;
85 /// \return true if lines are coplanar.
87 bool isCoplanar(const std::shared_ptr<GeomAPI_Lin> theLin) const;
90 //! Pointer on the object
91 typedef std::shared_ptr<GeomAPI_Lin> GeomLinePtr;