[brlcad-commits] SF.net SVN: brlcad:[35879] brlcad/trunk/src/librt/primitives/pipe/pipe.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <d_r...@us...> - 2009-09-11 09:16:47
|
Revision: 35879 http://brlcad.svn.sourceforge.net/brlcad/?rev=35879&view=rev Author: d_rossberg Date: 2009-09-11 09:16:39 +0000 (Fri, 11 Sep 2009) Log Message: ----------- extended rt_pipe_ck() by a check of inner_diameter < outer_diameter and used this to do the check of a pipe's correctness in rt_pipe_adjust() at the end of the function this way an only temporary invalid pipe segment will not be considered as an error any more Modified Paths: -------------- brlcad/trunk/src/librt/primitives/pipe/pipe.c Modified: brlcad/trunk/src/librt/primitives/pipe/pipe.c =================================================================== --- brlcad/trunk/src/librt/primitives/pipe/pipe.c 2009-09-10 18:37:01 UTC (rev 35878) +++ brlcad/trunk/src/librt/primitives/pipe/pipe.c 2009-09-11 09:16:39 UTC (rev 35879) @@ -3520,7 +3520,8 @@ * Check pipe solid. Bend radius must be at least as large as the * outer radius. All bends must have constant diameters. No * consecutive LINEAR sections without BENDS unless the LINEAR - * sections are collinear. + * sections are collinear. Inner diameter must be less than outer + * diameter. */ int rt_pipe_ck(const struct bu_list *headp) @@ -3532,18 +3533,32 @@ fastf_t v2_len=0.0; prev = BU_LIST_FIRST(wdb_pipept, headp); + + if (prev->pp_id >= prev->pp_od) { + bu_log("Inner diameter (%gmm) has to be less than outer diameter (%gmm)\n", + prev->pp_id, prev->pp_od); + error_count++; + } + if (prev->pp_bendradius < prev->pp_od * 0.5) { bu_log("Bend radius (%gmm) is less than outer radius at (%g %g %g)\n", prev->pp_bendradius, V3ARGS(prev->pp_coord)); error_count++; } + cur = BU_LIST_NEXT(wdb_pipept, &prev->l); next = BU_LIST_NEXT(wdb_pipept, &cur->l); while (BU_LIST_NOT_HEAD(&next->l, headp)) { vect_t v1, v2, norm; fastf_t v1_len; fastf_t angle; - + + if (cur->pp_id >= cur->pp_od) { + bu_log("Inner diameter (%gmm) has to be less than outer diameter (%gmm)\n", + cur->pp_id, cur->pp_od); + error_count++; + } + if (cur->pp_bendradius < cur->pp_od * 0.5) { bu_log("Bend radius (%gmm) is less than outer radius at (%g %g %g)\n", cur->pp_bendradius, V3ARGS(cur->pp_coord)); @@ -3595,7 +3610,13 @@ cur = next; next = BU_LIST_NEXT(wdb_pipept, &cur->l); } - + + if (cur->pp_id >= cur->pp_od) { + bu_log("Inner diameter (%gmm) has to be less than outer diameter (%gmm)\n", + cur->pp_id, cur->pp_od); + error_count++; + } + if (old_bend_dist > v2_len) { error_count++; bu_log("last segment (%g %g %g) to (%g %g %g) is too short to allow\n", @@ -3787,12 +3808,7 @@ Tcl_DecrRefCount(list); break; case 'I': - tmp = atof(argv[1]); - if (tmp >= ptp->pp_od) { - bu_vls_printf(log, "inner diameter must be less than outer diameter"); - return BRLCAD_ERROR; - } - ptp->pp_id = tmp; + ptp->pp_id = atof(argv[1]); break; case 'O': tmp = atof(argv[1]); @@ -3800,19 +3816,10 @@ bu_vls_printf(log, "outer diameter cannot be 0.0 or less"); return BRLCAD_ERROR; } - if (tmp <= ptp->pp_id) { - bu_vls_printf(log, "outer diameter must be greater than inner diameter"); - return BRLCAD_ERROR; - } ptp->pp_od = tmp; break; case 'R': - tmp = atof(argv[1]); - if (tmp < ptp->pp_od * 0.5) { - bu_vls_printf(log, "cannot set bend radius to less than outer radius"); - return BRLCAD_ERROR; - } - ptp->pp_bendradius = tmp; + ptp->pp_bendradius = atof(argv[1]); break; default: bu_vls_printf(log, "unrecognized attribute, choices are V, I, O, or R"); @@ -3823,7 +3830,7 @@ argv += 2; } - return(TCL_OK); + return (rt_pipe_ck(&pipe->pipe_segs_head) == 0) ? TCL_OK : BRLCAD_ERROR; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |