View Single Post
Old 19th January 2004, 02:59 PM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: ac_object_get_triangle_surfaces vs ac_object_get_surface

Hi Jeff,

Sorry about the delay, the office moving is almost complete now.

ac_object_get_triangle_surfaces uses surface_get_triangulations so I can't only think that there may be non-poly or surfaces with < 3 vertices.
Remember that the triangulation of a surface may fail fail (you get an empty list returned).

ac_object_get_triangle_surfaces looks like this:

Code:
Prototype List *ac_object_get_triangle_surfaces(ACObject *ob)  // free with ac_surfacelist_free(&result)
{
List *tri = NULL;
int n = 0;

	for (List *sp = ob->surfacelist; sp != NULL; sp = sp->next, n++)
		{
		Surface *s = (Surface *)sp->data;

		if ((s->numvert < 3) || (s->type != SURFACE_POLYGON) )
			continue;

		if (s->numvert > 3)
			{
			List *slist = (List *)surface_get_triangulations(s);
			list_prepend_list(&tri, slist);			
			}
		else
			{
			Surface *ns = surface_clone(s, ob);
	
			list_add_item_head(&tri, (void *)ns);
			}

		} // end for all surfaces in object

	return(tri);
}
Andy is offline   Reply With Quote