Revision: 69083 http://sourceforge.net/p/brlcad/code/69083 Author: starseeker Date: 2016-10-16 21:11:29 +0000 (Sun, 16 Oct 2016) Log Message: ----------- bezier functions group logically with the rest of bspline...
Modified Paths: -------------- brlcad/trunk/include/nmg.h brlcad/trunk/src/librt/bezier.c brlcad/trunk/src/librt/librt_private.h brlcad/trunk/src/librt/primitives/bspline/nurb_bezier.c brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c Modified: brlcad/trunk/include/nmg.h =================================================================== --- brlcad/trunk/include/nmg.h 2016-10-16 21:06:49 UTC (rev 69082) +++ brlcad/trunk/include/nmg.h 2016-10-16 21:11:29 UTC (rev 69083) @@ -918,8 +918,25 @@ point2d_t *ctl; }; +/** + * * Evaluate a Bezier curve at a particular parameter value. Fill in + * * control points for resulting sub-curves if "Left" and "Right" are + * * non-null. + * */ +RT_EXPORT extern void bezier(point2d_t *V, int degree, double t, point2d_t *Left, point2d_t *Right, point2d_t eval_pt, point2d_t normal ); +/** + * * Given an equation in Bernstein-Bezier form, find all of the roots + * * in the interval [0, 1]. Return the number of roots found. + * */ +RT_EXPORT extern int bezier_roots(point2d_t *w, int degree, point2d_t **intercept, point2d_t **normal, point2d_t ray_start, point2d_t ray_dir, point2d_t ray_perp, int depth, fastf_t epsilon); +/** + * * subdivide a 2D bezier curve at t=0.5 + * */ +RT_EXPORT extern struct bezier_2d_list *bezier_subdivide(struct bezier_2d_list *bezier_hd, int degree, fastf_t epsilon, int depth); + + /* TODO - these structs and ray_in_rpp are versions of librt functionality, * and we need to think about how/where to merge them into a common function * and struct that are available to both libraries without introducing a Modified: brlcad/trunk/src/librt/bezier.c =================================================================== --- brlcad/trunk/src/librt/bezier.c 2016-10-16 21:06:49 UTC (rev 69082) +++ brlcad/trunk/src/librt/bezier.c 2016-10-16 21:11:29 UTC (rev 69083) @@ -40,9 +40,6 @@ #include "nmg.h" #include "raytrace.h" -#include "./librt_private.h" - - #define SGN(_x) (((_x)<0) ? -1 : 1) #define MAXDEPTH 64 Modified: brlcad/trunk/src/librt/librt_private.h =================================================================== --- brlcad/trunk/src/librt/librt_private.h 2016-10-16 21:06:49 UTC (rev 69082) +++ brlcad/trunk/src/librt/librt_private.h 2016-10-16 21:11:29 UTC (rev 69083) @@ -132,25 +132,7 @@ int num_points); -/** - * Evaluate a Bezier curve at a particular parameter value. Fill in - * control points for resulting sub-curves if "Left" and "Right" are - * non-null. - */ -extern void bezier(point2d_t *V, int degree, double t, point2d_t *Left, point2d_t *Right, point2d_t eval_pt, point2d_t normal ); -/** - * Given an equation in Bernstein-Bezier form, find all of the roots - * in the interval [0, 1]. Return the number of roots found. - */ -extern int bezier_roots(point2d_t *w, int degree, point2d_t **intercept, point2d_t **normal, point2d_t ray_start, point2d_t ray_dir, point2d_t ray_perp, int depth, fastf_t epsilon); - -/** - * subdivide a 2D bezier curve at t=0.5 - */ -extern struct bezier_2d_list *bezier_subdivide(struct bezier_2d_list *bezier_hd, int degree, fastf_t epsilon, int depth); - - /* db_fullpath.c */ /** Modified: brlcad/trunk/src/librt/primitives/bspline/nurb_bezier.c =================================================================== --- brlcad/trunk/src/librt/primitives/bspline/nurb_bezier.c 2016-10-16 21:06:49 UTC (rev 69082) +++ brlcad/trunk/src/librt/primitives/bspline/nurb_bezier.c 2016-10-16 21:11:29 UTC (rev 69083) @@ -108,19 +108,19 @@ { int i; fastf_t knot_min, knot_max; - int bezier=1; + int bezier_f=1; knot_min = crv->k.knots[0]; knot_max = crv->k.knots[crv->k.k_size-1]; for (i=1; i<crv->k.k_size-1; i++) { if (!ZERO(crv->k.knots[i] - knot_min) && !ZERO(crv->k.knots[i] - knot_max)) { - bezier = 0; + bezier_f = 0; break; } } - return bezier; + return bezier_f; } Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c =================================================================== --- brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c 2016-10-16 21:06:49 UTC (rev 69082) +++ brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c 2016-10-16 21:11:29 UTC (rev 69083) @@ -1790,7 +1790,7 @@ { plane_t pl, pl1, pl2; struct nmg_nurb_uv_hit *hp; - struct bu_list bezier; + struct bu_list bezier_l; struct bu_list hit_list; struct face_g_snurb *srf; struct face *f; @@ -1807,12 +1807,12 @@ pl1[W] = VDOT(rd->rp->r_pt, pl1); pl2[W] = VDOT(rd->rp->r_pt, pl2); - BU_LIST_INIT(&bezier); + BU_LIST_INIT(&bezier_l); BU_LIST_INIT(&hit_list); - nmg_nurb_bezier(&bezier, fg); + nmg_nurb_bezier(&bezier_l, fg); - while (BU_LIST_NON_EMPTY(&bezier)) { + while (BU_LIST_NON_EMPTY(&bezier_l)) { point_t srf_min, srf_max; int planar; point_t hit; @@ -1820,7 +1820,7 @@ VSETALL(hit, 0); - srf = BU_LIST_FIRST(face_g_snurb, &bezier); + srf = BU_LIST_FIRST(face_g_snurb, &bezier_l); BU_LIST_DEQUEUE(&srf->l); /* calculate intersection points on NURB surface (in uv space) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits