Revision: 58814 http://sourceforge.net/p/brlcad/code/58814 Author: starseeker Date: 2013-12-04 16:23:35 +0000 (Wed, 04 Dec 2013) Log Message: ----------- Axis aligned box was actually the correct one, so set it up correctly
Modified Paths: -------------- brlcad/trunk/src/libbn/obr.c brlcad/trunk/src/libbn/tests/bn_obr.c Modified: brlcad/trunk/src/libbn/obr.c =================================================================== --- brlcad/trunk/src/libbn/obr.c 2013-12-04 14:46:21 UTC (rev 58813) +++ brlcad/trunk/src/libbn/obr.c 2013-12-04 16:23:35 UTC (rev 58814) @@ -171,20 +171,8 @@ extent0 = 0.5 * V2DOT(u,right_left_diff); extent1 = 0.5 * V2DOT(v,top_bottom_diff); area = extent0 * extent1 * 4; + if (area < obr->area) { - /* - bu_log("left_pnt: %f, %f\n", left_pnt[0], left_pnt[1]); - bu_log("bottom_pnt: %f, %f\n", bottom_pnt[0], bottom_pnt[1]); - bu_log("right_pnt: %f, %f\n", right_pnt[0], right_pnt[1]); - bu_log("top_pnt: %f, %f\n", top_pnt[0], top_pnt[1]); - bu_log("u: %f, %f\n", u[0], u[1]); - bu_log("v: %f, %f\n", v[0], v[1]); - bu_log("right_left_diff: %f, %f\n", right_left_diff[0], right_left_diff[1]); - bu_log("top_bottom_diff: %f, %f\n", top_bottom_diff[0], top_bottom_diff[1]); - bu_log("extent0: %f\n", extent0); - bu_log("extent1: %f\n", extent1); - bu_log("area: %f\n", area); -*/ obr->area = area; V2MOVE(obr->u, u); V2MOVE(obr->v, v); @@ -315,10 +303,13 @@ /* initialize with AABB */ obr->center[0] = 0.5 * (xmin + xmax); obr->center[1] = 0.5 * (ymin + ymax); - V2SET(obr->u, 1, 0); - obr->extent0 = (xmax - xmin); - obr->extent1 = (ymax - ymin); - obr->area = obr->extent0 * obr->extent1; + V2SET(obr->u, obr->center[0], 0); + V2UNITIZE(obr->u); + V2SET(obr->v, -obr->u[1], obr->u[0]); + V2UNITIZE(obr->v); + obr->extent0 = 0.5 * (xmax - xmin); + obr->extent1 = 0.5 * (ymax - ymin); + obr->area = obr->extent0 * obr->extent1 * 4; /* 3. The rotating calipers algorithm */ done = 0; Modified: brlcad/trunk/src/libbn/tests/bn_obr.c =================================================================== --- brlcad/trunk/src/libbn/tests/bn_obr.c 2013-12-04 14:46:21 UTC (rev 58813) +++ brlcad/trunk/src/libbn/tests/bn_obr.c 2013-12-04 16:23:35 UTC (rev 58814) @@ -132,10 +132,10 @@ V2SET(pnts[1], 3.0, 0.0); V2SET(pnts[2], 2.0, 4.0); - V2SET(expected[0], 1.2, 1.4); - V2SET(expected[1], 3.0, 2.0); - V2SET(expected[2], 2.75, 2.75); - V2SET(expected[3], 0.95, 2.15); + V2SET(expected[0], 1.0, 0.0); + V2SET(expected[1], 3.0, 0.0); + V2SET(expected[2], 3.0, 4.0); + V2SET(expected[3], 1.0, 4.0); retval = bn_2d_obr(¢er, &u, &v, (const point2d_t *)pnts, n); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits