[gts-general] Cutting a model up...
Brought to you by:
popinet
|
From: Stephane P. <s.p...@ni...> - 2001-08-19 21:30:51
|
Hi Paul, > I didn't know whether I should be receiving a GtsTriangle or a GtsFace, so > I tried both but the program fails on the assert - keep_faces == > FALSE. This is set in the GTS function gts_surface_foreach_face. Ok, what you do is allright in principle but the function gts_surface_foreach_face() does not allow you to destroy faces of the surface you are currently traversing (it confuses the hash table used to store the faces of a given surface, hence the test on keep_faces in gts_surface_foreach_face). In the next release (due soon), there will be a gts_surface_foreach_face_remove() function which will allow you to do that. Go and have a look in the CVS repository in the surface.c file you will find this new function. > I have > also tried passing an array to store all the triangles in that I want to > delete and then deleteing them afterwards but this doesn't seem to work > either. Hmm, this is more surprising, this approach should work, you probably want to check that there isn't another problem in your code. > So any pointers as to what I should be doing would be very helpful, but > here are a few questions... > > (1) can I just delete a GtsTriangle, and > (2) does it update the information associated with the surrounding > triangles? Yes, it does. > (3) can I just delete a GtsFace, and > (4) does it update the information associated with the surrounding > triangles? Yes, in the same way. > (5) which should I use - and what is the difference? There is no difference. A GtsFace is also (via inheritance) a GtsTriangle, if you call the gts_object_destroy() function on these objects, there destroy() methods will be called (recursively if necessary), if this is a GtsFace, its destroy() method will be called and update the parent GtsSurface, then the destroy() method for GtsTriangle will be called (because a GtsFace is also a GtsTriangle) which will update the GtsEdge used by this GtsTriangle, and so on until the destroy() method for a GtsObject is called which will free the memory associated with this object. > (6) is there something better to use than gts_surface_foreach_face to get > the information I need. See my point above. Hope this helps, Stephane |