Salome HOME
Create SketcherPrs package
[modules/shaper.git] / src / GeomAPI / GeomAPI_Lin2d.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Lin2d.h
4 // Created:     29 May 2014
5 // Author:      Artem ZHIDKOV
6
7 #ifndef GeomAPI_Lin2d_H_
8 #define GeomAPI_Lin2d_H_
9
10 #include <GeomAPI_Interface.h>
11 #include <memory>
12
13 class GeomAPI_Pnt2d;
14
15 /**\class GeomAPI_Lin2d
16  * \ingroup DataModel
17  * \brief Line in 2D
18  */
19
20 class GEOMAPI_EXPORT GeomAPI_Lin2d : public GeomAPI_Interface
21 {
22  public:
23   /// Creation of line defined by cordinates of start and end points
24   GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
25                 const double theEndY);
26   /// Creation of line defined by start and end points
27   GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
28                 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd);
29
30   /// Distance between two points
31   double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
32   /// Intersection of two lines
33   const std::shared_ptr<GeomAPI_Pnt2d> intersect(
34       const std::shared_ptr<GeomAPI_Lin2d>& theLine) const;
35   /// Project point on line
36   const std::shared_ptr<GeomAPI_Pnt2d> project(
37       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
38   /// Computes the cross product of the line direction and a vector from the line start point to the point
39   bool isRight(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
40
41   /// Returns a location point shifted on theShift in perpendicular direction
42   std::shared_ptr<GeomAPI_Pnt2d> shiftedLocation(double theShift) const;
43 };
44
45 #endif
46