Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: stl map using facet_handle as key
- Date: Wed, 13 Dec 2006 07:40:54 +0100
Hi, all,
I made a stl map using facet_handle as key gotten from polyhedron_3 by
polyhedron.facet_begin() ... polyhedron.facet_end() manner in a for-loop.
I tried to use the map to get the values
using edges_iterator->facet() in while-loop of edge_iterator in another
function.
And I found the same face_handles are returned in every turn of this loop,
so the values given by the map are always the same value.
How I fix this problem?
I show parts of my programs:
==========================================================
class SurfaceMesh{
...
Polyhedron_3 s;
...
};
==========================================================
struct ControlPointsOfPNFacet
{
Point p[ 10 ];
};
class PT{
...
SurfaceMesh originalSurface;
std::map< FacetHandle, ControlPointsOfPNFacet, HandleLess > controlPoint;
Polyhedron_3 polygonizedPT;
...
typedef CGAL::Tag_true Supports_removal;
typedef CGAL::Tag_true Supports_halfedge_facet;
...
/* making a map */
void calcControlPoints( SurfaceMesh &S );
/* using a map */
void calcSubtriangles( Polyhedron_3 &P );
...
...
/* this function is called in another function */
void setOriginalSurface( const SurfaceMesh &sm ){
...
originalSurface = sm;
polygonizedPT = sm.s;
calcControlPoints( originalSurface );
...
}
/* this function is called in another function */
void setLevelOfDetail(){
...
polygonizedPT.clear();
polygonizedPT = originalSurface.s;
calcSubtriangles( polygonizedPT );
}
...
};
void PT::calcControlPoints( SurfaceMesh &S ){
for( FacetIt fit = S.s.facets_begin(); fit != S.s.facets_end(); fit++ ){
HalfedgeAroundFacetCirculator heCir = fit->facet_begin();
ControlPointsOfPNFacet cp;
/* calculate the values of cp */
cp.p[0] = ...;
...
cp.p[9] = ...;
controlPoint.insert( std::make_pair( fit, cp ) );
}
void PT::calcSubtriangles( Polyhedron_3 &P ){
EdgeIterator eit = P.halfedges_begin();
HalfedgeIterator lastE = P.halfedges_end();
FacetHandle f0;
while( eit != lastE ){
f0 = eit->facet();
/* I displayed controlPoint[ f0 ].p[ 0 ] here by std::cout and found
this problem. */
if( eit->vertex()->point() == controlPoint[ f0 ].p[ 0 ] ){
...
}
...
eit++;
}
...
}
==========================================================
In the above function calcSubtriangles(), eit changes correctly ( I think ).
But the f0 doesn't seem to change...
Regards,
NAGAI, Yukie
- stl map using facet_handle as key, ueberweise, 12/13/2006
- <Possible follow-up(s)>
- Re: stl map using facet_handle as key, ueberweise, 12/13/2006
Archive powered by MHonArc 2.6.16.