Salome HOME
9676000bcb6a8e836f88975c8d0d4c57b55b0ff6
[tools/medcoupling.git] / src / INTERP_KERNEL / PlanarIntersector.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
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.
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 #ifndef __PLANARINTERSECTOR_HXX__
20 #define __PLANARINTERSECTOR_HXX__
21
22 #include "TargetIntersector.hxx"
23
24 namespace INTERP_KERNEL
25 {
26   class TranslationRotationMatrix;
27   
28   template<class MyMeshType, class MyMatrix>
29   class PlanarIntersector : public TargetIntersector<MyMeshType,MyMatrix>
30   {
31   public:
32     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
33     static const int MESHDIM=MyMeshType::MY_MESHDIM;
34     typedef typename MyMeshType::MyConnType ConnType;
35     static const NumberingPolicy numPol=MyMeshType::My_numPol;
36   public:
37     //! \addtogroup InterpKerGrpIntPlan @{
38     PlanarIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double medianPlane, bool doRotate, int orientation, int printLevel);
39     //! @}
40     virtual ~PlanarIntersector();
41     void createBoundingBoxes(const MyMeshType& mesh, std::vector<double>& bbox);
42     void adjustBoundingBoxes(std::vector<double>& bbox, double Surf3DAdjustmentEps);
43     inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes);
44   protected :
45     int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB);
46     void getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT);
47     void getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS);
48     void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector<double>& coordsT, std::vector<double>& coordsS, int& orientation);
49     static int projection(double *Coords_A, double *Coords_B, 
50                            int nb_NodesA, int nb_NodesB, double epsilon, double median_plane, bool do_rotate);
51     static void rotate3DTriangle( double* PP1, double*PP2, double*PP3,
52                                   TranslationRotationMatrix& rotation_matrix);
53   protected:
54     const ConnType *_connectT;
55     const ConnType *_connectS;
56     const double *_coordsT;
57     const double *_coordsS;
58     const ConnType *_connIndexT;
59     const ConnType *_connIndexS;
60     const MyMeshType& _meshT;
61     const MyMeshType& _meshS;
62     double _dim_caracteristic;
63     double _precision;
64     double _median_plane;
65     bool _do_rotate;
66     int _orientation;
67     int _print_level;
68   };
69 }
70
71 #endif