[brlcad-commits] SF.net SVN: brlcad:[49912] brlcad/trunk/src/librt/primitives/metaball/ metaball.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2012-04-04 15:50:10
|
Revision: 49912 http://brlcad.svn.sourceforge.net/brlcad/?rev=49912&view=rev Author: brlcad Date: 2012-04-04 15:49:59 +0000 (Wed, 04 Apr 2012) Log Message: ----------- get a const address before calling rt_metaball_point_value() so we can avoid a bug in older versions of gcc where it doesn't pick up on the const cast. Modified Paths: -------------- brlcad/trunk/src/librt/primitives/metaball/metaball.c Modified: brlcad/trunk/src/librt/primitives/metaball/metaball.c =================================================================== --- brlcad/trunk/src/librt/primitives/metaball/metaball.c 2012-04-04 15:48:56 UTC (rev 49911) +++ brlcad/trunk/src/librt/primitives/metaball/metaball.c 2012-04-04 15:49:59 UTC (rev 49912) @@ -354,10 +354,8 @@ rt_metaball_find_intersection(point_t *intersect, const struct rt_metaball_internal *mb, const point_t *a, const point_t *b, fastf_t step, const fastf_t finalstep) { point_t mid; - const point_t *midp; + const point_t *midp = (const point_t *)∣ - midp = (const point_t *)∣ - VADD2(mid, *a, *b); VSCALE(mid, mid, 0.5); @@ -383,6 +381,7 @@ int retval = 0; fastf_t step, distleft; point_t p, inc; + const point_t *cp = (const point_t *)&p; /* switching behavior to retain old code for performance and correctness * comparisons. */ @@ -399,7 +398,7 @@ VSCALE(inc, rp->r_dir, step); /* assume it's normalized and we want to creep at step */ /* walk back out of the solid */ - while(rt_metaball_point_value((const point_t *)&p, mb) >= mb->threshold) { + while(rt_metaball_point_value(cp, mb) >= mb->threshold) { #if SHOOTALGO == 2 fhin = -1; #endif @@ -427,7 +426,7 @@ distleft -= step; VADD2(p, p, inc); - in = rt_metaball_point_value((const point_t *)&p, mb) > mb->threshold; + in = rt_metaball_point_value(cp, mb) > mb->threshold; if (mb_stat == 1) if ( !in ) if (step<=mb->finalstep) { @@ -467,7 +466,7 @@ VMOVE(lastpoint, p); VADD2(p, p, inc); if (mb_stat == 1) { - if (rt_metaball_point_value((const point_t *)&p, mb) < mb->threshold) { + if (rt_metaball_point_value(cp, mb) < mb->threshold) { point_t intersect, delta; const point_t *pA = (const point_t *)&lastpoint; const point_t *pB = (const point_t *)&p; @@ -483,7 +482,7 @@ return retval; } } else { - if (rt_metaball_point_value((const point_t *)&p, mb) > mb->threshold) { + if (rt_metaball_point_value(cp, mb) > mb->threshold) { point_t intersect, delta; const point_t *pA = (const point_t *)&lastpoint; const point_t *pB = (const point_t *)&p; @@ -964,13 +963,11 @@ pend = pts + strlen(pts); while(1) { - point_t loc; - const point_t *locp; - fastf_t fldstr, goo; int len; + fastf_t fldstr, goo; + point_t loc; + const point_t *locp = (const point_t *)&loc; - locp = (const point_t *)&loc; - while( pts < pend && *pts != '{' ) ++pts; if(pts >= pend) break; len = sscanf(pts, "{%lG %lG %lG %lG %lG}", loc+X, loc+Y, loc+Z, &fldstr, &goo); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |