Salome HOME
Merge branch V7_3_1_BR
[modules/smesh.git] / src / Tools / MeshCut / MeshCut_Carre.cxx
1 // Copyright (C) 2006-2014  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, or (at your option) any later version.
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_Carre.hxx"
21
22 #include <iostream>
23
24 using namespace MESHCUT;
25 using namespace std;
26
27 Carre::Carre(float _x0, float _x1, float _y0, float _y1)
28 {
29   x0 = _x0;
30   x1 = _x1;
31   y0 = _y0;
32   y1 = _y1;
33 }
34
35 bool Carre::disjoint(Carre* c2)
36 {
37   return (x0 > c2->x1 || x1 < c2->x0 || y0 > c2->y1 || y1 < c2->y0);
38 }
39
40 bool Carre::contientNoeud(int ngnoeud, Maillage *MAILLAGE)
41 {
42   float x = *(MAILLAGE->XX + ngnoeud - 1);
43   float y = *(MAILLAGE->YY + ngnoeud - 1);
44   return (x >= x0 && x <= x1 && y >= y0 && y <= y1);
45 }
46
47 void Carre::affichage()
48 {
49   cout << "x0=" << x0 << " ";
50   cout << "x1=" << x1 << " ";
51   cout << "y0=" << y0 << " ";
52   cout << "y1=" << y1 << " ";
53 }
54