[brlcad-commits] SF.net SVN: brlcad:[37077] brlcad/trunk
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2009-12-30 20:34:04
|
Revision: 37077 http://brlcad.svn.sourceforge.net/brlcad/?rev=37077&view=rev Author: brlcad Date: 2009-12-30 20:33:51 +0000 (Wed, 30 Dec 2009) Log Message: ----------- add a bu_list parameter so we can make rt_nurb_intersect get called recursively when surfaces are split. this is an alternative to the former goto method and quells an unreachable warning. Modified Paths: -------------- brlcad/trunk/include/nurb.h brlcad/trunk/src/librt/primitives/bspline/bspline.cpp brlcad/trunk/src/librt/primitives/bspline/nurb_ray.c Modified: brlcad/trunk/include/nurb.h =================================================================== --- brlcad/trunk/include/nurb.h 2009-12-30 20:32:22 UTC (rev 37076) +++ brlcad/trunk/include/nurb.h 2009-12-30 20:33:51 UTC (rev 37077) @@ -228,7 +228,7 @@ RT_EXPORT BU_EXTERN(struct face_g_snurb *rt_nurb_region_from_srf, (const struct face_g_snurb *srf, int dir, fastf_t param1, fastf_t param2, struct resource *res)); RT_EXPORT BU_EXTERN(struct rt_nurb_uv_hit *rt_nurb_intersect, (const struct face_g_snurb * srf, - plane_t plane1, plane_t plane2, double uv_tol, struct resource *res)); + plane_t plane1, plane_t plane2, double uv_tol, struct resource *res, struct bu_list *plist)); /* nurb_refine.c */ RT_EXPORT BU_EXTERN(struct face_g_snurb *rt_nurb_s_refine, (const struct face_g_snurb *srf, Modified: brlcad/trunk/src/librt/primitives/bspline/bspline.cpp =================================================================== --- brlcad/trunk/src/librt/primitives/bspline/bspline.cpp 2009-12-30 20:32:22 UTC (rev 37076) +++ brlcad/trunk/src/librt/primitives/bspline/bspline.cpp 2009-12-30 20:33:51 UTC (rev 37077) @@ -421,7 +421,7 @@ #define UV_TOL 1.0e-6 /* Paper says 1.0e-4 is reasonable for 1k images, not close up */ hp = rt_nurb_intersect( - s, plane1, plane2, UV_TOL, (struct resource *)ap->a_resource); + s, plane1, plane2, UV_TOL, (struct resource *)ap->a_resource, NULL); while (hp != (struct rt_nurb_uv_hit *)0) { struct rt_nurb_uv_hit * o; Modified: brlcad/trunk/src/librt/primitives/bspline/nurb_ray.c =================================================================== --- brlcad/trunk/src/librt/primitives/bspline/nurb_ray.c 2009-12-30 20:32:22 UTC (rev 37076) +++ brlcad/trunk/src/librt/primitives/bspline/nurb_ray.c 2009-12-30 20:33:51 UTC (rev 37077) @@ -333,7 +333,7 @@ * R T _ N U R B _ I N T E R S E C T */ struct rt_nurb_uv_hit * -rt_nurb_intersect(const struct face_g_snurb *srf, fastf_t *plane1, fastf_t *plane2, double uv_tol, struct resource *res) +rt_nurb_intersect(const struct face_g_snurb *srf, fastf_t *plane1, fastf_t *plane2, double uv_tol, struct resource *res, struct bu_list *plist) { struct rt_nurb_uv_hit * h; struct face_g_snurb * psrf, @@ -345,18 +345,21 @@ vmax; fastf_t u[2], v[2]; - struct bu_list plist; + struct bu_list rni_plist; NMG_CK_SNURB(srf); h = (struct rt_nurb_uv_hit *) 0; - BU_LIST_INIT( &plist ); + if (plist == NULL) { + plist = &rni_plist; + BU_LIST_INIT( plist ); + } /* project the surface to a 2 dimensional problem */ /* NOTE that this gives a single snurb back, NOT a list */ psrf = rt_nurb_project_srf( srf, plane2, plane1, res ); psrf->dir = 1; - BU_LIST_APPEND( &plist, &psrf->l ); + BU_LIST_APPEND( plist, &psrf->l ); if ( RT_G_DEBUG & DEBUG_SPLINE ) rt_nurb_s_print("srf", psrf); @@ -364,8 +367,7 @@ /* This list starts out with only a single snurb, * but more may be added on as work progresses. */ - top: - while ( BU_LIST_WHILE( psrf, face_g_snurb, &plist ) ) { + while ( BU_LIST_WHILE( psrf, face_g_snurb, plist ) ) { int flat; BU_LIST_DEQUEUE( &psrf->l ); @@ -400,13 +402,17 @@ rt_nurb_clip_srf( psrf, dir, &smin, &smax); if ( (smax - smin) > .8) { + struct rt_nurb_uv_hit *hp; + /* Split surf, requeue both sub-surfs at head */ /* New surfs will have same dir as arg, here */ if ( RT_G_DEBUG & DEBUG_SPLINE ) bu_log( "splitting this surface\n" ); - rt_nurb_s_split( &plist, psrf, dir, res ); + rt_nurb_s_split( plist, psrf, dir, res ); rt_nurb_free_snurb( psrf, res ); - goto top; + + hp = rt_nurb_intersect(srf, plane1, plane2, uv_tol, res, plist); + return hp; } if ( smin > 1.0 || smax < 0.0 ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |