]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_Tools.h
Salome HOME
419ef45500ff7acd4ad3edbfe4bee2fbac025135
[modules/shaper.git] / src / PartSet / PartSet_Tools.h
1 // File:        PartSet_Tools.h
2 // Created:     28 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_Tools_H
6 #define PartSet_Tools_H
7
8 #include "PartSet.h"
9
10 #include <gp_Pnt.hxx>
11
12 #include <QPoint>
13
14 #include <boost/shared_ptr.hpp>
15
16 class Handle_V3d_View;
17 class ModelAPI_Feature;
18
19 /*!
20  \class PartSet_Tools
21  * \brief The operation for the sketch feature creation
22 */
23 class PARTSET_EXPORT PartSet_Tools
24 {
25 public:
26   /// Converts the 2D screen point to the 3D point on the view according to the point of view
27   /// \param thePoint a screen point
28   /// \param theView a 3D view
29   static gp_Pnt ConvertClickToPoint(QPoint thePoint, Handle_V3d_View theView);
30
31   /// \brief Converts the 3D point to the projected coodinates on the sketch plane.
32   /// \param thePoint the 3D point in the viewer
33   /// \param theSketch the sketch feature
34   /// \param theX the X coordinate
35   /// \param theY the Y coordinate
36   static void ConvertTo2D(const gp_Pnt& thePoint, boost::shared_ptr<ModelAPI_Feature> theSketch,
37                           Handle(V3d_View) theView, double& theX, double& theY);
38
39   /// Returns the point of intersection of the two lines, the first is (v0, v1), the second is (v2, v3),
40   /// where vi - {xi,yi}. If the v0 is on the second line, the result is a projection of the v1 to this line
41   /// \param theX0 the horizontal coordinate of 0 point
42   /// \param theX1 the horizontal coordinate of 1 point
43   /// \param theX2 the horizontal coordinate of 2 point
44   /// \param theX3 the horizontal coordinate of 3 point
45   /// \param theY0 the vertical coordinate of 0 point
46   /// \param theY1 the vertical coordinate of 1 point
47   /// \param theY2 the vertical coordinate of 2 point
48   /// \param theY3 the vertical coordinate of 3 point
49   /// \param theX the output horizontal coordinate of the intersection point
50   /// \param theY the outpup vertical coordinate of the intersection point
51   static void IntersectLines(double theX0, double theX1, double theX2, double theX3,
52                              double theY0, double theY1, double theY2, double theY3,
53                              double& theX, double& theY);
54
55   /// Returns the coordinates of projection of the point to the line
56   /// \param thePointX the projected point horizontal coordinate
57   /// \param thePointY the projected point vertictal coordinate
58   /// \param theX1 the horizontal coordinate of the first line point
59   /// \param theX2 the horizontal coordinate of the second line point
60   /// \param theY1 the vertical coordinate of the first line point
61   /// \param theY2 the vertical coordinate of the second line point
62   static void ProjectPointOnLine(double theX1, double theX2, double theY1, double theY2,
63                                  double thePointX, double thePointY, double& theX, double& theY);
64 };
65
66 #endif