[gts-general] Cutting a model up...
Brought to you by:
popinet
|
From: Paul <pau...@st...> - 2001-08-17 12:27:58
|
I want my program to be able to cut up a model using a very simple method
- by removing all triangles containing a point on one side of a plane.
I initially tried calling:
gts_surface_foreach_face(s, (GtsFunc) cut_model, NULL);
with the function cut_model being:
static void cut_model( GtsTriangle *t, NULL )
{
GtsPoint * p1, * p2, * p3;
gts_triangle_vertices (t,
(GtsVertex **) &p1,
(GtsVertex **) &p2,
(GtsVertex **) &p3);
if (p1->y < 0 || p2->y < 0 || p3->y < 0) {
gts_object_destroy(GTS_OBJECT(t));
}
}
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. 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.
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?
(3) can I just delete a GtsFace, and
(4) does it update the information associated with the surrounding
triangles?
(5) which should I use - and what is the difference?
(6) is there something better to use than gts_surface_foreach_face to get
the information I need.
BTW I don't want to use boolean operations (not sure I can) because I
don't want the structure changed.
Thanks,
Paul
|