~ubuntu-branches/ubuntu/lucid/meshlab/lucid

« back to all changes in this revision

Viewing changes to meshlab/src/meshlabplugins/filter_isoparametrization/diam_parametrization.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-10-08 16:40:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091008164041-0c2ealqv8b8uc20c
Tags: 1.2.2-1
* New upstream version
* Do not build filter_isoparametrization because liblevmar dependency
  is not (yet) in Debian
* Fix compilation with gcc-4.4, thanks to Jonathan Liu for the patch
  (closes: #539544)
* rules: Add compiler variables to the qmake call (for testing with new
  GCC versions)
* io_3ds.pro: Make LIBS and INCLUDEPATH point to Debian version of lib3ds
* io_epoch.pro: Make LIBS point to Debian version of libbz2
* control:
  - Move Homepage URL to the source package section
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <algorithm>
 
2
#include <time.h>
 
3
#include <vcg/complex/trimesh/refine.h>
 
4
#include <vcg/simplex/face/pos.h>
 
5
#include <vcg/space/color4.h>
 
6
#include <vcg/space/intersection2.h>
 
7
 
 
8
#ifndef _DIAMONDPARA
 
9
#define _DIAMONDPARA
 
10
 
 
11
class DiamondParametrizator
 
12
{
 
13
        typedef IsoParametrization::CoordType CoordType;
 
14
        typedef IsoParametrization::ScalarType ScalarType;
 
15
 
 
16
        IsoParametrization *isoParam;
 
17
 
 
18
        ///data used for splitting
 
19
        typedef std::pair<int,int> EdgeKey;
 
20
 
 
21
        ///interpolation data
 
22
        typedef struct InterpData
 
23
        {
 
24
                float alpha;
 
25
                int I;
 
26
                vcg::Point2<float> UV;
 
27
        };
 
28
 
 
29
        std::map<EdgeKey,InterpData> alphaMap;
 
30
 
 
31
        ///data used to store an retrieve edges
 
32
        //typedef std::pair<AbstractFace*,int> TriEdge;
 
33
        //std::vector<DiamondPatch> DDAdiacency;
 
34
        //std::map<TriEdge,int> edgeMap;
 
35
        //int sampleSize;
 
36
 
 
37
        template <class FaceType>
 
38
        int AssignDiamond(FaceType *face)
 
39
        {
 
40
                ScalarType val=(ScalarType)1.0/(ScalarType)3.0;
 
41
                CoordType bary3d(val,val,val);
 
42
                int I_interp;
 
43
                vcg::Point2<ScalarType> UV_interp;
 
44
                isoParam->Phi(face,bary3d,I_interp,UV_interp);
 
45
                int D_interp=isoParam->getHDiamIndex(I_interp,UV_interp);
 
46
                face->WT(0).N()=D_interp;
 
47
                face->WT(1).N()=D_interp;
 
48
                face->WT(2).N()=D_interp;
 
49
                return D_interp;
 
50
        }
 
51
 
 
52
        ///associate the diamond in which a face belongs to
 
53
        void AssociateDiamond()
 
54
        {
 
55
                ParamMesh *to_param=isoParam->ParaMesh();
 
56
                typedef ParamMesh::FaceType FaceType;
 
57
                
 
58
                ///first step first associating initial faces to diamond
 
59
                for (unsigned int i=0;i<to_param->face.size();i++)
 
60
                {
 
61
                        FaceType *curr=&to_param->face[i];
 
62
                        AssignDiamond(curr);
 
63
                        curr->C()=colorDiam[curr->WT(0).N()];
 
64
                }
 
65
        }
 
66
 
 
67
        void InterpEdge(const ParamFace *f,const int &index_edge,
 
68
                                        const float &alpha,int &I,vcg::Point2<ScalarType> &UV)
 
69
        {
 
70
                #ifndef NDEBUG
 
71
                float eps=0.00001f;
 
72
                #endif
 
73
                int index0=index_edge;
 
74
                int index1=(index_edge+1)%3;
 
75
                CoordType bary=CoordType(0,0,0);
 
76
                assert((alpha>=0)&&(alpha<=1));
 
77
                bary.V(index0)=alpha;
 
78
                bary.V(index1)=((ScalarType)1.0-alpha);
 
79
                isoParam->Phi(f,bary,I,UV);
 
80
                assert((UV.X()>=0)&&(UV.Y()>=0)&&(UV.X()<=1)&&(UV.Y()<=1)&&(UV.X()+UV.Y()<=1+eps));
 
81
        }
 
82
 
 
83
template <class FaceType>
 
84
vcg::Point2f QuadCoord(FaceType * curr,const int &vert_num)
 
85
{
 
86
        typedef typename FaceType::VertexType VertexType;
 
87
        typedef typename FaceType::ScalarType ScalarType;
 
88
 
 
89
        VertexType* v=curr->V(vert_num);
 
90
        
 
91
        int DiamIndex=curr->WT(0).N(); ///get index of diamond associated to the face
 
92
        assert((curr->WT(0).N()==curr->WT(1).N())&&(curr->WT(1).N()==curr->WT(2).N()));
 
93
 
 
94
        ///transform to quad coordinates
 
95
        int I=v->T().N();
 
96
        vcg::Point2f UV=v->T().P();
 
97
        
 
98
        ///transform in diamond coordinates
 
99
        vcg::Point2f UVDiam,UVQuad;
 
100
        isoParam->GE1(I,UV,DiamIndex,UVDiam);
 
101
        
 
102
        ///transform in quad coordinates
 
103
        isoParam->GE1Quad(DiamIndex,UVDiam,UVQuad);
 
104
 
 
105
        return (UVQuad);
 
106
}
 
107
 
 
108
template <class FaceType>
 
109
        bool To_Split(FaceType * curr,const float       &border,
 
110
                                  bool to_split[3],InterpData Idata[3])
 
111
        {
 
112
                to_split[0]=false;
 
113
                to_split[1]=false;
 
114
                to_split[2]=false;
 
115
 
 
116
                typedef typename FaceType::VertexType VertexType;
 
117
                typedef typename FaceType::ScalarType ScalarType;
 
118
 
 
119
                /*ParamMesh *to_param=isoParam->ParaMesh();*/
 
120
 
 
121
                /*int DiamIndex=curr->WT(0).N(); *////get index of diamond associated to the face
 
122
                assert((curr->WT(0).N()==curr->WT(1).N())&&(curr->WT(1).N()==curr->WT(2).N()));
 
123
                
 
124
                vcg::Point2f UVQuad[3];
 
125
 
 
126
                UVQuad[0]=QuadCoord(curr,0);
 
127
                UVQuad[1]=QuadCoord(curr,1);
 
128
                UVQuad[2]=QuadCoord(curr,2);
 
129
 
 
130
                ///outern border
 
131
                vcg::Box2<ScalarType> bbox,bbox0;
 
132
                bbox.Add(vcg::Point2f(-border,-border));
 
133
                bbox.Add(vcg::Point2f(1+border,1+border));
 
134
                bbox0.Add(vcg::Point2f(0,0));
 
135
                bbox0.Add(vcg::Point2f(1,1));
 
136
                
 
137
                if (bbox.IsIn(UVQuad[0])&&bbox.IsIn(UVQuad[1])&&bbox.IsIn(UVQuad[2]))
 
138
                        return false; ///no intersection is possible
 
139
 
 
140
                ///else test which edges must be splitted               
 
141
                //vcg::Segment2<float> border_seg[4];
 
142
                vcg::Line2<float> border_seg[4];
 
143
                border_seg[0].Set(vcg::Point2f(0,0),vcg::Point2f(1,0));
 
144
                border_seg[1].Set(vcg::Point2f(1,0),vcg::Point2f(0,1));
 
145
                border_seg[2].Set(vcg::Point2f(0,1),vcg::Point2f(1,0));
 
146
                border_seg[3].Set(vcg::Point2f(0,0),vcg::Point2f(0,1));
 
147
                bool intersected=false;
 
148
                for (int edge=0;edge<3;edge++)
 
149
                {       
 
150
                        vcg::Segment2<float> curr_edge=vcg::Segment2<float>(UVQuad[edge],UVQuad[(edge+1)%3]);
 
151
                        float dist_medium=1.0;
 
152
                        for (int j=0;j<4;j++)
 
153
                        {
 
154
                                vcg::Point2f p_inters;
 
155
                                vcg::Line2<float> curr_border=border_seg[j];
 
156
                                bool intersect=LineSegmentIntersection(curr_border,curr_edge,p_inters);
 
157
 
 
158
                                float l_test0=(curr_edge.P0()-p_inters).Norm();
 
159
                                float l_test1=(curr_edge.P1()-p_inters).Norm();
 
160
                                float l_test=std::min(l_test0,l_test1);
 
161
        
 
162
                                const ScalarType _EPS=(ScalarType)0.0001;
 
163
                                if ((intersect)&&(l_test>=_EPS))
 
164
                                {
 
165
                                        float lenght=curr_edge.Length();
 
166
                                        float dist=((curr_edge.P0()-p_inters).Norm());
 
167
                                        float Ndist=dist/lenght;
 
168
                                        float alpha=1.0-Ndist;
 
169
                                        float dist_medium1=fabs(alpha-0.5);
 
170
                                        
 
171
                                        if (dist_medium1<dist_medium)
 
172
                                        {
 
173
                                                dist_medium=dist_medium1;
 
174
                                                int I;
 
175
                                                vcg::Point2f UV;
 
176
                                                InterpEdge(curr,edge,alpha,I,UV);
 
177
                                                Idata[edge].alpha=alpha;
 
178
                                                Idata[edge].I=I;
 
179
                                                Idata[edge].UV=UV;
 
180
                                                to_split[edge]=true;
 
181
                                                intersected=true;
 
182
                                        }
 
183
                                }
 
184
                        }
 
185
                }
 
186
                if(!intersected)
 
187
                        assert(0);
 
188
                return(intersected);
 
189
        }
 
190
 
 
191
        // Basic subdivision class
 
192
        // This class must provide methods for finding the position of the newly created vertices
 
193
        // In this implemenation we simply put the new vertex in the MidPoint position.
 
194
        // Color and TexCoords are interpolated accordingly.
 
195
        template<class MESH_TYPE>
 
196
        struct SplitMidPoint : public   std::unary_function<vcg::face::Pos<typename MESH_TYPE::FaceType> ,  typename MESH_TYPE::CoordType >
 
197
        {
 
198
                typedef typename MESH_TYPE::VertexType VertexType;
 
199
                typedef typename MESH_TYPE::FaceType FaceType;
 
200
                typedef typename MESH_TYPE::CoordType CoordType;
 
201
 
 
202
                std::map<EdgeKey,InterpData> *alphaMap;
 
203
                IsoParametrization *isoParam;
 
204
 
 
205
 
 
206
 
 
207
                void operator()(typename MESH_TYPE::VertexType &nv, vcg::face::Pos<typename MESH_TYPE::FaceType>  ep)
 
208
                {
 
209
                        //printf("DONE\n");
 
210
 
 
211
                        ParamMesh *to_param=isoParam->ParaMesh();
 
212
 
 
213
                        ///get eth value on which the edge must be splitted
 
214
                        VertexType* v0=ep.f->V(ep.z);
 
215
                        VertexType* v1=ep.f->V1(ep.z);
 
216
 
 
217
                        int i0=IndexFromPointer(v0,to_param);
 
218
                        int i1=IndexFromPointer(v1,to_param);
 
219
 
 
220
                        assert(v0!=v1);
 
221
                        EdgeKey k;
 
222
                        int index0=ep.z;
 
223
                        int index1=(ep.z+1)%3;
 
224
 
 
225
                        if (i0>i1)
 
226
                        {
 
227
                                std::swap(v0,v1);
 
228
                                std::swap(i0,i1);
 
229
                                std::swap(index0,index1);
 
230
                        }
 
231
 
 
232
                        k=EdgeKey(i0,i1);
 
233
                        std::map<EdgeKey,InterpData>::iterator ItE=alphaMap->find(k);
 
234
                        assert(ItE!=alphaMap->end());
 
235
                        InterpData interp=(*ItE).second;
 
236
                        float alpha=interp.alpha;
 
237
                        assert((alpha>=0)&&(alpha<=1));
 
238
                        nv.P()= v0->P()*alpha+v1->P()*(1.0-alpha);
 
239
                        nv.RPos= v0->RPos*alpha+v1->RPos*(1.0-alpha);
 
240
 
 
241
                        if( MESH_TYPE::HasPerVertexNormal())
 
242
                                nv.N()=v0->N()*alpha+v1->N()*((ScalarType)1.0-alpha);
 
243
                        if( MESH_TYPE::HasPerVertexColor())
 
244
                        {
 
245
                                CoordType color=CoordType(v0->C().X(),v0->C().Y(),v0->C().Z());
 
246
                                color=color*alpha+color*((ScalarType)1.0-alpha);
 
247
                                nv.C()=vcg::Color4b((unsigned char)color.X(),(unsigned char)color.Y(),(unsigned char)color.Z(),(unsigned char)255);
 
248
                        }
 
249
 
 
250
                        nv.T().N()=interp.I;
 
251
                        nv.T().P()=interp.UV;
 
252
                }
 
253
 
 
254
                vcg::TexCoord2<float> WedgeInterp(vcg::TexCoord2<float> &t0, vcg::TexCoord2<float> &t1)
 
255
                {
 
256
                        vcg::TexCoord2<float> tmp;
 
257
                        assert(t0.n()== t1.n());
 
258
                        tmp.n()=t0.n(); 
 
259
                        tmp.t()=(t0.t()+t1.t())/2.0;
 
260
                        return tmp;
 
261
                }
 
262
        };
 
263
 
 
264
 
 
265
 
 
266
        template <class MESH_TYPE>//, class FLT>
 
267
        class EdgePredicate
 
268
        {
 
269
                typedef typename MESH_TYPE::VertexType VertexType;
 
270
                typedef typename MESH_TYPE::FaceType FaceType;
 
271
        public:
 
272
                std::map<EdgeKey,InterpData> *alphaMap;
 
273
                IsoParametrization *isoParam;
 
274
 
 
275
                bool operator()(vcg::face::Pos<typename MESH_TYPE::FaceType> ep) const
 
276
                {
 
277
                        ParamMesh *to_param=isoParam->ParaMesh();
 
278
 
 
279
                        VertexType* v0=ep.f->V(ep.z);
 
280
                        VertexType* v1=ep.f->V1(ep.z);
 
281
 
 
282
                        int i0=IndexFromPointer(v0,to_param);
 
283
                        int i1=IndexFromPointer(v1,to_param);
 
284
 
 
285
                        assert(v0!=v1);
 
286
                        EdgeKey k;
 
287
 
 
288
                        if (i0>i1)
 
289
                        {
 
290
                                std::swap(v0,v1);
 
291
                                std::swap(i0,i1);
 
292
                        }
 
293
 
 
294
                        k=EdgeKey(i0,i1);
 
295
                        std::map<EdgeKey,InterpData>::iterator ItE=alphaMap->find(k);
 
296
                        bool to_split=(ItE!=alphaMap->end());
 
297
                        return (to_split);
 
298
                }
 
299
        };
 
300
 
 
301
        static int IndexFromPointer(ParamVertex * v,ParamMesh *mesh)
 
302
        {
 
303
                int index=v-&(*mesh->vert.begin());
 
304
                return (index);
 
305
        }
 
306
 
 
307
        void InsertInterpData(ParamFace *curr,const int &edge,
 
308
                                                  ParamMesh *to_param,InterpData &Idata)
 
309
        {
 
310
                ParamVertex *v0=curr->V(edge);
 
311
                ParamVertex *v1=curr->V1(edge);
 
312
                int i0=IndexFromPointer(v0,to_param);
 
313
                int i1=IndexFromPointer(v1,to_param);
 
314
                if (i0>i1)
 
315
                {
 
316
                        std::swap(v0,v1);
 
317
                        std::swap(i0,i1);
 
318
                        Idata.alpha=(ScalarType)1.0-Idata.alpha;
 
319
                        assert((Idata.alpha>=0)&&(Idata.alpha<=1));
 
320
                }       
 
321
                EdgeKey k=EdgeKey(i0,i1);
 
322
                std::map<EdgeKey,InterpData>::iterator ItE=alphaMap.find(k);
 
323
                if(ItE!=alphaMap.end())
 
324
                {
 
325
                        if (fabs((*ItE).second.alpha-0.5)>fabs(Idata.alpha-0.5))
 
326
                        {
 
327
                                (*ItE).second.alpha=Idata.alpha;
 
328
                                (*ItE).second.I=Idata.I;
 
329
                                (*ItE).second.UV=Idata.UV;
 
330
                        }       
 
331
                }
 
332
                else
 
333
                        alphaMap.insert(std::pair<EdgeKey,InterpData>(k,Idata));
 
334
        }
 
335
        
 
336
        bool Split(const ScalarType &border)
 
337
        {
 
338
                alphaMap.clear();
 
339
 
 
340
                ParamMesh *to_param=isoParam->ParaMesh();
 
341
 
 
342
                typedef ParamMesh::VertexType VertexType;
 
343
                typedef ParamMesh::FaceType FaceType;
 
344
                SplitMidPoint<ParamMesh> splMd;
 
345
                EdgePredicate<ParamMesh> eP;
 
346
 
 
347
                ///second step.. test the split if needed
 
348
                for (unsigned int i=0;i<to_param->face.size();i++)
 
349
                {
 
350
                        ///get the current face and test the edges
 
351
                        FaceType * curr=&to_param->face[i];
 
352
                        InterpData Idata[3];
 
353
                        bool to_split[3];
 
354
                        bool is_out=To_Split<FaceType>(curr,border,to_split,Idata);
 
355
                        if (is_out){
 
356
                                for (int edge=0;edge<3;edge++)
 
357
                                        if (to_split[edge])
 
358
                                                InsertInterpData(curr,edge,to_param,Idata[edge]);
 
359
                        }
 
360
                        
 
361
                }
 
362
                splMd.isoParam=isoParam;
 
363
                splMd.alphaMap=&alphaMap;
 
364
                eP.isoParam=isoParam;
 
365
                eP.alphaMap=&alphaMap;
 
366
 
 
367
                /*int f0=to_param->fn;*/
 
368
                bool done=vcg::RefineE<ParamMesh,SplitMidPoint<ParamMesh>,EdgePredicate<ParamMesh> >(*to_param,splMd,eP);
 
369
                #ifndef _MESHLAB
 
370
                printf("FACE ADDED  %d \n",to_param->fn-f0);
 
371
                #endif
 
372
                return done;
 
373
                
 
374
        }
 
375
        
 
376
        void SetWedgeCoords(const ScalarType &border)
 
377
        {
 
378
                typedef ParamMesh::VertexType VertexType;
 
379
                typedef ParamMesh::FaceType FaceType;
 
380
        
 
381
                ParamMesh *to_param=isoParam->ParaMesh();
 
382
                
 
383
                for (unsigned int i=0;i<to_param->face.size();i++)
 
384
                {
 
385
                        ///get the current face and test the edges
 
386
                        FaceType * curr=&to_param->face[i];
 
387
                        for (int j=0;j<3;j++)
 
388
                        {
 
389
                                vcg::Point2f QCoord=QuadCoord(curr,j);
 
390
                                ///transform from [ -border,1 + border] to [0,1]
 
391
                                QCoord+=vcg::Point2f(border,border);
 
392
                                QCoord/=(ScalarType)1.0+(ScalarType)2.0*border;
 
393
                                assert((QCoord.X()>=0)&&(QCoord.X()<=1)&&(QCoord.Y()>=0)&&(QCoord.Y()<=1));
 
394
                                curr->WT(j).P()=QCoord;
 
395
                                ///and finally set for global texture coords
 
396
                        }
 
397
                }
 
398
        }
 
399
 
 
400
        int num_diamonds;
 
401
 
 
402
public:
 
403
        
 
404
        std::vector<vcg::Color4b > colorDiam;
 
405
 
 
406
        ///initialize the parameterization
 
407
        void Init(IsoParametrization *_isoParam)
 
408
        {
 
409
        
 
410
                isoParam=_isoParam;
 
411
 
 
412
                ///COUNT THE NUMBER OF EDGES
 
413
                num_diamonds=0;
 
414
                for (unsigned int i=0;i<isoParam->AbsMesh()->face.size();i++)
 
415
                {
 
416
                        AbstractFace *f=&isoParam->AbsMesh()->face[i];
 
417
                        for (int j=0;j<3;j++)
 
418
                                if (f->FFp(j)<f)
 
419
                                        num_diamonds++;
 
420
                }
 
421
 
 
422
                colorDiam.resize(num_diamonds);
 
423
                srand(clock());
 
424
                for (unsigned int i=0;i<colorDiam.size();i++)
 
425
                        colorDiam[i]=vcg::Color4b(rand()%255,rand()%255,rand()%255,255);
 
426
 
 
427
        }
 
428
 
 
429
        //void Draw()
 
430
        //{
 
431
        //      ParamMesh *to_param=isoParam->ParaMesh();
 
432
        //      //vcg::tri::UpdateNormals<ParamMesh>::PerFaceNormalized(*to_param);
 
433
        //      glDepthRange(0.01,1.0);
 
434
        //      glEnable(GL_LIGHTING);
 
435
        //      glEnable(GL_LIGHT0);
 
436
        //      glEnable(GL_NORMALIZE);
 
437
        //      glBegin(GL_TRIANGLES);
 
438
        //      for (int i=0;i<to_param->face.size();i++)
 
439
        //      {
 
440
 
 
441
        //              /*vcg::glColor(to_param->face[i].C());*/
 
442
 
 
443
        //              CoordType p0=to_param->face[i].V(0)->P();
 
444
        //              CoordType p1=to_param->face[i].V(1)->P();
 
445
        //              CoordType p2=to_param->face[i].V(2)->P();
 
446
        //              CoordType norm=(p1-p0)^(p2-p0);
 
447
        //              norm.Normalize();
 
448
        //              vcg::glNormal(norm);
 
449
        //              vcg::Point2f t0=to_param->face[i].WT(0).P();
 
450
        //              vcg::Point2f t1=to_param->face[i].WT(1).P();
 
451
        //              vcg::Point2f t2=to_param->face[i].WT(2).P();
 
452
        //              vcg::Color4b c0,c1,c2;
 
453
        //              if ((t0.X()< 0)||(t0.Y()< 0)||(t0.X()>1.0)||(t0.Y()>1.0))
 
454
        //              c0=vcg::Color4b(0,0,255,255);
 
455
        //              else
 
456
        //              c0=vcg::Color4b(t0.X()*255.0,t0.Y()*255.0,0,255);
 
457
        //              if ((t1.X()< 0)||(t1.Y()< 0)||(t1.X()>1.0)||(t1.Y()>1.0))
 
458
        //              c1=vcg::Color4b(0,0,255,255);
 
459
        //              else
 
460
        //              c1=vcg::Color4b(t1.X()*255.0,t1.Y()*255.0,0,255);
 
461
        //              if ((t2.X()< 0)||(t2.Y()< 0)||(t2.X()>1.0)||(t2.Y()>1.0))
 
462
        //              c2=vcg::Color4b(0,0,255,255);
 
463
        //              else
 
464
        //              c2=vcg::Color4b(t2.X()*255.0,t2.Y()*255.0,0,255);
 
465
        //              vcg::glColor(c0);
 
466
        //              vcg::glVertex(to_param->face[i].V(0)->P());
 
467
        //              vcg::glColor(c1);
 
468
        //              vcg::glVertex(to_param->face[i].V(1)->P());
 
469
        //              vcg::glColor(c2);
 
470
        //              vcg::glVertex(to_param->face[i].V(2)->P());
 
471
        //      }
 
472
        //      glEnd();
 
473
 
 
474
        //      /*glDepthRange(0,0.99999);
 
475
        //      glDisable(GL_LIGHTING);
 
476
        //      glDisable(GL_LIGHT0);
 
477
        //      glDisable(GL_NORMALIZE);
 
478
        //      glLineWidth(1);
 
479
        //      glColor3d(0,0,0);
 
480
        //      for (int i=0;i<to_param->face.size();i++)
 
481
        //      {
 
482
        //              glBegin(GL_LINE_LOOP);
 
483
        //              CoordType p0=to_param->face[i].V(0)->P();
 
484
        //              CoordType p1=to_param->face[i].V(1)->P();
 
485
        //              CoordType p2=to_param->face[i].V(2)->P();
 
486
        //              vcg::glVertex(to_param->face[i].V(0)->P());
 
487
        //              vcg::glVertex(to_param->face[i].V(1)->P());
 
488
        //              vcg::glVertex(to_param->face[i].V(2)->P());
 
489
        //              glEnd();
 
490
        //      }*/
 
491
        //      
 
492
        //      glDepthRange(0.0,1.0);
 
493
        //}
 
494
 
 
495
        
 
496
 
 
497
        ///set the vertex coordinates
 
498
        void SetCoordinates(const ScalarType &border=0.01)
 
499
        {
 
500
                std::vector<vcg::Color4b > colorDiam;
 
501
                
 
502
                //ParamMesh *to_param=isoParam->ParaMesh();
 
503
 
 
504
                typedef ParamMesh::FaceType FaceType;
 
505
                typedef ParamMesh::VertexType VertexType;
 
506
 
 
507
                bool done=true;
 
508
                /*int n0=to_param->fn;*/
 
509
                while (done)
 
510
                {
 
511
                        AssociateDiamond();
 
512
                        done=Split(border);
 
513
                        isoParam->Update();
 
514
                }
 
515
 
 
516
                AssociateDiamond();
 
517
                SetWedgeCoords(border);
 
518
        }
 
519
 
 
520
};
 
521
#endif
 
 
b'\\ No newline at end of file'