From 87e2599d27208f31d49099f28eb994306c4a0675 Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 24 Jun 2014 08:50:32 +0000 Subject: [PATCH] Added a missing ImportData in the polygon to tri converstion function in order to allow the copy of most of the data from the polygonal face to the splitted one. --- vcg/complex/algorithms/polygon_support.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/polygon_support.h b/vcg/complex/algorithms/polygon_support.h index 2c9b2103..ac1d8f3a 100644 --- a/vcg/complex/algorithms/polygon_support.h +++ b/vcg/complex/algorithms/polygon_support.h @@ -96,16 +96,17 @@ namespace tri { TessellatePlanarPolygon3(points,faces); tfib = tfi = Allocator::AddFaces(tm,faces.size()/3); for(size_t i = 0; tfi != tm.face.end();++tfi){ - (*tfi).V(0) = &tm.vert[ (*fi).V( faces[i] ) - &(*pm.vert.begin())]; - (*tfi).V(1) = &tm.vert[ (*fi).V( faces[i+1]) - &(*pm.vert.begin())]; - (*tfi).V(2) = &tm.vert[ (*fi).V( faces[i+2]) - &(*pm.vert.begin())]; + tfi->ImportData(*fi); + (*tfi).V(0) = &tm.vert[ tri::Index(pm,(*fi).V( faces[i+0] )) ]; + (*tfi).V(1) = &tm.vert[ tri::Index(pm,(*fi).V( faces[i+1] )) ]; + (*tfi).V(2) = &tm.vert[ tri::Index(pm,(*fi).V( faces[i+2] )) ]; + // set the F flags if( (faces[i ]+1)%points.size() != size_t(faces[i+1])) (*tfi).SetF(0); if( (faces[i+1]+1)%points.size() != size_t(faces[i+2])) (*tfi).SetF(1); if( (faces[i+2]+1)%points.size() != size_t(faces[i ])) (*tfi).SetF(2); i+=3; } - } }