Revision: 71613
          http://sourceforge.net/p/brlcad/code/71613
Author:   starseeker
Date:     2018-08-29 01:21:44 +0000 (Wed, 29 Aug 2018)
Log Message:
-----------
do the BoT bbox check for the SPSR output as well.

Modified Paths:
--------------
    brlcad/trunk/src/libged/facetize.c

Modified: brlcad/trunk/src/libged/facetize.c
===================================================================
--- brlcad/trunk/src/libged/facetize.c  2018-08-29 01:18:25 UTC (rev 71612)
+++ brlcad/trunk/src/libged/facetize.c  2018-08-29 01:21:44 UTC (rev 71613)
@@ -1312,6 +1312,24 @@
        }
     }
 
+    /* Check the volume of the bounding box of the BoT against the bounding box
+     * of the point cloud - a large difference means something probably isn't
+     * right.  For the moment, use >50% difference. */
+    {
+       point_t b_min, b_max;
+       VSETALL(b_min, INFINITY);
+       VSETALL(b_max, -INFINITY);
+       _pnts_bbox(b_min, b_max, bot->num_vertices, (point_t *)bot->vertices);
+       r->bot_bbox_vol = _bbox_vol(b_min, b_max);
+       if (fabs(r->pnts_bbox_vol - r->bot_bbox_vol) > r->pnts_bbox_vol * 0.5) {
+           ret = GED_FACETIZE_FAILURE;
+           r->failure_mode = GED_FACETIZE_FAILURE_BOTBBOX;
+           if (bot->vertices) bu_free(bot->vertices, "verts");
+           if (bot->faces) bu_free(bot->faces, "verts");
+           goto ged_facetize_continuation_memfree;
+       }
+    }
+
     /* Check validity - do not return an invalid BoT */
     {
        int is_v = !bg_trimesh_solid(bot->num_vertices, bot->num_faces, 
(fastf_t *)bot->vertices, (int *)bot->faces, NULL);

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to