SHAPER  9.12.0
GeomAPI_Lin.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef GeomAPI_Lin_H_
21 #define GeomAPI_Lin_H_
22 
23 #include <GeomAPI_Interface.h>
24 #include <memory>
25 
26 class GeomAPI_Dir;
27 class GeomAPI_Pnt;
28 
35 {
36  public:
38  GEOMAPI_EXPORT
39  GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ,
40  const double theEndX, const double theEndY, const double theEndZ);
42  GEOMAPI_EXPORT
43  GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theStart,
44  const std::shared_ptr<GeomAPI_Pnt>& theEnd);
46  GEOMAPI_EXPORT
47  GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
48  const std::shared_ptr<GeomAPI_Dir>& theDirection);
49 
51  GEOMAPI_EXPORT
52  std::shared_ptr<GeomAPI_Pnt> location();
53 
55  GEOMAPI_EXPORT
56  std::shared_ptr<GeomAPI_Dir> direction();
57 
59  GEOMAPI_EXPORT
60  double distance(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
62  GEOMAPI_EXPORT
63  const std::shared_ptr<GeomAPI_Pnt> intersect(
64  const std::shared_ptr<GeomAPI_Lin>& theLine) const;
66  GEOMAPI_EXPORT
67  const std::shared_ptr<GeomAPI_Pnt> project(
68  const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
69 
71  GEOMAPI_EXPORT
72  double projParam(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
73 
77  GEOMAPI_EXPORT
78  bool contains(const std::shared_ptr<GeomAPI_Pnt> thePoint,
79  const double theLinearTolerance = 1.e-7) const;
80 
82  GEOMAPI_EXPORT
83  bool isParallel(const std::shared_ptr<GeomAPI_Lin> theLin) const;
84 
86  GEOMAPI_EXPORT
87  bool isCoplanar(const std::shared_ptr<GeomAPI_Lin> theLin) const;
88 };
89 
91 typedef std::shared_ptr<GeomAPI_Lin> GeomLinePtr;
92 
93 #endif
94 
3D direction defined by three normalized coordinates
Definition: GeomAPI_Dir.h:34
General base class for all interfaces in this package.
Definition: GeomAPI_Interface.h:38
Line in 3D.
Definition: GeomAPI_Lin.h:35
GEOMAPI_EXPORT bool isParallel(const std::shared_ptr< GeomAPI_Lin > theLin) const
Definition: GeomAPI_Lin.cpp:138
GEOMAPI_EXPORT const std::shared_ptr< GeomAPI_Pnt > project(const std::shared_ptr< GeomAPI_Pnt > &thePoint) const
Project point on line.
Definition: GeomAPI_Lin.cpp:118
GEOMAPI_EXPORT bool isCoplanar(const std::shared_ptr< GeomAPI_Lin > theLin) const
Definition: GeomAPI_Lin.cpp:144
GEOMAPI_EXPORT GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ, const double theEndX, const double theEndY, const double theEndZ)
Creation of line defined by cordinates of start and end points.
Definition: GeomAPI_Lin.cpp:46
GEOMAPI_EXPORT const std::shared_ptr< GeomAPI_Pnt > intersect(const std::shared_ptr< GeomAPI_Lin > &theLine) const
Intersection of two lines.
Definition: GeomAPI_Lin.cpp:85
GEOMAPI_EXPORT std::shared_ptr< GeomAPI_Dir > direction()
Returns a line direction.
Definition: GeomAPI_Lin.cpp:74
GEOMAPI_EXPORT double projParam(const std::shared_ptr< GeomAPI_Pnt > &thePoint) const
Returns parameter of the point projection.
Definition: GeomAPI_Lin.cpp:109
GEOMAPI_EXPORT std::shared_ptr< GeomAPI_Pnt > location()
Returns point on the line (first point)
Definition: GeomAPI_Lin.cpp:68
GEOMAPI_EXPORT bool contains(const std::shared_ptr< GeomAPI_Pnt > thePoint, const double theLinearTolerance=1.e-7) const
Definition: GeomAPI_Lin.cpp:128
GEOMAPI_EXPORT double distance(const std::shared_ptr< GeomAPI_Pnt > &thePoint) const
Distance between two points.
Definition: GeomAPI_Lin.cpp:80
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38