[brlcad-commits] SF.net SVN: brlcad:[37416] brlcad/trunk/src/librt/primitives/bot/ g_bot_include.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <ind...@us...> - 2010-01-26 20:22:57
|
Revision: 37416 http://brlcad.svn.sourceforge.net/brlcad/?rev=37416&view=rev Author: indianlarry Date: 2010-01-26 20:22:48 +0000 (Tue, 26 Jan 2010) Log Message: ----------- Fix cases where multiple entrances or exits are encountered along a BOT shotline often an artifact of a surface grazing. Currently implemented a first entrance, last exit approach. Modified Paths: -------------- brlcad/trunk/src/librt/primitives/bot/g_bot_include.c Modified: brlcad/trunk/src/librt/primitives/bot/g_bot_include.c =================================================================== --- brlcad/trunk/src/librt/primitives/bot/g_bot_include.c 2010-01-26 20:22:06 UTC (rev 37415) +++ brlcad/trunk/src/librt/primitives/bot/g_bot_include.c 2010-01-26 20:22:48 UTC (rev 37416) @@ -800,6 +800,60 @@ } } } + /* + * Handle cases where there are multiple adjacent entrances or exits + * along the shotline. Using the FILO approach where we keep the + * "First In" from multiple entrances and the "Last Out" for multiple + * exits. + * + * Many of these cases were being generated when the shot ray grazed + * a surface. Grazing shots are treated as non-hits but can causes + * multiple entrance/exits when adjacent surfaces are hit. + * + * example: cross section of convex solid + * -------------- + * | | + * | | + * |entrance |exit + * ray--> ------------ ------------ + * |entrance |exit + * | | + * + * LOS(X) was being shown as: + * -------------- + * | | + * | | + * |entrance |exit + * ray--> XXXXXXXXXXXX XXXXXXXXXXXXX + * |entrance |exit + * | | + * + * now LOS(X) shows as: + * -------------- + * | | + * | | + * |entrance |exit + * ray--> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + * |entrance |exit + * | | + */ + for (i=0; i<nhits-1; i++) { + if (hits[i].hit_vpriv[X] < 0.0) { /* entering */ + k = i + 1; + while ((k < nhits) && (hits[k].hit_vpriv[X] < 0.0)) { + for (j=i; j<nhits-1; j++) + hits[j] = hits[j+1]; + nhits--; + } + } else if (hits[i].hit_vpriv[X] > 0.0) { /* exiting */ + k = i + 1; + while ((k < nhits) && (hits[k].hit_vpriv[X] > 0.0)) { + for (j=i+1; j<nhits-1; j++) + hits[j] = hits[j+1]; + nhits--; + } + } + } } /* if first hit is an exit, it is likely due to the "piece" for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |