Revision: 52496
          http://brlcad.svn.sourceforge.net/brlcad/?rev=52496&view=rev
Author:   r_weiss
Date:     2012-09-18 18:04:57 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
Updated function "nmg_isect_2faceuse" in file "nmg_inter.c". Fixed bug 
computing average distance to plane. Also simplified the code by using the 
VCLAMP macro.

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c   2012-09-18 17:21:45 UTC 
(rev 52495)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c   2012-09-18 18:04:57 UTC 
(rev 52496)
@@ -7813,7 +7813,7 @@
        for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
            NMG_CK_EDGEUSE(eu);
            cnt++;
-           dist = DIST_PT_PLANE(eu->vu_p->v_p->vg_p->coord, f2_pl);
+           dist = fabs(DIST_PT_PLANE(eu->vu_p->v_p->vg_p->coord, f2_pl));
            tot_dist += dist;
            /* the current distance is included in the average
             * that the current distance is compared against
@@ -7844,7 +7844,7 @@
            for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
                NMG_CK_EDGEUSE(eu);
                cnt++;
-               dist = DIST_PT_PLANE(eu->vu_p->v_p->vg_p->coord, f1_pl);
+               dist = fabs(DIST_PT_PLANE(eu->vu_p->v_p->vg_p->coord, f1_pl));
                tot_dist += dist;
                /* the current distance is included in the average
                 * that the current distance is compared against
@@ -7926,15 +7926,8 @@
     abs_dir[Y] = fabs(dir[Y]);
     abs_dir[Z] = fabs(dir[Z]);
 
-    if (ZERO(abs_dir[X])) {
-       abs_dir[X] = 0.0;
-    }
-    if (ZERO(abs_dir[Y])) {
-       abs_dir[Y] = 0.0;
-    }
-    if (ZERO(abs_dir[Z])) {
-       abs_dir[Z] = 0.0;
-    }
+    /* Clamp abs_dir vector to zero if within tolerance of zero. */
+    VCLAMP(abs_dir);
 
     if (abs_dir[X] >= abs_dir[Y]) {
        if (abs_dir[X] >= abs_dir[Z]) {

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to