Back to index

salome-smesh  6.5.0
MeshCut_Cube.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2006-2012  EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MeshCut_Cube.hxx"
00021 
00022 #include <iostream>
00023 
00024 using namespace MESHCUT;
00025 using namespace std;
00026 
00027 Cube::Cube(float _x0, float _x1, float _y0, float _y1, float _z0, float _z1)
00028 {
00029   x0 = _x0;
00030   x1 = _x1;
00031   y0 = _y0;
00032   y1 = _y1;
00033   z0 = _z0;
00034   z1 = _z1;
00035 }
00036 
00037 bool Cube::disjoint(Cube* c2)
00038 {
00039   return (x0 > c2->x1 || x1 < c2->x0 || y0 > c2->y1 || y1 < c2->y0 || z0 > c2->z1 || z1 < c2->z0);
00040 }
00041 
00042 bool Cube::contientNoeud(int ngnoeud, Maillage *MAILLAGE)
00043 {
00044   float x = *(MAILLAGE->XX + ngnoeud - 1);
00045   float y = *(MAILLAGE->YY + ngnoeud - 1);
00046   float z = *(MAILLAGE->ZZ + ngnoeud - 1);
00047   return (x >= x0 && x <= x1 && y >= y0 && y <= y1 && z >= z0 && z <= z1);
00048 }
00049 
00050 void Cube::affichage()
00051 {
00052   cout << "x0=" << x0 << " ";
00053   cout << "x1=" << x1 << " ";
00054   cout << "y0=" << y0 << " ";
00055   cout << "y1=" << y1 << " ";
00056   cout << "z0=" << z0 << " ";
00057   cout << "z1=" << z1 << " ";
00058 }