Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mesh-diver.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 "vertex.hh"
26 #include <cassert>
27 //******************************************************************************
28 INLINE
30 {}
31 //------------------------------------------------------------------------------
32 INLINE
33 void CMesh1Diver::setIx(int AIx)
34 {
35  assert(0<=AIx && AIx<=FSx);
36  FIx = AIx;
37  FKx1 = FSx==0 ? 0 : FIx/(TCoordinate) FSx;
38  FKx0 = FSx==0 ? 0 : 1-FKx1;
39 }
40 //------------------------------------------------------------------------------
41 INLINE
43 {}
44 //------------------------------------------------------------------------------
45 INLINE
47 {
48  assert(false);
49  return ORIGIN; // Pour éviter un warning.
50 }
51 //------------------------------------------------------------------------------
52 INLINE
53 void CMesh2Diver::setIy(int AIy)
54 {
55  assert(0<=AIy && AIy<=FSy);
56  FIy = AIy;
57  FKy1 = FSy==0 ? 0 : FIy/(TCoordinate) FSy;
58  FKy0 = FSy==0 ? 0 : 1-FKy1;
59 }
60 //------------------------------------------------------------------------------
61 INLINE
63 {}
64 //******************************************************************************
65 //******************************************************************************
66 INLINE
68  const CVertex& AOrigin,
69  const CVertex& AVectorX)
70  : CMesh1Diver(ASx)
71 {
72  FOrigin = AOrigin;
73  FVectorX = AVectorX;
74 }
75 //------------------------------------------------------------------------------
76 INLINE
78 {}
79 //------------------------------------------------------------------------------
80 INLINE
82  const CVertex& AOrigin,
83  const CVertex& AVectorX,
84  const CVertex& AVectorY)
85  : CMesh2Diver(ASx, ASy)
86 {
87  FOrigin = AOrigin;
88  FVectorX = AVectorX;
89  FVectorY = AVectorY;
90 }
91 //------------------------------------------------------------------------------
92 INLINE
94 {}
95 //------------------------------------------------------------------------------
96 INLINE
97 CMesh3BasicDiver::CMesh3BasicDiver(int ASx, int ASy, int ASz,
98  const CVertex& AOrigin,
99  const CVertex& AVectorX,
100  const CVertex& AVectorY,
101  const CVertex& AVectorZ)
102  : CMesh3Diver(ASx, ASy, ASz)
103 {
104  FOrigin = AOrigin;
105  FVectorX = AVectorX;
106  FVectorY = AVectorY;
107  FVectorZ = AVectorZ;
108 }
109 //------------------------------------------------------------------------------
110 INLINE
112 {}
113 //******************************************************************************
114 //******************************************************************************
115 INLINE
117 {
118  assert(ASx>=0);
119 
120  FIx = 0 ;
121  FSx = ASx;
122 }
123 //------------------------------------------------------------------------------
124 INLINE
126 {
127  return FSx;
128 }
129 //------------------------------------------------------------------------------
130 INLINE
132 {
133  return FSy;
134 }
135 //------------------------------------------------------------------------------
136 INLINE
137 CMesh2Diver::CMesh2Diver(int ASx, int ASy)
138  : CMesh1Diver(ASx)
139 {
140  assert(ASy>=0);
141 
142  FIy = 0 ;
143  FSy = ASy;
144 }
145 //------------------------------------------------------------------------------
146 INLINE
147 CMesh3Diver::CMesh3Diver(int ASx, int ASy, int ASz)
148  : CMesh2Diver(ASx, ASy)
149 {
150  assert(ASz>=0);
151 
152  FIz = 0 ;
153  FSz = ASz;
154 }
155 //------------------------------------------------------------------------------
156 INLINE
158 {
159  return FSz;
160 }
161 //------------------------------------------------------------------------------
162 INLINE
163 void CMesh3Diver::setIz(int AIz)
164 {
165  assert(0<=AIz && AIz<=FSz);
166  FIz = AIz;
167  FKz1 = FSz==0 ? 0 : FIz/(TCoordinate) FSz;
168  FKz0 = FSz==0 ? 0 : 1-FKz1;
169 }
170 //******************************************************************************
171 //******************************************************************************
172 INLINE
174 {
175  return FOrigin + FKx1*FVectorX;
176 }
177 //------------------------------------------------------------------------------
178 INLINE
180 {
181  return FOrigin + FKx1*FVectorX + FKy1*FVectorY;
182 }
183 //------------------------------------------------------------------------------
184 INLINE
186 {
187  return FOrigin + FKx1*FVectorX + FKy1*FVectorY + FKz1*FVectorZ;
188 }
189 //******************************************************************************
190 //******************************************************************************
191 INLINE
192 CMesh1VectorDiver::CMesh1VectorDiver(const std::vector<CVertex>& AVector) :
193  CMesh1Diver(AVector.size()-1),
194  FVertices (AVector)
195 {
196 }
197 //------------------------------------------------------------------------------
198 INLINE
200 {
201 }
202 //------------------------------------------------------------------------------
203 INLINE
205 {
206  assert( FIx<=getSx() );
207  return FVertices[FIx];
208 }
209 //******************************************************************************