]> SALOME platform Git repositories - modules/homard.git/blob - src/FrontTrack/FrontTrack_Projector.hxx
Salome HOME
Fronttrack
[modules/homard.git] / src / FrontTrack / FrontTrack_Projector.hxx
1 // File      : FrontTrack_Projector.hxx
2 // Created   : Wed Apr 26 20:12:13 2017
3 // Author    : Edward AGAPOV (eap)
4
5 #ifndef __FrontTrack_Projector_HXX__
6 #define __FrontTrack_Projector_HXX__
7
8 #include <TopoDS_Shape.hxx>
9 #include <Bnd_Box.hxx>
10
11 struct FT_RealProjector;
12
13 /*!
14  * \brief Projector of a point to a boundary shape. Wrapper of a real projection algo
15  */
16 class FT_Projector
17 {
18 public:
19
20   FT_Projector(const TopoDS_Shape& shape = TopoDS_Shape());
21   FT_Projector(const FT_Projector& other);
22   ~FT_Projector();
23
24   // initialize with a boundary shape, compute the bounding box
25   void setBoundaryShape(const TopoDS_Shape& shape);
26
27   // return the boundary shape
28   const TopoDS_Shape& getShape() const { return _shape; }
29
30   // return the bounding box
31   const Bnd_Box getBoundingBox() const { return _bndBox; }
32
33
34   // create a real projector
35   void prepareForProjection();
36
37   // return true if a previously found solution can be used to speed up the projection
38   bool canUsePrevSolution() const;
39
40   // return true if projection is not needed
41   bool isPlanarBoundary() const;
42
43   // project a point to the boundary shape
44   bool project( const gp_Pnt& point,
45                 const double  maxDist2,
46                 gp_Pnt&       projection,
47                 double*       newSolution,
48                 const double* prevSolution = 0);
49
50   // project a point to the boundary shape and check if the projection is within the shape boundary
51   bool projectAndClassify( const gp_Pnt& point,
52                            const double  maxDist2,
53                            gp_Pnt&       projection,
54                            double*       newSolution,
55                            const double* prevSolution = 0);
56
57   // check if a point lies on the boundary shape
58   bool isOnShape( const gp_Pnt& point,
59                   const double  tol2,
60                   double*       newSolution,
61                   const double* prevSolution = 0);
62
63 private:
64
65   FT_RealProjector* _realProjector;
66   Bnd_Box           _bndBox;
67   TopoDS_Shape      _shape;
68 };
69
70 #endif