Salome HOME
Update copyright
[modules/smesh.git] / src / Tools / MeshCut / MeshCut_Cube.cxx
1 // Copyright (C) 2006-2011  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
20 #include "MeshCut_Cube.hxx"
21
22 #include <iostream>
23
24 using namespace MESHCUT;
25 using namespace std;
26
27 Cube::Cube(float _x0, float _x1, float _y0, float _y1, float _z0, float _z1)
28 {
29   x0 = _x0;
30   x1 = _x1;
31   y0 = _y0;
32   y1 = _y1;
33   z0 = _z0;
34   z1 = _z1;
35 }
36
37 bool Cube::disjoint(Cube* c2)
38 {
39   return (x0 > c2->x1 || x1 < c2->x0 || y0 > c2->y1 || y1 < c2->y0 || z0 > c2->z1 || z1 < c2->z0);
40 }
41
42 bool Cube::contientNoeud(int ngnoeud, Maillage *MAILLAGE)
43 {
44   float x = *(MAILLAGE->XX + ngnoeud - 1);
45   float y = *(MAILLAGE->YY + ngnoeud - 1);
46   float z = *(MAILLAGE->ZZ + ngnoeud - 1);
47   return (x >= x0 && x <= x1 && y >= y0 && y <= y1 && z >= z0 && z <= z1);
48 }
49
50 void Cube::affichage()
51 {
52   cout << "x0=" << x0 << " ";
53   cout << "x1=" << x1 << " ";
54   cout << "y0=" << y0 << " ";
55   cout << "y1=" << y1 << " ";
56   cout << "z0=" << z0 << " ";
57   cout << "z1=" << z1 << " ";
58 }