Salome HOME
Bug 0020233: Infinite loop in boolean operation with a sphere with r=0
[modules/geom.git] / src / ARCHIMEDE / Archimede_VolumeSection.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  GEOM ARCHIMEDE : algorithm implementation
23 //  File   : Archimede_VolumeSection.hxx
24 //  Author : Nicolas REJNERI
25 //  Module : GEOM
26 //  $Header$
27 //
28 #ifndef ARCHIMEDE_VOLUMESECTION_HXX
29 #define ARCHIMEDE_VOLUMESECTION_HXX
30
31 #include <gp_Pnt.hxx>
32 #include <gp_Dir.hxx>
33 #include <TopoDS_Shape.hxx>
34 #include <Geom_Plane.hxx>
35 #include <Geom_RectangularTrimmedSurface.hxx>
36
37 class VolumeSection{
38
39 public:
40   // Constructeur effectuant le maillage de peau de la shape
41   Standard_EXPORT VolumeSection(TopoDS_Shape , Standard_Real); 
42
43   //Methode qui affecte \80 un point,les coordonn\89es de centre de la boite englobante de la shape 
44   Standard_EXPORT void CenterOfGravity();
45
46   // Methode qui calcule le volume sous un plan Z = h
47   Standard_EXPORT Standard_Real CalculateVolume(Standard_Real); 
48
49   // Methode qui resout l'equation V(h)=constante
50   Standard_EXPORT Standard_Real Archimede(Standard_Real , Standard_Real); 
51
52   // Methode permettant de "setter" un plan afin de l'utiliser \80 l'interieur de la classe
53   Standard_EXPORT void SetPlane(Handle (Geom_Plane));
54
55   // Methode permettant de r\89cup\89rer la shape modifi\89\80 l'ext\89rieur de la classe
56   Standard_EXPORT TopoDS_Shape GetShape();
57
58   // Methode effectuant la rotation du plan et de la shape
59   Standard_EXPORT void MakeRotation(gp_Dir);
60
61   // Methode effectuant la rotation inverse du plan et de la shape
62   Standard_EXPORT Handle (Geom_RectangularTrimmedSurface) InvMakeRotation(gp_Dir,Handle(Geom_RectangularTrimmedSurface));
63
64   // Methode permettant de d\89couper le plan selon une projection de la Shape
65   Standard_EXPORT Handle (Geom_RectangularTrimmedSurface) TrimSurf();
66
67   // Methode permmettant de deplacer le plan jusqu'a la position donn\89e par Archim\88de
68   Standard_EXPORT Handle (Geom_RectangularTrimmedSurface) AjustePlan(Handle(Geom_RectangularTrimmedSurface),Standard_Real,gp_Pnt);
69
70   Standard_EXPORT void getZ( double& min, double& max);
71   
72 private:
73   
74   TopoDS_Shape  myShape;
75   Standard_Real Tolerance;
76   gp_Pnt        InitPoint;
77   Standard_Real Zmin,Zmax,Ymin,Ymax,Xmin,Xmax;
78   Handle(Geom_Plane) myPlane;
79   
80   Standard_Real ElementaryVolume(gp_Pnt,gp_Pnt,gp_Pnt);
81   gp_Pnt        Intersection(gp_Pnt,gp_Pnt,Standard_Real);
82   
83 };
84 #endif