Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gmv-inline.icc
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 "geometry.hh"
26 //******************************************************************************
27 namespace GMap3d
28 {
29 //******************************************************************************
30 INLINE
32 {
33  CGMap::empty();
34 
36 }
37 //******************************************************************************
38 INLINE
40 {
41  return new CDartVertex(FMaskMarks);
42 }
43 //******************************************************************************
44 INLINE
46 {
47  assert(ADart != NULL);
48 
49  delete static_cast<CDartVertex *>(ADart);
50 }
51 //******************************************************************************
52 INLINE
54 {
55  return CGMapGeneric::addMapDart();
56 }
57 //******************************************************************************
58 INLINE
60 {
61  CDartVertex * dart = static_cast<CDartVertex *>(CGMapGeneric::addMapDart());
62  setVertex(dart, AVertex);
63  return dart;
64 }
65 //******************************************************************************
66 INLINE
68 {
69  assert(ADim>=0 && ADim<=3);
70 
71  return FBurstCoef[ADim];
72 }
73 //******************************************************************************
74 INLINE
76 {
77  assert(ADim >=0 && ADim <=3);
78  assert(ACoef>=0 && ACoef<=1);
79 
80  FBurstCoef[ADim]= ACoef;
81 }
82 //******************************************************************************
83 INLINE
85 {
86  assert(ADart!=NULL);
87 
88  return static_cast<CAttributeVertex *>
90 }
91 //******************************************************************************
92 INLINE
94 {
95  assert(ADart!=NULL);
96 
97  return static_cast<CAttributeVertex *>
99 }
100 //******************************************************************************
101 INLINE
102 void CGMapVertex::setVertex(CDart* ADart, const CVertex & AVertex)
103 {
104  assert(ADart!=NULL);
105  assert(findVertex(ADart)==NULL);
106 
107  addAttribute(ADart, ORBIT_VERTEX, new CAttributeVertex(AVertex));
108 }
109 //******************************************************************************
110 INLINE
112 {
113  assert(ADart!=NULL);
114  assert(AVertex!=NULL);
115  assert(findVertex(ADart)==NULL);
116 
117  addAttribute(ADart, ORBIT_VERTEX, AVertex);
118 }
119 //******************************************************************************
120 INLINE
121 void CGMapVertex::updateVertex(CDart* ADart, const CVertex & AVertex)
122 {
123  assert(ADart!=NULL);
124 
125  CAttributeVertex * vertex = findVertex(ADart);
126 
127  if (vertex==NULL)
128  addAttribute(ADart, ORBIT_VERTEX, new CAttributeVertex(AVertex));
129  else
130  *vertex = AVertex;
131 }
132 //******************************************************************************
133 INLINE
135 {
136  assert(ADart!=NULL);
137 
139 }
140 //******************************************************************************
141 INLINE
143 {
144  assert(ADart!=NULL);
145 
146  return
147  static_cast<CAttributeVertex *>(removeAttribute(ADart, ORBIT_VERTEX,
149 }
150 //******************************************************************************
151 INLINE
153 {
154  assert(ADart!=NULL);
155  return (static_cast<CDartVertex *>(ADart))->getBurstVertex();
156 }
157 //------------------------------------------------------------------------------
158 INLINE
159 void CGMapVertex::setBurstVertex(CDart* ADart, const CVertex & AVertex)
160 {
161  assert(ADart!=NULL);
162  static_cast<CDartVertex *>(ADart)->setBurstVertex(AVertex);
163 }
164 //******************************************************************************
165 INLINE
167 {
168  if (isFree0(ADart))
169  return getBurstVertex(ADart);
170 
171  TCoordinate k0 = FBurstCoef[0];
172 
173  CVertex& v1 = getBurstVertex( ADart );
174  CVertex& v2 = getBurstVertex(alpha0(ADart));
175 
176  // v1 + k0 * (v2-v1) / 2
177 
178  k0 /= 2;
179 
180  return k0*v2 + (1-k0)*v1;
181 }
182 //******************************************************************************
183 INLINE
186  int ADirectInfoIndex) const
187 {
188  assert(ADart!=NULL);
189  return static_cast<CAttributeVertex*>(ADart->getDirectInfo(ADirectInfoIndex));
190 }
191 //******************************************************************************
192 INLINE
193 CVertex*
194 CGMapVertex::getDirectInfoAsVertex(CDart* ADart, int ADirectInfoIndex) const
195 {
196  assert(ADart!=NULL);
197  return static_cast<CVertex*>(ADart->getDirectInfo(ADirectInfoIndex));
198 }
199 //******************************************************************************
200 INLINE
202 CGMapVertex::getDirectInfoAsCoord(CDart* ADart, int ADirectInfoIndex) const
203 {
204  assert(ADart!=NULL);
205  return static_cast<TCoordinate*>(ADart->getDirectInfo(ADirectInfoIndex));
206 }
207 //******************************************************************************
208 } // namespace GMap3d
209 //******************************************************************************