Revision: 40994
          http://brlcad.svn.sourceforge.net/brlcad/?rev=40994&view=rev
Author:   r_weiss
Date:     2010-10-14 21:07:56 +0000 (Thu, 14 Oct 2010)

Log Message:
-----------
Updated function bn_vec_ortho. Loosened the restriction on the input value and 
forced the function to bu_bomb if it can not return a valid result. Changed a 
NEAR_ZERO test to use SMALL_FASTF instead of SMALL.

Modified Paths:
--------------
    brlcad/trunk/src/libbn/mat.c

Modified: brlcad/trunk/src/libbn/mat.c
===================================================================
--- brlcad/trunk/src/libbn/mat.c        2010-10-14 05:33:42 UTC (rev 40993)
+++ brlcad/trunk/src/libbn/mat.c        2010-10-14 21:07:56 UTC (rev 40994)
@@ -1064,13 +1064,10 @@
     register fastf_t f;
     register int i;
 
-    if (NEAR_ZERO(in[X], 0.0001)
-       && NEAR_ZERO(in[Y], 0.0001)
-       && NEAR_ZERO(in[Z], 0.0001))
-    {
+    if (NEAR_ZERO(MAGSQ(in), SQRT_SMALL_FASTF)) {
        VSETALL(out, 0);
-       VPRINT("bn_vec_ortho: zero-length input", in);
-       return;
+       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");
     }
 
     /* Find component closest to zero */
@@ -1090,8 +1087,8 @@
        k = Y;
     }
     f = hypot(in[j], in[k]);
-    if (NEAR_ZERO(f, SMALL)) {
-       VPRINT("bn_vec_ortho: zero hypot on", in);
+    if (NEAR_ZERO(f, SMALL_FASTF)) {
+       bu_log("bn_vec_ortho(): zero hypot on %lf %lf %lf\n", 
in[0],in[1],in[2]);
        VSETALL(out, 0);
        return;
     }
@@ -1099,6 +1096,8 @@
     out[i] = 0.0;
     out[j] = -in[k]*f;
     out[k] =  in[j]*f;
+
+    return;
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to