Salome HOME
757efa24630bb6bde9954cb0fae286e45cc42e9a
[modules/geom.git] / src / ARCHIMEDE / Archimede_VolumeSection.hxx
1 //  GEOM ARCHIMEDE : algorithm implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : Archimede_VolumeSection.hxx
25 //  Author : Nicolas REJNERI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef ARCHIMEDE_VOLUMESECTION_HXX
30 #define ARCHIMEDE_VOLUMESECTION_HXX
31
32 #include <gp_Pnt.hxx>
33 #include <gp_Dir.hxx>
34 #include <TopoDS_Shape.hxx>
35 #include <Geom_Plane.hxx>
36 #include <Geom_RectangularTrimmedSurface.hxx>
37
38 class VolumeSection{
39
40 public:
41   // Constructeur effectuant le maillage de peau de la shape
42   VolumeSection(TopoDS_Shape , Standard_Real); 
43
44   //Methode qui affecte à un point,les coordonnées de centre de la boite englobante de la shape 
45   void CenterOfGravity();
46
47   // Methode qui calcule le volume sous un plan Z = h
48   Standard_Real CalculateVolume(Standard_Real); 
49
50   // Methode qui resout l'equation V(h)=constante
51   Standard_Real Archimede(Standard_Real , Standard_Real); 
52
53   // Methode permettant de "setter" un plan afin de l'utiliser à l'interieur de la classe
54   void SetPlane(Handle (Geom_Plane));
55
56   // Methode permettant de récupérer la shape modifiée à l'extérieur de la classe
57   TopoDS_Shape GetShape();
58
59   // Methode effectuant la rotation du plan et de la shape
60   void MakeRotation(gp_Dir);
61
62   // Methode effectuant la rotation inverse du plan et de la shape
63   Handle (Geom_RectangularTrimmedSurface) InvMakeRotation(gp_Dir,Handle(Geom_RectangularTrimmedSurface));
64
65   // Methode permettant de découper le plan selon une projection de la Shape
66   Handle (Geom_RectangularTrimmedSurface) TrimSurf();
67
68   // Methode permmettant de deplacer le plan jusqu'a la position donnée par Archimède
69   Handle (Geom_RectangularTrimmedSurface) AjustePlan(Handle(Geom_RectangularTrimmedSurface),Standard_Real,gp_Pnt);
70
71   void getZ( double& min, double& max);
72   
73 private:
74   
75   TopoDS_Shape  myShape;
76   Standard_Real Tolerance;
77   gp_Pnt        InitPoint;
78   Standard_Real Zmin,Zmax,Ymin,Ymax,Xmin,Xmax;
79   Handle(Geom_Plane) myPlane;
80   
81   Standard_Real ElementaryVolume(gp_Pnt,gp_Pnt,gp_Pnt);
82   gp_Pnt        Intersection(gp_Pnt,gp_Pnt,Standard_Real);
83   
84 };
85 #endif