[brlcad-commits] SF.net SVN: brlcad:[41301] brlcad/branches/STABLE
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2010-11-09 14:16:16
|
Revision: 41301 http://brlcad.svn.sourceforge.net/brlcad/?rev=41301&view=rev Author: starseeker Date: 2010-11-09 14:16:05 +0000 (Tue, 09 Nov 2010) Log Message: ----------- Sync STABLE branch to trunk r41297. Modified Paths: -------------- brlcad/branches/STABLE/NEWS brlcad/branches/STABLE/TODO brlcad/branches/STABLE/configure.ac brlcad/branches/STABLE/misc/nsis/brlcad.nsi brlcad/branches/STABLE/src/gtools/g_qa.c brlcad/branches/STABLE/src/libbn/mat.c brlcad/branches/STABLE/src/libbn/plane.c brlcad/branches/STABLE/src/libbu/parse.c brlcad/branches/STABLE/src/libged/bb.c brlcad/branches/STABLE/src/libged/cat.c brlcad/branches/STABLE/src/libged/comb.c brlcad/branches/STABLE/src/libged/comb_std.c brlcad/branches/STABLE/src/libged/dg_obj.c brlcad/branches/STABLE/src/libged/edcodes.c brlcad/branches/STABLE/src/libged/erase.c brlcad/branches/STABLE/src/libged/expand.c brlcad/branches/STABLE/src/libged/find.c brlcad/branches/STABLE/src/libged/group.c brlcad/branches/STABLE/src/libged/keep.c brlcad/branches/STABLE/src/libged/kill.c brlcad/branches/STABLE/src/libged/killall.c brlcad/branches/STABLE/src/libged/killrefs.c brlcad/branches/STABLE/src/libged/killtree.c brlcad/branches/STABLE/src/libged/list.c brlcad/branches/STABLE/src/libged/ls.c brlcad/branches/STABLE/src/libged/make_bb.c brlcad/branches/STABLE/src/libged/match.c brlcad/branches/STABLE/src/libged/nirt.c brlcad/branches/STABLE/src/libged/pathsum.c brlcad/branches/STABLE/src/libged/push.c brlcad/branches/STABLE/src/libged/region.c brlcad/branches/STABLE/src/libged/remove.c brlcad/branches/STABLE/src/libged/rrt.c brlcad/branches/STABLE/src/libged/rt.c brlcad/branches/STABLE/src/libged/title.c brlcad/branches/STABLE/src/libged/tree.c brlcad/branches/STABLE/src/libged/wcodes.c brlcad/branches/STABLE/src/libged/wdb_comb_std.c brlcad/branches/STABLE/src/libged/wdb_nirt.c brlcad/branches/STABLE/src/libged/wdb_obj.c brlcad/branches/STABLE/src/libged/which.c brlcad/branches/STABLE/src/librt/bundle.c brlcad/branches/STABLE/src/librt/opennurbs_ext.cpp brlcad/branches/STABLE/src/librt/primitives/brep/brep.cpp brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_ck.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_class.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_fuse.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_inter.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_manif.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_mesh.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_misc.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_mk.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_rt_isect.c brlcad/branches/STABLE/src/librt/primitives/nmg/nmg_tri.c brlcad/branches/STABLE/src/libtclcad/ged_obj.c brlcad/branches/STABLE/src/mged/rtif.c brlcad/branches/STABLE/src/rt/opt.c brlcad/branches/STABLE/src/tclscripts/mged/Makefile.am brlcad/branches/STABLE/src/tclscripts/mged/openw.tcl brlcad/branches/STABLE/src/tclscripts/mged/tclIndex brlcad/branches/STABLE/src/util/pl-dm.c Added Paths: ----------- brlcad/branches/STABLE/src/tclscripts/mged/botedit.tcl Modified: brlcad/branches/STABLE/NEWS =================================================================== --- brlcad/branches/STABLE/NEWS 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/NEWS 2010-11-09 14:16:05 UTC (rev 41301) @@ -13,6 +13,19 @@ --- 2010-09-XX Release 7.18.0 --- ---------------------------------------------------------------------- +This release includes the initial release of a new Bag of Triangle +(BoT) editing interface for MGED and Archer. Nicholas Reed developed +the new graphical user interface (GUI) in order to consolidate the +numerous BoT editing commands and processing steps into one unified +easy-to-use interface. The new GUI grealy simplifies BoT processing +steps and can save modelers considerable time. + +* fixed infinite loop bug converting to NMG and BoT - Sean Morrison +* improved Windows installer desktop shortcut creation - Bob Parker +* fixed running mged external tools (e.g., rt) after 'cd' - Bob Parker +* fixed 'pnts' point cloud primitive memory access bug - Richard Weiss +* new BoT editing interface for mged and archer - Nicholas Reed +* fixed crash during BoT decimation - Nicholas Reed * improved robustness of CSG boolean tree processing - Sean Morrison * improved loading of Pro/E export plugin on Windows - Bob Parker * added ray bundle shooting capability to rtshot - Keith Bowman Modified: brlcad/branches/STABLE/TODO =================================================================== --- brlcad/branches/STABLE/TODO 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/TODO 2010-11-09 14:16:05 UTC (rev 41301) @@ -19,10 +19,15 @@ * verify rt/benchmark on windows doesn't crash +* change bu_realloc so that a zero size will perform a free instead + of allocating the minimum size to store a pointer. + THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS ------------------------------------------------------- +* rename all the g_* tools sans "_" + * explore the g_qa/plot issue * release dm X get_color() memory @@ -40,6 +45,11 @@ THESE ARE UNSCHEDULED BACKLOG TASKS ----------------------------------- +* make sure mged/archer behave properly with relative paths to dbopen. + Windows in particular is doing something different in + src/librt/db_open.c that should be a problem as it only records the + file name (so gui will work, but dbopen + cd + rt will not). + * convert all calls to BU_SETJUMP/BU_UNSETJUMP into familiar try/catch logic layout using if/else. @@ -100,15 +110,9 @@ also be useful to allow an optional "thickness" so that the annotations can represent physical geometry (so they raytrace). -* investigate tessellation failures (Stryker, et al), possibily due to - recent tolerance checks. - * add support for a custom unit conversion factor to the units command (e.g. 'units 9.3120223' or 'units metertons 9.3120223') -* fix forum links to point to the sourceforge forums, not the nabble - forums - * write up a brief DSP overview on the wiki * merge conv-vg2g into dbupgrade @@ -149,8 +153,6 @@ * implement rt_volume() API for computing geometry volume (g_qa style for complex, direct for primitives) -* implement parallel prep - * improve compile-time version management -- port brlcad-version to windows, reconsider providing compile-time header constants. @@ -316,9 +318,6 @@ * complete conversion of existing manual pages into docbook format -* expose all manual page documentation from within mged through - searchable viewer interface (GUI) - * add an option to bot_dump for outputting surface normals. Make sure all supported dump formats (obj, dxf, etc) optionally write out normals. Consider adding an option to smoothly interpolate normals @@ -488,8 +487,6 @@ * refactor mged/bwish/g_diff initialization to all use the same routine -* rename all the g_* tools sans _ next minor update - * deprecate either orot or rotobj * refactor mged's signal handling to make it possible to safely @@ -528,7 +525,7 @@ they want v2 (default) or previous v1 output format via a command-line switch. see http://brlcad.svn.sf.net/viewvc/brlcad/brlcad/trunk/conv/g-vrml.c?view=diff&pathrev=22798&r1=16900&r2=16901 -* VRML importer +* X3D/VRML importer * make Mac OS X universal binaries actually work. @@ -727,13 +724,10 @@ of memory requirements for a geometry database can be computed on the fly via a pre-prep phase. -* support to the raytracers for multiple image file formats, - recognizing an option and/or the file suffix of the -o filename. - * libfb + font rendering (perhaps through libbn's plot interface) for a posix terminal. -* gpgpu for enhanced performance boolweave sorting +* OpenCL for enhanced performance boolweave sorting * getexecname, "/proc/self/cmdline", program_invocation_short_name. separate out into new file. @@ -774,8 +768,6 @@ * add support for filesystem-based geometry collections -* modify the raytracers to use common fb and file output code - * add missing manual pages (jra generated list on 04.2007): a-d archer asc2g asc2pix bot-bldxf bottest brep_cube brep_simple brickwall btclsh burst bw-a bw-d bwish c-d chan_add clutter contours d-a damdf dauto dauto2 d-bw dconv ddisp d-f dfft d-i dmod double-asc dpeak dsel dsp_add dstat d-u dwin euclid_format euclid_unformat fbgammamod f-d fence fhor f-i g-adrt g-euclid1 g-jack globe g-off i-a i-d i-f ihist imod istat jack-g kurt lowp molecule nmgmodel nmg-sgp off-g pipe pipetest pix2g pix3filter pixcount pixelswap pixembed pixfields pixfieldsep pixflip-fb pixpaste pix-spm pix-yuv plstat pyramid rawbot remapid rlesortmap rletovcr room rtcell rtexample rtfrac rtrad rtsil rtsrv script-tab sketch solshoot sphflake spltest spm-fb ssampview syn tea tea_nmg testfree texturescale torii ttcp tube txyz-pl u-a u-bw u-d u-f umod ustat vcrtorle vegitation wall wdb_example xbmtorle xyz-pl yuv-pix Modified: brlcad/branches/STABLE/configure.ac =================================================================== --- brlcad/branches/STABLE/configure.ac 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/configure.ac 2010-11-09 14:16:05 UTC (rev 41301) @@ -2122,6 +2122,7 @@ # -Wstrict-prototypes -Wold-style-definition -Wshorten-64-to-32 -Wmissing-field-initializers # -Wmissing-noreturn -Wredundant-decls # -Wformat=2 (after bu_fopen_uniq() is obsolete) + # -Wparentheses -Wswitch-default -Wswitch-enum if test "x$bc_warning_flag_works" = "xno" ; then AC_MSG_WARN([Don't know how to output verbose warnings with this compiler]) Modified: brlcad/branches/STABLE/misc/nsis/brlcad.nsi =================================================================== --- brlcad/branches/STABLE/misc/nsis/brlcad.nsi 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/misc/nsis/brlcad.nsi 2010-11-09 14:16:05 UTC (rev 41301) @@ -8,8 +8,8 @@ !include VERSION.txt ;-------------------------------- -;Include Modern UI +; Modurn User Interface !include "MUI.nsh" !include "FileFunc.nsh" !include "WordFunc.nsh" @@ -53,10 +53,6 @@ ; The default installation directory InstallDir $PROGRAMFILES\BRL-CAD\${VERSION} - ; Registry key to check for directory (so if you install again, it will - ; overwrite the old one automatically) -; InstallDirRegKey HKLM "Software\BRL-CAD ${VERSION}" "Install_Dir" - ; Make it look pretty in XP XPStyle on @@ -98,15 +94,7 @@ !insertmacro MUI_PAGE_LICENSE "..\..\COPYING" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY - - ;Start Menu Folder Page Configuration -; !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" -; !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\BRL-CAD\${VERSION}" -; !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER - - !insertmacro MUI_PAGE_INSTFILES ;Finished page configuration @@ -157,20 +145,6 @@ SetOutPath $INSTDIR\share File /r "..\..\brlcadInstall${PLATFORM}\share\*" - ; Write the installation path into the registry -; WriteRegStr HKLM "SOFTWARE\BRL-CAD ${VERSION}" "Install_Dir" "$INSTDIR" - - ; Write the uninstall keys for Windows -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "DisplayName" "BRL-CAD ${VERSION}" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "DisplayVersion" "${VERSION}" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "VersionMajor" "${MAJOR}" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "VersionMinor" "${MINOR}" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "InstallLocation" '"$INSTDIR"' -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "URLInfoAbout" "http://brlcad.org" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "URLUpdateInfo" "http://brlcad.org" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "HelpLink" "http://irc.brlcad.org" -; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" "UninstallString" '"$INSTDIR\uninstall.exe"' - ;Create uninstaller WriteUninstaller "uninstall.exe" @@ -196,30 +170,16 @@ SectionEnd Section "Documentation (required)" Documentation - ; SectionIn RO means temporarily required - ;SectionIn RO - ;SetOutPath $INSTDIR\doc - ;File /r ..\..\brlcadInstall${PLATFORM}\doc\* !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ;Main start menu shortcuts SetOutPath $INSTDIR CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER${INSTALLERSUFFIX}\Manuals" - ;CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER${INSTALLERSUFFIX}\Manuals\Archer.lnk" "$BRLCAD_DATA_DIR\html\manuals\archer\Archer_Documentation.chm" "" "$INSTDIR\archer.ico" 0 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER${INSTALLERSUFFIX}\Manuals\BRL-CAD.lnk" "$BRLCAD_DATA_DIR\html\manuals\index.html" "" "$INSTDIR\brlcad.ico" 0 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER${INSTALLERSUFFIX}\Manuals\MGED.lnk" "$BRLCAD_DATA_DIR\html\manuals\mged\index.html" "" "$INSTDIR\brlcad.ico" 0 !insertmacro MUI_STARTMENU_WRITE_END SectionEnd -;Section "Samples" Samples -; SetOutPath $INSTDIR\Samples -; File ..\..\brlcadInstall${PLATFORM}\Samples\* -;SectionEnd -;Section "Developement headers" Developer -; SetOutPath $INSTDIR\include -; File ..\..\brlcadInstall${PLATFORM}\include\* -;SectionEnd - ;-------------------------------- ;Descriptions @@ -227,16 +187,12 @@ ;Language strings LangString DESC_BRL-CAD ${LANG_ENGLISH} "Installs the main application and the associated data files." LangString DESC_Documentation ${LANG_ENGLISH} "Installs documentation for BRL-CAD." - ;LangString DESC_Samples ${LANG_ENGLISH} "Installs optional geometry samples." - ;LangString DESC_Developer ${LANG_ENGLISH} "Installs programming headers for developers." ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${BRL-CAD} $(DESC_BRL-CAD) !insertmacro MUI_DESCRIPTION_TEXT ${Documentation} $(DESC_Documentation) - ;!insertmacro MUI_DESCRIPTION_TEXT ${Samples} $(DESC_Samples) - ;!insertmacro MUI_DESCRIPTION_TEXT ${Developer} $(DESC_Developer) !insertmacro MUI_FUNCTION_DESCRIPTION_END @@ -246,10 +202,6 @@ Section "Uninstall" - ; Remove registry keys -; DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BRL-CAD ${VERSION}" -; DeleteRegKey HKLM "SOFTWARE\BRL-CAD ${VERSION}" - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP ; Remove shortcuts, if any Modified: brlcad/branches/STABLE/src/gtools/g_qa.c =================================================================== --- brlcad/branches/STABLE/src/gtools/g_qa.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/gtools/g_qa.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -45,7 +45,7 @@ int i, j; int db_index; char c; - const char *av[MAXARGS]; + const char **av; struct ged *gedp; bu_opterr = 0; @@ -86,6 +86,8 @@ bu_exit(1, usage, argv[0]); } + av = (const char **)bu_calloc(argc, sizeof(char *), "av"); + db_index = bu_optind; for (i = j = 0; i < argc; ++i) { if (i == db_index) @@ -97,6 +99,7 @@ av[j] = (char *)0; if ((gedp = ged_open("db", argv[db_index], 1)) == GED_NULL) { + bu_free(av, "av"); bu_exit(1, usage, argv[0]); } @@ -107,6 +110,8 @@ bu_log("%s", bu_vls_addr(&gedp->ged_result_str)); ged_close(gedp); + bu_free(av, "av"); + return 0; } Modified: brlcad/branches/STABLE/src/libbn/mat.c =================================================================== --- brlcad/branches/STABLE/src/libbn/mat.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libbn/mat.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -31,7 +31,7 @@ * | 8 9 10 11 | | 2 | * | 12 13 14 15 | | 3 | * - * preVector (vect_t) Matrix (mat_t) postVector (vect_t) + * preVector (vect_t) Matrix (mat_t) postVector (vect_t) @endcode * * TODO: need a better way to control tolerancing, either via @@ -381,9 +381,7 @@ void bn_vtoh_move(register vect_t h, register const vect_t v) { - h[X] = v[X]; - h[Y] = v[Y]; - h[Z] = v[Z]; + VMOVE(h, v); h[W] = 1.0; } @@ -403,18 +401,14 @@ register fastf_t inv; if (NEAR_ZERO(h[3] - 1.0, SMALL_FASTF)) { - v[X] = h[X]; - v[Y] = h[Y]; - v[Z] = h[Z]; + VMOVE(v, h); } else { if (NEAR_ZERO(h[W], SMALL_FASTF)) { bu_log("bn_htov_move: divide by %f!\n", h[W]); return; } inv = 1.0 / h[W]; - v[X] = h[X] * inv; - v[Y] = h[Y] * inv; - v[Z] = h[Z] * inv; + VSCALE(v, h, inv); } } @@ -425,27 +419,7 @@ void bn_mat_trn(mat_t om, register const mat_t im) { - register matp_t op = om; - - *op++ = im[0]; - *op++ = im[4]; - *op++ = im[8]; - *op++ = im[12]; - - *op++ = im[1]; - *op++ = im[5]; - *op++ = im[9]; - *op++ = im[13]; - - *op++ = im[2]; - *op++ = im[6]; - *op++ = im[10]; - *op++ = im[14]; - - *op++ = im[3]; - *op++ = im[7]; - *op++ = im[11]; - *op++ = im[15]; + MAT_TRANSPOSE(om, im); } @@ -984,11 +958,11 @@ * This is done in several steps. * @code - 1) Rotate D about Z to match +X axis. Azimuth adjustment. - 2) Rotate D about Y to match -Y axis. Elevation adjustment. - 3) Rotate D about Z to make projection of X axis again point + 1) Rotate D about Z to match +X axis. Azimuth adjustment. + 2) Rotate D about Y to match -Y axis. Elevation adjustment. + 3) Rotate D about Z to make projection of X axis again point in the +X direction. Twist adjustment. - 4) Optionally, flip sign on Y axis if original Z becomes inverted. + 4) Optionally, flip sign on Y axis if original Z becomes inverted. This can be nice for static frames, but is astonishing when used in animation. @endcode @@ -1043,7 +1017,7 @@ /* Check the final results */ MAT4X3VEC(t1, rot, dir); if (t1[Z] > -0.98) { - bu_log("Error: bn_mat_lookat final= (%g, %g, %g)\n", t1[X], t1[Y], t1[Z]); + bu_log("Error: bn_mat_lookat final= (%g, %g, %g)\n", V3ARGS(t1)); } } @@ -1065,9 +1039,9 @@ register int i; if (NEAR_ZERO(MAGSQ(in), SQRT_SMALL_FASTF)) { + bu_log("bn_vec_ortho(): zero magnitude input vector %lf %lf %lf\n", V3ARGS(in)); VSETALL(out, 0); - bu_log("bn_vec_ortho(): zero magnitude input vector %lf %lf %lf\n", in[0],in[1],in[2]); - bu_bomb("bn_vec_ortho(): zero magnitude input vector\n"); + return; } /* Find component closest to zero */ @@ -1088,7 +1062,7 @@ } f = hypot(in[j], in[k]); if (NEAR_ZERO(f, SMALL_FASTF)) { - bu_log("bn_vec_ortho(): zero hypot on %lf %lf %lf\n", in[0],in[1],in[2]); + bu_log("bn_vec_ortho(): zero hypot on %lf %lf %lf\n", V3ARGS(in)); VSETALL(out, 0); return; } Modified: brlcad/branches/STABLE/src/libbn/plane.c =================================================================== --- brlcad/branches/STABLE/src/libbn/plane.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libbn/plane.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -52,6 +52,7 @@ return MAGNITUDE(diff); } + /** * B N _ P T 3 _ P T 3 _ E Q U A L * @@ -65,10 +66,11 @@ BN_CK_TOL(tol); VSUB2(diff, b, a); - if (MAGSQ(diff) < tol->dist_sq) return 1; + if (MAGSQ(diff) < tol->dist_sq) return 1; return 0; } + /** * B N _ P T 2 _ P T 2 _ E Q U A L * @@ -82,10 +84,11 @@ BN_CK_TOL(tol); VSUB2_2D(diff, b, a); - if (MAGSQ_2D(diff) < tol->dist_sq) return 1; + if (MAGSQ_2D(diff) < tol->dist_sq) return 1; return 0; } + /** * B N _ 3 P T S _ C O L L I N E A R * @brief @@ -116,20 +119,17 @@ max_len = mag_ab; max_edge_no = 1; - if (mag_bc > max_len) - { + if (mag_bc > max_len) { max_len = mag_bc; max_edge_no = 2; } - if (mag_ca > max_len) - { + if (mag_ca > max_len) { max_len = mag_ca; max_edge_no = 3; } - switch (max_edge_no) - { + switch (max_edge_no) { default: case 1: cos_b = (-VDOT(ab, bc))/(mag_ab * mag_bc); @@ -171,14 +171,15 @@ BN_CK_TOL(tol); VSUB2(B_A, b, a); - if (MAGSQ(B_A) <= tol->dist_sq) return 0; + if (MAGSQ(B_A) <= tol->dist_sq) return 0; VSUB2(C_A, c, a); - if (MAGSQ(C_A) <= tol->dist_sq) return 0; + if (MAGSQ(C_A) <= tol->dist_sq) return 0; VSUB2(C_B, c, b); - if (MAGSQ(C_B) <= tol->dist_sq) return 0; + if (MAGSQ(C_B) <= tol->dist_sq) return 0; return 1; } + /** * B N _ N P T S _ D I S T I N C T * @@ -197,8 +198,8 @@ BN_CK_TOL(tol); - for(i=0;i<npt;i++) - for(j=i+1;j<npt;j++) { + for (i=0;i<npt;i++) + for (j=i+1;j<npt;j++) { VSUB2(r, pts[i], pts[j]); if (MAGSQ(r) <= tol->dist_sq) return 0; @@ -241,8 +242,8 @@ * * N = (B-A) x (C-A). * - * @return 0 OK - * @return -1 Failure. At least two of the points were not distinct, + * @return 0 OK + * @return -1 Failure. At least two of the points were not distinct, * or all three were colinear. * * @param[out] plane The plane equation is stored here. @@ -266,11 +267,11 @@ BN_CK_TOL(tol); VSUB2(B_A, b, a); - if (MAGSQ(B_A) <= tol->dist_sq) return -1; + if (MAGSQ(B_A) <= tol->dist_sq) return -1; VSUB2(C_A, c, a); - if (MAGSQ(C_A) <= tol->dist_sq) return -1; + if (MAGSQ(C_A) <= tol->dist_sq) return -1; VSUB2(C_B, c, b); - if (MAGSQ(C_B) <= tol->dist_sq) return -1; + if (MAGSQ(C_B) <= tol->dist_sq) return -1; VCROSS(plane, B_A, C_A); @@ -287,6 +288,7 @@ return 0; /* OK */ } + /** * B N _ M K P O I N T _ 3 P L A N E S *@brief @@ -295,21 +297,21 @@ * * Find the solution to a system of three equations in three unknowns: @verbatim - * Px * Ax + Py * Ay + Pz * Az = -A3; - * Px * Bx + Py * By + Pz * Bz = -B3; - * Px * Cx + Py * Cy + Pz * Cz = -C3; + * Px * Ax + Py * Ay + Pz * Az = -A3; + * Px * Bx + Py * By + Pz * Bz = -B3; + * Px * Cx + Py * Cy + Pz * Cz = -C3; * - * or + * OR * - * [ Ax Ay Az ] [ Px ] [ -A3 ] - * [ Bx By Bz ] * [ Py ] = [ -B3 ] - * [ Cx Cy Cz ] [ Pz ] [ -C3 ] + * [ Ax Ay Az ] [ Px ] [ -A3 ] + * [ Bx By Bz ] * [ Py ] = [ -B3 ] + * [ Cx Cy Cz ] [ Pz ] [ -C3 ] * @endverbatim * * - * @return 0 OK - * @return -1 Failure. Intersection is a line or plane. + * @return 0 OK + * @return -1 Failure. Intersection is a line or plane. * * @param[out] pt The point of intersection is stored here. * @param a plane 1 @@ -331,7 +333,7 @@ * is some deep significance to this!) */ det = VDOT(a, v1); - if (NEAR_ZERO(det, SMALL_FASTF)) return -1; + if (NEAR_ZERO(det, SMALL_FASTF)) return -1; VCROSS(v2, a, c); VCROSS(v3, a, b); @@ -343,6 +345,7 @@ return 0; } + /** * B N _ 2 L I N E 3 _ C O L I N E A R * @brief @@ -372,22 +375,22 @@ goto fail; } - if ((mag1 = MAGNITUDE(d1)) < SMALL_FASTF) bu_bomb("bn_2line3_colinear() mag1 zero\n"); - if ((mag2 = MAGNITUDE(d2)) < SMALL_FASTF) bu_bomb("bn_2line3_colinear() mag2 zero\n"); + if ((mag1 = MAGNITUDE(d1)) < SMALL_FASTF) bu_bomb("bn_2line3_colinear() mag1 zero\n"); + if ((mag2 = MAGNITUDE(d2)) < SMALL_FASTF) bu_bomb("bn_2line3_colinear() mag2 zero\n"); /* Impose a general angular tolerance to reject "obviously" non-parallel lines */ /* tol->para and RT_DOT_TOL are too tight a tolerance. 0.1 is 5 degrees */ - if (fabs(VDOT(d1, d2)) < 0.9 * mag1 * mag2) goto fail; + if (fabs(VDOT(d1, d2)) < 0.9 * mag1 * mag2) goto fail; /* See if start points are within tolerance of other line */ - if (bn_distsq_line3_pt3(p1, d1, p2) > tol->dist_sq) goto fail; - if (bn_distsq_line3_pt3(p2, d2, p1) > tol->dist_sq) goto fail; + if (bn_distsq_line3_pt3(p1, d1, p2) > tol->dist_sq) goto fail; + if (bn_distsq_line3_pt3(p2, d2, p1) > tol->dist_sq) goto fail; VJOIN1(tail, p1, range/mag1, d1); - if (bn_distsq_line3_pt3(p2, d2, tail) > tol->dist_sq) goto fail; + if (bn_distsq_line3_pt3(p2, d2, tail) > tol->dist_sq) goto fail; VJOIN1(tail, p2, range/mag2, d2); - if (bn_distsq_line3_pt3(p1, d1, tail) > tol->dist_sq) goto fail; + if (bn_distsq_line3_pt3(p1, d1, tail) > tol->dist_sq) goto fail; if (bu_debug & BU_DEBUG_MATH) { bu_log("bn_2line3colinear(range=%g) ret=1\n", range); @@ -400,6 +403,7 @@ return 0; } + /** * B N _ I S E C T _ L I N E 3 _ P L A N E * @@ -408,11 +412,11 @@ * direction vector need not have unit length. The first three * elements of the plane equation must form a unit lengh vector. * - * @return -2 missed (ray is outside halfspace) - * @return -1 missed (ray is inside) - * @return 0 line lies on plane - * @return 1 hit (ray is entering halfspace) - * @return 2 hit (ray is leaving) + * @return -2 missed (ray is outside halfspace) + * @return -1 missed (ray is inside) + * @return 0 line lies on plane + * @return 1 hit (ray is entering halfspace) + * @return 2 hit (ray is leaving) * * @param[out] dist set to the parametric distance of the intercept * @param[in] pt origin of ray @@ -459,6 +463,7 @@ return 0; /* Ray lies in the plane */ } + /** * B N _ I S E C T _ 2 P L A N E S *@brief @@ -471,10 +476,10 @@ * RPP. If this convention is unnecessary, just pass (0, 0, 0) as * rpp_min. * - * @return 0 OK, line of intersection stored in `pt' and `dir'. - * @return -1 FAIL, planes are identical (co-planar) - * @return -2 FAIL, planes are parallel and distinct - * @return -3 FAIL, unable to find line of intersection + * @return 0 OK, line of intersection stored in `pt' and `dir'. + * @return -1 FAIL, planes are identical (co-planar) + * @return -2 FAIL, planes are parallel and distinct + * @return -3 FAIL, unable to find line of intersection * * @param[out] pt Starting point of line of intersection * @param[out] dir Direction vector of line of intersection (unit length) @@ -554,6 +559,7 @@ return 0; /* OK */ } + /** * B N _ I S E C T _ L I N E 2 _ L I N E 2 * @@ -572,11 +578,11 @@ * * The direction vectors C and D need not have unit length. * - * @return -1 no intersection, lines are parallel. - * @return 0 lines are co-linear + * @return -1 no intersection, lines are parallel. + * @return 0 lines are co-linear *@n dist[0] gives distance from P to A, *@n dist[1] gives distance from P to (A+C) [not same as below] - * @return 1 intersection found (t and u returned) + * @return 1 intersection found (t and u returned) *@n dist[0] gives distance from P to isect, *@n dist[1] gives distance from A to isect. * @@ -634,9 +640,9 @@ * * or * - * [ Dx -Cx ] [ t ] [ Hx ] - * [ ] * [ ] = [ ] - * [ Dy -Cy ] [ u ] [ Hy ] + * [ Dx -Cx ] [ t ] [ Hx ] + * [ ] * [ ] = [ ] + * [ Dy -Cy ] [ u ] [ Hy ] * * This system can be solved by direct substitution, or by finding * the determinants by Cramers rule: @@ -663,7 +669,7 @@ * det [ ] * det1(M) [ Hy -Cy ] -Hx * Cy + Cx * Hy * t = ------- = --------------- = ------------------ - * det(M) det(M) -Dx * Cy + Cx * Dy + * det(M) det(M) -Dx * Cy + Cx * Dy * * and * @@ -671,7 +677,7 @@ * det [ ] * det2(M) [ Dy Hy ] Dx * Hy - Hx * Dy * u = ------- = --------------- = ------------------ - * det(M) det(M) -Dx * Cy + Cx * Dy + * det(M) det(M) -Dx * Cy + Cx * Dy */ hx = a[X] - p[X]; hy = a[Y] - p[Y]; @@ -749,6 +755,7 @@ return 1; /* Intersection found */ } + /** * B N _ I S E C T _ L I N E 2 _ L S E G 2 *@brief @@ -760,14 +767,14 @@ * * XXX probably should take point B, not vector C. Sigh. * - * @return -4 A and B are not distinct points - * @return -3 Lines do not intersect - * @return -2 Intersection exists, but outside segemnt, < A - * @return -1 Intersection exists, but outside segment, > B - * @return 0 Lines are co-linear (special meaning of dist[1]) - * @return 1 Intersection at vertex A - * @return 2 Intersection at vertex B (A+C) - * @return 3 Intersection between A and B + * @return -4 A and B are not distinct points + * @return -3 Lines do not intersect + * @return -2 Intersection exists, but outside segemnt, < A + * @return -1 Intersection exists, but outside segment, > B + * @return 0 Lines are co-linear (special meaning of dist[1]) + * @return 1 Intersection at vertex A + * @return 2 Intersection at vertex B (A+C) + * @return 3 Intersection between A and B * * Implicit Returns - * @param dist When explicit return >= 0, t is the parameter that describes @@ -848,10 +855,10 @@ bu_log("bn_isect_line2_lseg2() dtol=%g, dist[0]=%g, dist[1]=%g\n", dtol, dist[0], dist[1]); } - if (dist[0] > -dtol && dist[0] < dtol) dist[0] = 0; + if (dist[0] > -dtol && dist[0] < dtol) dist[0] = 0; else if (dist[0] > 1-dtol && dist[0] < 1+dtol) dist[0] = 1; - if (dist[1] > -dtol && dist[1] < dtol) dist[1] = 0; + if (dist[1] > -dtol && dist[1] < dtol) dist[1] = 0; else if (dist[1] > 1-dtol && dist[1] < 1+dtol) dist[1] = 1; ret = 0; /* Colinear */ goto out; @@ -958,16 +965,17 @@ return ret; } + /** * B N _ I S E C T _ L S E G 2 _ L S E G 2 *@brief * Intersect two 2D line segments, defined by two points and two * vectors. The vectors are unlikely to be unit length. * - * @return -2 missed (line segments are parallel) - * @return -1 missed (colinear and non-overlapping) - * @return 0 hit (line segments colinear and overlapping) - * @return 1 hit (normal intersection) + * @return -2 missed (line segments are parallel) + * @return -1 missed (colinear and non-overlapping) + * @return 0 hit (line segments colinear and overlapping) + * @return 1 hit (normal intersection) * * @param dist The value at dist[] is set to the parametric distance of the * intercept. @@ -1019,14 +1027,14 @@ if (bu_debug & BU_DEBUG_MATH) { bu_log("ptol=%g\n", ptol); } - if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; + if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; else if (dist[0] > 1-ptol && dist[0] < 1+ptol) dist[0] = 1; - if (dist[1] > -ptol && dist[1] < ptol) dist[1] = 0; + if (dist[1] > -ptol && dist[1] < ptol) dist[1] = 0; else if (dist[1] > 1-ptol && dist[1] < 1+ptol) dist[1] = 1; - if (dist[1] < 0 || dist[1] > 1) nogood = 1; - if (dist[0] < 0 || dist[0] > 1) nogood++; + if (dist[1] < 0 || dist[1] > 1) nogood = 1; + if (dist[0] < 0 || dist[0] > 1) nogood++; if (nogood >= 2) return -1; /* colinear, but not overlapping */ if (bu_debug & BU_DEBUG_MATH) { @@ -1037,11 +1045,11 @@ /* Lines intersect */ /* If within tolerance of an endpoint (0, 1), make exact. */ ptol = tol->dist / sqrt(MAGSQ_2D(pdir)); - if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; + if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; else if (dist[0] > 1-ptol && dist[0] < 1+ptol) dist[0] = 1; qtol = tol->dist / sqrt(MAGSQ_2D(qdir)); - if (dist[1] > -qtol && dist[1] < qtol) dist[1] = 0; + if (dist[1] > -qtol && dist[1] < qtol) dist[1] = 0; else if (dist[1] > 1-qtol && dist[1] < 1+qtol) dist[1] = 1; if (bu_debug & BU_DEBUG_MATH) { @@ -1059,6 +1067,7 @@ return 1; /* hit, normal intersection */ } + /** * B N _ I S E C T _ L S E G 3 _ L S E G 3 *@brief @@ -1066,10 +1075,10 @@ * vectors. The vectors are unlikely to be unit length. * * - * @return -2 missed (line segments are parallel) - * @return -1 missed (colinear and non-overlapping) - * @return 0 hit (line segments colinear and overlapping) - * @return 1 hit (normal intersection) + * @return -2 missed (line segments are parallel) + * @return -1 missed (colinear and non-overlapping) + * @return 0 hit (line segments colinear and overlapping) + * @return 1 hit (normal intersection) * * @param[out] dist * The value at dist[] is set to the parametric distance of the @@ -1125,14 +1134,14 @@ if (bu_debug & BU_DEBUG_MATH) { bu_log("ptol=%g\n", ptol); } - if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; + if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; else if (dist[0] > 1-ptol && dist[0] < 1+ptol) dist[0] = 1; - if (dist[1] > -ptol && dist[1] < ptol) dist[1] = 0; + if (dist[1] > -ptol && dist[1] < ptol) dist[1] = 0; else if (dist[1] > 1-ptol && dist[1] < 1+ptol) dist[1] = 1; - if (dist[1] < 0 || dist[1] > 1) nogood = 1; - if (dist[0] < 0 || dist[0] > 1) nogood++; + if (dist[1] < 0 || dist[1] > 1) nogood = 1; + if (dist[0] < 0 || dist[0] > 1) nogood++; if (nogood >= 2) return -1; /* colinear, but not overlapping */ if (bu_debug & BU_DEBUG_MATH) { @@ -1143,14 +1152,14 @@ /* Lines intersect */ /* If within tolerance of an endpoint (0, 1), make exact. */ ptol = tol->dist / pmag; - if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; + if (dist[0] > -ptol && dist[0] < ptol) dist[0] = 0; else if (dist[0] > 1-ptol && dist[0] < 1+ptol) dist[0] = 1; qmag = MAGNITUDE(qdir); if (qmag < SMALL_FASTF) bu_bomb("bn_isect_lseg3_lseg3: |q|=0\n"); qtol = tol->dist / qmag; - if (dist[1] > -qtol && dist[1] < qtol) dist[1] = 0; + if (dist[1] > -qtol && dist[1] < qtol) dist[1] = 0; else if (dist[1] > 1-qtol && dist[1] < 1+qtol) dist[1] = 1; if (bu_debug & BU_DEBUG_MATH) { @@ -1168,6 +1177,7 @@ return 1; /* hit, normal intersection */ } + /** * B N _ I S E C T _ L I N E 3 _ L I N E 3 * @@ -1183,10 +1193,10 @@ * * The direction vectors C and D need not have unit length. * - * @return -2 no intersection, lines are parallel. - * @return -1 no intersection - * @return 0 lines are co-linear (t returned for u=0 to give distance to A) - * @return 1 intersection found (t and u returned) + * @return -2 no intersection, lines are parallel. + * @return -1 no intersection + * @return 0 lines are co-linear (t returned for u=0 to give distance to A) + * @return 1 intersection found (t and u returned) * * @param[out] t, u line parameter of interseciton * When explicit return >= 0, t and u are the @@ -1344,9 +1354,9 @@ * * or * - * [ Dq -Cq ] [ t ] [ Hq ] - * [ ] * [ ] = [ ] - * [ Dr -Cr ] [ u ] [ Hr ] + * [ Dq -Cq ] [ t ] [ Hq ] + * [ ] * [ ] = [ ] + * [ Dr -Cr ] [ u ] [ Hr ] * * This system can be solved by direct substitution, or by finding * the determinants by Cramers rule: @@ -1394,7 +1404,7 @@ * det [ ] * det1(M) [ Hr -Cr ] -Hq * Cr + Cq * Hr * t = ------- = --------------- = ------------------ - * det(M) det(M) -Dq * Cr + Cq * Dr + * det(M) det(M) -Dq * Cr + Cq * Dr * * and * @@ -1402,7 +1412,7 @@ * det [ ] * det2(M) [ Dr Hr ] Dq * Hr - Hq * Dr * u = ------- = --------------- = ------------------ - * det(M) det(M) -Dq * Cr + Cq * Dr + * det(M) det(M) -Dq * Cr + Cq * Dr */ det = 1/det; *t = det * det1; @@ -1441,6 +1451,7 @@ return 1; /* Intersection found */ } + /** * B N _ I S E C T _ L I N E _ L S E G *@brief @@ -1451,14 +1462,14 @@ * with a line segment defined by two distinct points A and B. * * - * @return -4 A and B are not distinct points - * @return -3 Intersection exists, < A (t is returned) - * @return -2 Intersection exists, > B (t is returned) - * @return -1 Lines do not intersect - * @return 0 Lines are co-linear (t for A is returned) - * @return 1 Intersection at vertex A - * @return 2 Intersection at vertex B - * @return 3 Intersection between A and B + * @return -4 A and B are not distinct points + * @return -3 Intersection exists, < A (t is returned) + * @return -2 Intersection exists, > B (t is returned) + * @return -1 Lines do not intersect + * @return 0 Lines are co-linear (t for A is returned) + * @return 1 Intersection at vertex A + * @return 2 Intersection at vertex B + * @return 3 Intersection between A and B * * @par Implicit Returns - * @@ -1540,6 +1551,7 @@ return 3; /* Intersection between A and B */ } + /** * B N _ D I S T _ L I N E 3_ P T 3 *@brief @@ -1581,6 +1593,7 @@ return FdotD; } + /** * B N _ D I S T S Q _ L I N E 3 _ P T 3 * @@ -1615,6 +1628,7 @@ return FdotD; } + /** * B N _ D I S T _ L I N E _ O R I G I N *@brief @@ -1638,6 +1652,7 @@ return sqrt(PTdotD); } + /** * B N _ D I S T _ L I N E 2 _ P O I N T 2 *@brief @@ -1663,6 +1678,7 @@ return sqrt(FdotD); } + /** * B N _ D I S T S Q _ L I N E 2 _ P O I N T 2 *@brief @@ -1690,6 +1706,7 @@ return FdotD; } + /** * B N _ A R E A _ O F _ T R I A N G L E *@brief @@ -1724,12 +1741,12 @@ * Intersect a point P with the line segment defined by two distinct * points A and B. * - * @return -2 P on line AB but outside range of AB, + * @return -2 P on line AB but outside range of AB, * dist = distance from A to P on line. - * @return -1 P not on line of AB within tolerance - * @return 1 P is at A - * @return 2 P is at B - * @return 3 P is on AB, dist = distance from A to P on line. + * @return -1 P not on line of AB within tolerance + * @return 1 P is at A + * @return 2 P is at B + * @return 3 P is on AB, dist = distance from A to P on line. @verbatim B * | @@ -1808,18 +1825,19 @@ return 3; /* P on AtoB */ } + /** * B N _ I S E C T _ P T 2 _ L S E G 2 * @brief * Intersect a point P with the line segment defined by two distinct * points A and B. * - * @return -2 P on line AB but outside range of AB, + * @return -2 P on line AB but outside range of AB, * dist = distance from A to P on line. - * @return -1 P not on line of AB within tolerance - * @return 1 P is at A - * @return 2 P is at B - * @return 3 P is on AB, dist = distance from A to P on line. + * @return -1 P not on line of AB within tolerance + * @return 1 P is at A + * @return 2 P is at B + * @return 3 P is on AB, dist = distance from A to P on line. @verbatim B * | @@ -1898,6 +1916,7 @@ return 3; /* P on AtoB */ } + /** * B N _ D I S T _ P T 3 _ L S E G 3 *@brief @@ -1917,13 +1936,13 @@ * A PCA B @endverbatim * - * @return 0 P is within tolerance of lseg AB. *dist isn't 0: (SPECIAL!!!) + * @return 0 P is within tolerance of lseg AB. *dist isn't 0: (SPECIAL!!!) * *dist = parametric dist = |PCA-A| / |B-A|. pca=computed. - * @return 1 P is within tolerance of point A. *dist = 0, pca=A. - * @return 2 P is within tolerance of point B. *dist = 0, pca=B. - * @return 3 P is to the "left" of point A. *dist=|P-A|, pca=A. - * @return 4 P is to the "right" of point B. *dist=|P-B|, pca=B. - * @return 5 P is "above/below" lseg AB. *dist=|PCA-P|, pca=computed. + * @return 1 P is within tolerance of point A. *dist = 0, pca=A. + * @return 2 P is within tolerance of point B. *dist = 0, pca=B. + * @return 3 P is to the "left" of point A. *dist=|P-A|, pca=A. + * @return 4 P is to the "right" of point B. *dist=|P-B|, pca=B. + * @return 5 P is "above/below" lseg AB. *dist=|PCA-P|, pca=computed. * * This routine was formerly called bn_dist_pt_lseg(). * @@ -1961,7 +1980,7 @@ if ((P_A_sq = MAGSQ(PtoA)) < tol->dist_sq) { /* P is within the tol->dist radius circle around A */ VMOVE(pca, a); - if (bu_debug & BU_DEBUG_MATH) bu_log(" at A\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" at A\n"); *dist = 0.0; return 1; } @@ -1971,7 +1990,7 @@ if ((P_B_sq = MAGSQ(PtoB)) < tol->dist_sq) { /* P is within the tol->dist radius circle around B */ VMOVE(pca, b); - if (bu_debug & BU_DEBUG_MATH) bu_log(" at B\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" at B\n"); *dist = 0.0; return 2; } @@ -1990,7 +2009,7 @@ if (t <= 0) { /* P is "left" of A */ - if (bu_debug & BU_DEBUG_MATH) bu_log(" left of A\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" left of A\n"); VMOVE(pca, a); *dist = sqrt(P_A_sq); return 3; @@ -2006,22 +2025,23 @@ /* Find distance from PCA to line segment (Pythagorus) */ if ((dsq = P_A_sq - t * t) <= tol->dist_sq) { - if (bu_debug & BU_DEBUG_MATH) bu_log(" ON lseg\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" ON lseg\n"); /* Distance from PCA to lseg is zero, give param instead */ *dist = param_dist; /* special! */ return 0; } - if (bu_debug & BU_DEBUG_MATH) bu_log(" closest to lseg\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" closest to lseg\n"); *dist = sqrt(dsq); return 5; } /* P is "right" of B */ - if (bu_debug & BU_DEBUG_MATH) bu_log(" right of B\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" right of B\n"); VMOVE(pca, b); *dist = sqrt(P_B_sq); return 4; } + /** * B N _ D I S T _ P T 2 _ L S E G 2 *@brief @@ -2040,13 +2060,13 @@ * A PCA B @endverbatim * There are six distinct cases, with these return codes - - * @return 0 P is within tolerance of lseg AB. *dist isn't 0: (SPECIAL!!!) + * @return 0 P is within tolerance of lseg AB. *dist isn't 0: (SPECIAL!!!) * *dist = parametric dist = |PCA-A| / |B-A|. pca=computed. - * @return 1 P is within tolerance of point A. *dist = 0, pca=A. - * @return 2 P is within tolerance of point B. *dist = 0, pca=B. - * @return 3 P is to the "left" of point A. *dist=|P-A|**2, pca=A. - * @return 4 P is to the "right" of point B. *dist=|P-B|**2, pca=B. - * @return 5 P is "above/below" lseg AB. *dist=|PCA-P|**2, pca=computed. + * @return 1 P is within tolerance of point A. *dist = 0, pca=A. + * @return 2 P is within tolerance of point B. *dist = 0, pca=B. + * @return 3 P is to the "left" of point A. *dist=|P-A|**2, pca=A. + * @return 4 P is to the "right" of point B. *dist=|P-B|**2, pca=B. + * @return 5 P is "above/below" lseg AB. *dist=|PCA-P|**2, pca=computed. * * * Patterned after bn_dist_pt3_lseg3(). @@ -2078,7 +2098,7 @@ if ((P_A_sq = MAGSQ_2D(PtoA)) < tol->dist_sq) { /* P is within the tol->dist radius circle around A */ V2MOVE(pca, a); - if (bu_debug & BU_DEBUG_MATH) bu_log(" at A\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" at A\n"); *dist_sq = 0.0; return 1; } @@ -2088,7 +2108,7 @@ if ((P_B_sq = MAGSQ_2D(PtoB)) < tol->dist_sq) { /* P is within the tol->dist radius circle around B */ V2MOVE(pca, b); - if (bu_debug & BU_DEBUG_MATH) bu_log(" at B\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" at B\n"); *dist_sq = 0.0; return 2; } @@ -2107,7 +2127,7 @@ if (t <= 0) { /* P is "left" of A */ - if (bu_debug & BU_DEBUG_MATH) bu_log(" left of A\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" left of A\n"); V2MOVE(pca, a); *dist_sq = P_A_sq; return 3; @@ -2123,22 +2143,23 @@ /* Find distance from PCA to line segment (Pythagorus) */ if ((dsq = P_A_sq - t * t) <= tol->dist_sq) { - if (bu_debug & BU_DEBUG_MATH) bu_log(" ON lseg\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" ON lseg\n"); /* Distance from PCA to lseg is zero, give param instead */ *dist_sq = param_dist; /* special! Not squared. */ return 0; } - if (bu_debug & BU_DEBUG_MATH) bu_log(" closest to lseg\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" closest to lseg\n"); *dist_sq = dsq; return 5; } /* P is "right" of B */ - if (bu_debug & BU_DEBUG_MATH) bu_log(" right of B\n"); + if (bu_debug & BU_DEBUG_MATH) bu_log(" right of B\n"); V2MOVE(pca, b); *dist_sq = P_B_sq; return 4; } + /** * B N _ R O T A T E _ B B O X *@brief @@ -2170,6 +2191,7 @@ #undef ROT_VERT } + /** * B N _ R O T A T E _ P L A N E *@brief @@ -2197,6 +2219,7 @@ oplane[3] = VDOT(new_pt, oplane); } + /** * B N _ C O P L A N A R *@brief @@ -2204,10 +2227,10 @@ * be either +1 or -1, with the distance from the origin equal in * magnitude. * - * @return -1 not coplanar, parallel but distinct - * @return 0 not coplanar, not parallel. Planes intersect. - * @return +1 coplanar, same normal direction - * @return +2 coplanar, opposite normal direction + * @return -1 not coplanar, parallel but distinct + * @return 0 not coplanar, not parallel. Planes intersect. + * @return 1 coplanar, same normal direction + * @return 2 coplanar, opposite normal direction */ int bn_coplanar(const fastf_t *a, const fastf_t *b, const struct bn_tol *tol) @@ -2230,8 +2253,10 @@ /* parallel is when dot is within SMALL_FASTF of either -1 or 1 */ if ((dot <= -SMALL_FASTF) ? (NEAR_ZERO(dot + 1.0, SMALL_FASTF)) : (NEAR_ZERO(dot - 1.0, SMALL_FASTF))) { - if (bn_pt3_pt3_equal(pt_a, pt_b, tol)) { /* test for coplanar */ - if ( dot >= SMALL_FASTF) { /* test normals in same direction */ + if (bn_pt3_pt3_equal(pt_a, pt_b, tol)) { + /* test for coplanar */ + if (dot >= SMALL_FASTF) { + /* test normals in same direction */ return 1; } else { return 2; @@ -2243,6 +2268,7 @@ return 0; } + /** * B N _ A N G L E _ M E A S U R E * @@ -2299,6 +2325,7 @@ return ang; } + /** * B N _ D I S T _ P T 3 _ A L O N G _ L I N E 3 *@brief @@ -2343,6 +2370,7 @@ return ret; } + /** * * @return 1 if left <= mid <= right @@ -2358,7 +2386,7 @@ left -= tol->dist*0.1; right += tol->dist*0.1; } - if (mid < left || mid > right) goto fail; + if (mid < left || mid > right) goto fail; return 1; } /* The 'right' value is lowest */ @@ -2366,7 +2394,7 @@ right -= tol->dist*0.1; left += tol->dist*0.1; } - if (mid < right || mid > left) goto fail; + if (mid < right || mid > left) goto fail; return 1; fail: if (bu_debug & BU_DEBUG_MATH) { @@ -2376,6 +2404,7 @@ return 0; } + /** * B N _ D O E S _ R A Y _ I S E C T _ T R I * @@ -2431,6 +2460,7 @@ return 1; } + #if 0 /* * B N _ I S E C T _ R A Y _ T R I @@ -2584,6 +2614,7 @@ return class; } + /** B N _ D I S T S Q _ L I N E 3 _ L I N E 3 *@brief * Calculate the square of the distance of closest approach for two @@ -2631,25 +2662,19 @@ VSCALE(d, d_in, inv_len_d); de = VDOT(d, e); - if (NEAR_ZERO(de, SMALL_FASTF)) - { + if (NEAR_ZERO(de, SMALL_FASTF)) { /* lines are perpendicular */ dist[0] = VDOT(Q, d) - VDOT(P, d); dist[1] = VDOT(P, e) - VDOT(Q, e); - } - else - { + } else { VSUB2(PmQ, P, Q); denom = 1.0 - de*de; - if (NEAR_ZERO(denom, SMALL_FASTF)) - { + if (NEAR_ZERO(denom, SMALL_FASTF)) { /* lines are parallel */ dist[0] = 0.0; dist[1] = VDOT(PmQ, d); ret = 1; - } - else - { + } else { VBLEND2(tmp, 1.0, e, -de, d); dist[1] = VDOT(PmQ, tmp)/denom; dist[0] = dist[1] * de - VDOT(PmQ, d); @@ -2664,6 +2689,7 @@ return ret; } + /** * B N _ I S E C T _ P L A N E S *@brief @@ -2704,8 +2730,7 @@ if (bu_debug & BU_DEBUG_MATH) { bu_log("bn_isect_planes:\n"); - for (i=0; i<pl_count; i++) - { + for (i=0; i<pl_count; i++) { bu_log("Plane #%d (%f %f %f %f)\n", i, V4ARGS(planes[i])); } } @@ -2713,8 +2738,7 @@ MAT_ZERO(matrix); VSET(hpq, 0.0, 0.0, 0.0); - for (i=0; i<pl_count; i++) - { + for (i=0; i<pl_count; i++) { matrix[0] += planes[i][X] * planes[i][X]; matrix[5] += planes[i][Y] * planes[i][Y]; matrix[10] += planes[i][Z] * planes[i][Z]; @@ -2744,6 +2768,7 @@ } + /** * B N _ I S E C T _ L S E G _ R P P *@brief @@ -2752,8 +2777,8 @@ * The RPP is defined by a minimum point and a maximum point. This is * a very close relative to rt_in_rpp() from librt/shoot.c * - * @return 0 if ray does not hit RPP, - * @return !0 if ray hits RPP. + * @return 0 if ray does not hit RPP, + * @return !0 if ray hits RPP. * * @param[in, out] a Start point of lseg * @param[in, out] b End point of lseg @@ -2795,7 +2820,7 @@ maxdist = st; if (mindist < ((sv = (*min - *pt) / *dir))) mindist = sv; - } else { + } else { /* If direction component along this axis is NEAR 0, (ie, * this ray is aligned with this axis), merely check * against the boundaries. @@ -2825,6 +2850,7 @@ return 1; /* HIT */ } + /** @} */ /* * Local Variables: Modified: brlcad/branches/STABLE/src/libbu/parse.c =================================================================== --- brlcad/branches/STABLE/src/libbu/parse.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libbu/parse.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -604,7 +604,8 @@ for (; sdp->sp_name != (char *)0; sdp++) { if (strcmp(sdp->sp_name, name) != 0 /* no name match */ - && sdp->sp_fmt[0] != 'i') /* no include desc */ + && sdp->sp_fmt[0] != 'i' + && sdp->sp_fmt[1] != 'p') /* no include desc */ continue; Modified: brlcad/branches/STABLE/src/libged/bb.c =================================================================== --- brlcad/branches/STABLE/src/libged/bb.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/bb.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -70,11 +70,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - bu_optind = 1; /* re-init bu_getopt() */ while ((c = bu_getopt(argc, (char * const *)argv, "c:dequv")) != EOF) { switch (c) { Modified: brlcad/branches/STABLE/src/libged/cat.c =================================================================== --- brlcad/branches/STABLE/src/libged/cat.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/cat.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -52,7 +52,7 @@ return GED_HELP; } - if (argc < 2 || MAXARGS < argc) { + if (argc < 2) { bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); return GED_ERROR; } Modified: brlcad/branches/STABLE/src/libged/comb.c =================================================================== --- brlcad/branches/STABLE/src/libged/comb.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/comb.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -55,7 +55,7 @@ return GED_HELP; } - if (argc < 4 || MAXARGS < argc) { + if (argc < 4) { bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); return GED_ERROR; } Modified: brlcad/branches/STABLE/src/libged/comb_std.c =================================================================== --- brlcad/branches/STABLE/src/libged/comb_std.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/comb_std.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -454,7 +454,7 @@ return GED_HELP; } - if (argc < 3 || RT_MAXARGS < argc) { + if (argc < 3) { bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); return GED_ERROR; } Modified: brlcad/branches/STABLE/src/libged/dg_obj.c =================================================================== --- brlcad/branches/STABLE/src/libged/dg_obj.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/dg_obj.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -1327,7 +1327,7 @@ int i; char pstring[32]; - if (argc < 1 || MAXARGS < argc) { + if (argc < 1) { struct bu_vls vls; bu_vls_init(&vls); @@ -1402,7 +1402,7 @@ struct dg_obj *dgop = (struct dg_obj *)clientData; struct view_obj *vop; - if (argc < 3 || MAXARGS < argc) { + if (argc < 3) { struct bu_vls vls; bu_vls_init(&vls); @@ -2055,7 +2055,7 @@ DGO_CHECK_WDBP_NULL(dgop, interp); - if (argc < 3 || MAXARGS < argc) { + if (argc < 3) { struct bu_vls vls; bu_vls_init(&vls); @@ -2269,7 +2269,7 @@ struct dg_obj *dgop = (struct dg_obj *)clientData; struct view_obj *vop; - if (argc < 3 || MAXARGS < argc) { + if (argc < 3) { struct bu_vls vls; bu_vls_init(&vls); @@ -2305,7 +2305,7 @@ struct dg_obj *dgop = (struct dg_obj *)clientData; struct view_obj *vop; - if (argc < 5 || MAXARGS < argc) { + if (argc < 5) { struct bu_vls vls; bu_vls_init(&vls); @@ -4664,7 +4664,7 @@ if (!dgop || !dgop->dgo_wdbp || dgop->dgo_wdbp->dbip == DBI_NULL) return TCL_ERROR; - if (argc < 1 || MAXARGS < argc) { + if (argc < 1) { bu_vls_init(&vls); bu_vls_printf(&vls, "helplib_alias wdb_tree %s", argv[0]); Tcl_Eval(interp, bu_vls_addr(&vls)); Modified: brlcad/branches/STABLE/src/libged/edcodes.c =================================================================== --- brlcad/branches/STABLE/src/libged/edcodes.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/edcodes.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -99,10 +99,6 @@ struct rt_db_internal intern; struct rt_comb_internal *comb; - if (pathpos >= RT_MAXARGS) { - return EDCODES_HALT; - } - if (!(dp->d_flags & RT_DIR_COMB)) return EDCODES_OK; Modified: brlcad/branches/STABLE/src/libged/erase.c =================================================================== --- brlcad/branches/STABLE/src/libged/erase.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/erase.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -33,14 +33,12 @@ #include "./ged_private.h" + void ged_splitGDL(struct ged *gedp, struct ged_display_list *gdlp, struct db_full_path *path); /* * Erase objects from the display. * - * Usage: - * erase object(s) - * */ int ged_erase(struct ged *gedp, int argc, const char *argv[]) @@ -50,7 +48,7 @@ int flag_o_nonunique=1; int last_opt=0; struct bu_vls vls; - static const char *usage = "<objects(s)> | <-o -A attribute name/value pairs>"; + static const char *usage = "[[-o] -A attribute=value] [object(s)]"; GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR); GED_CHECK_DRAWABLE(gedp, GED_ERROR); @@ -89,15 +87,8 @@ last_opt = i; if (!ptr_A && !ptr_o) { -#if 1 bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); return GED_ERROR; -#else - /*XXX Use this section when we have more options (i.e. ones other than -A or -o) */ - bu_vls_putc(&vls, ' '); - bu_vls_strcat(&vls, argv[i]); - continue; -#endif } if (strlen(argv[i]) == ((size_t)1 + (ptr_A != NULL) + (ptr_o != NULL))) { @@ -105,22 +96,8 @@ continue; } -#if 1 bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); return GED_ERROR; -#else - /*XXX Use this section when we have more options (i.e. ones other than -A or -o) */ - - /* copy args other than "-A" or "-o" */ - bu_vls_putc(&vls, ' '); - c = (char *)argv[i]; - while (*c != '\0') { - if (*c != 'A' && *c != 'o') { - bu_vls_putc(&vls, *c); - } - c++; - } -#endif } if (flag_A_attr) { Modified: brlcad/branches/STABLE/src/libged/expand.c =================================================================== --- brlcad/branches/STABLE/src/libged/expand.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/expand.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -58,11 +58,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - nummatch = 0; backslashed = 0; for (whicharg = 1; whicharg < argc; whicharg++) { Modified: brlcad/branches/STABLE/src/libged/find.c =================================================================== --- brlcad/branches/STABLE/src/libged/find.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/find.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -82,11 +82,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - bu_optind = 1; /* re-init bu_getopt() */ while ((c = bu_getopt(argc, (char * const *)argv, "a")) != EOF) { switch (c) { Modified: brlcad/branches/STABLE/src/libged/group.c =================================================================== --- brlcad/branches/STABLE/src/libged/group.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/group.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -54,7 +54,7 @@ return GED_HELP; } - if (argc < 3 || MAXARGS < argc) { + if (argc < 3) { bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); return GED_ERROR; } Modified: brlcad/branches/STABLE/src/libged/keep.c =================================================================== --- brlcad/branches/STABLE/src/libged/keep.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/keep.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -143,11 +143,6 @@ return GED_ERROR; } - if (argc > MAXARGS) { - bu_vls_printf(&gedp->ged_result_str, "ERROR: too many arguments\n"); - return GED_ERROR; - } - /* First, clear any existing counts */ for (i = 0; i < RT_DBNHASH; i++) { for (dp = gedp->ged_wdbp->dbip->dbi_Head[i]; dp != DIR_NULL; dp = dp->d_forw) Modified: brlcad/branches/STABLE/src/libged/kill.c =================================================================== --- brlcad/branches/STABLE/src/libged/kill.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/kill.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -59,11 +59,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - bu_optind = 1; while ((c = bu_getopt(argc, (char * const *)argv, "fn")) != EOF) { switch( c ) { Modified: brlcad/branches/STABLE/src/libged/killall.c =================================================================== --- brlcad/branches/STABLE/src/libged/killall.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/killall.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -54,11 +54,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - /* Process the -n option */ if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && argv[1][2] == '\0') { int i; Modified: brlcad/branches/STABLE/src/libged/killrefs.c =================================================================== --- brlcad/branches/STABLE/src/libged/killrefs.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/killrefs.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -60,11 +60,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - /* Process the -n option */ if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && argv[1][2] == '\0') { nflag = 1; Modified: brlcad/branches/STABLE/src/libged/killtree.c =================================================================== --- brlcad/branches/STABLE/src/libged/killtree.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/killtree.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -68,11 +68,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - gktd.gedp = gedp; gktd.ac = 1; gktd.av[0] = "killrefs"; Modified: brlcad/branches/STABLE/src/libged/list.c =================================================================== --- brlcad/branches/STABLE/src/libged/list.c 2010-11-09 14:13:26 UTC (rev 41300) +++ brlcad/branches/STABLE/src/libged/list.c 2010-11-09 14:16:05 UTC (rev 41301) @@ -59,11 +59,6 @@ return GED_HELP; } - if (MAXARGS < argc) { - bu_vls_printf(&gedp->ged_result_str, "Usage: %s %s", argv[0], usage); - return GED_ERROR; - } - if (argc > 1 && strcmp(argv[1], "-r"... [truncated message content] |