1 // Copyright (C) 2017-2024 CEA, EDF
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
19 // File : FrontTrack_Projector.hxx
20 // Created : Wed Apr 26 20:12:13 2017
21 // Author : Edward AGAPOV (eap)
23 #ifndef __FrontTrack_Projector_HXX__
24 #define __FrontTrack_Projector_HXX__
26 #include <TopoDS_Shape.hxx>
27 #include <Bnd_Box.hxx>
29 struct FT_RealProjector;
32 * \brief Projector of a point to a boundary shape. Wrapper of a real projection algo
38 FT_Projector(const TopoDS_Shape& shape = TopoDS_Shape());
39 FT_Projector(const FT_Projector& other);
42 // initialize with a boundary shape, compute the bounding box
43 void setBoundaryShape(const TopoDS_Shape& shape);
45 // return the boundary shape
46 const TopoDS_Shape& getShape() const { return _shape; }
48 // return the bounding box
49 const Bnd_Box getBoundingBox() const { return _bndBox; }
52 // create a real projector
53 void prepareForProjection();
55 // return true if a previously found solution can be used to speed up the projection
56 bool canUsePrevSolution() const;
58 // return true if projection is not needed
59 bool isPlanarBoundary() const;
62 // switch a mode of usage of prevSolution.
63 // If projection fails, to try to project without usage of prevSolution.
64 // By default this mode is off
65 void tryWithoutPrevSolution( bool toTry ) { _tryWOPrevSolution = toTry; }
67 // project a point to the boundary shape
68 bool project( const gp_Pnt& point,
69 const double maxDist2,
72 const double* prevSolution = 0);
74 // project a point to the boundary shape and check if the projection is within the shape boundary
75 bool projectAndClassify( const gp_Pnt& point,
76 const double maxDist2,
79 const double* prevSolution = 0);
81 // check if a point lies on the boundary shape
82 bool isOnShape( const gp_Pnt& point,
85 const double* prevSolution = 0);
89 FT_RealProjector* _realProjector;
92 bool _tryWOPrevSolution;