Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gmv-geo-sew.cc
Go to the documentation of this file.
1 /*
2  * lib-gmapkernel : Un noyau de 3-G-cartes et des opérations.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-gmapkernel
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #include "g-map-vertex.hh"
26 using namespace GMap3d;
27 //******************************************************************************
28 void CGMapVertex::geoSew(CDart * ADart1, CDart * ADart2, int ADim,
29  bool ARotateCells, bool AScaleCells,
30  bool ATranslateCells)
31 {
32  assert(ADart1!=NULL && ADart2!=NULL);
33  assert(ADim>=0 && ADim<=3);
34  assert(canSew(ADart1, ADart2, ADim));
35 
36  if (ADim!=0 && canPlate(ADart1, ADart2))
37  plate(ADart1, ADart2, ADim-1, ARotateCells, AScaleCells, ATranslateCells);
38 
39  sew(ADart1, ADart2, ADim);
40 }
41 //******************************************************************************
42 bool CGMapVertex::intuitiveGeoSew(CDart * ADart1, CDart * ADart2,
43  bool ARotateCells, bool AScaleCells,
44  bool ATranslateCells)
45 {
46  assert(ADart1!=NULL && ADart2!=NULL);
47 
48  int dim = getSewDimension(ADart1, ADart2);
49 
50  bool possible = dim!=4;
51 
52  if (possible)
53  geoSew(ADart1, ADart2, dim, ARotateCells, AScaleCells, ATranslateCells);
54 
55  return possible;
56 }
57 //******************************************************************************
58 void CGMapVertex::geoBorderSew(CDart * ADart1, CDart * ADart2, int ADim,
59  bool ARotateCells, bool AScaleCells,
60  bool ATranslateCells)
61 {
62  assert(ADart1!=NULL && ADart2!=NULL);
63  assert(ADim>=0 && ADim<=3);
64  assert(canSewBorders(ADart1, ADart2, ADim));
65 
66  if (ADim!=0 && canPlate(ADart1, ADart2))
67  borderPlate(ADart1, ADart2, ADim, ARotateCells, AScaleCells, ATranslateCells);
68 
69  borderSew(ADart1, ADart2, ADim);
70 }
71 //******************************************************************************
73  bool ARotateCells, bool AScaleCells,
74  bool ATranslateCells)
75 {
76  assert(ADart1!=NULL && ADart2!=NULL);
77 
78  int dim= getBorderDimension(ADart1);
79 
80  bool possible = dim!=4 && canSewBorders(ADart1, ADart2, dim);
81 
82  if (possible)
83  geoBorderSew(ADart1, ADart2, dim, ARotateCells,AScaleCells,ATranslateCells);
84 
85  return possible;
86 }
87 //******************************************************************************