Revision: 55982
http://sourceforge.net/p/brlcad/code/55982
Author: phoenixyjll
Date: 2013-07-09 03:00:53 +0000 (Tue, 09 Jul 2013)
Log Message:
-----------
Use 2D intersection tolerance with the 2D distances.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/intersect.cpp
Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp 2013-07-08 19:45:51 UTC (rev
55981)
+++ brlcad/trunk/src/libbrep/intersect.cpp 2013-07-09 03:00:53 UTC (rev
55982)
@@ -1822,7 +1822,24 @@
build_surface_root(surfB, surfaceB_udomain, surfaceB_vdomain, rootB);
if (rootA.Intersect(rootB, intersection_tolerance))
candidates.push_back(std::make_pair(&rootA, &rootB));
+ else
+ return 0;
+ // We adjust the tolerance from 3D scale to respective 2D scales.
+ double intersection_tolerance_A = intersection_tolerance;
+ double intersection_tolerance_B = intersection_tolerance;
+ double l = rootA.m_surf->BoundingBox().Diagonal().Length();
+ double ul = surfaceA_udomain ? surfaceA_udomain->Length() :
surfA->Domain(0).Length();
+ double vl = surfaceA_vdomain ? surfaceA_vdomain->Length() :
surfA->Domain(1).Length();
+ double dl = ON_2dVector(ul, vl).Length();
+ if (!ON_NearZero(l))
+ intersection_tolerance_A = intersection_tolerance/l*dl;
+ ul = surfaceB_udomain ? surfaceB_udomain->Length() :
surfB->Domain(0).Length();
+ vl = surfaceB_vdomain ? surfaceB_vdomain->Length() :
surfB->Domain(1).Length();
+ dl = ON_2dVector(ul, vl).Length();
+ if (!ON_NearZero(l))
+ intersection_tolerance_B = intersection_tolerance/l*dl;
+
ON_3dPointArray curvept, tmp_curvept;
ON_2dPointArray curveuv, curvest, tmp_curveuv, tmp_curvest;
@@ -2020,8 +2037,8 @@
int j;
for (j = 0; j < curvept.Count(); j++)
if (tmp_curvept[i].DistanceTo(curvept[j]) < intersection_tolerance
- && tmp_curveuv[i].DistanceTo(curveuv[j]) <
intersection_tolerance
- && tmp_curvest[i].DistanceTo(curvest[j]) <
intersection_tolerance)
+ && tmp_curveuv[i].DistanceTo(curveuv[j]) <
intersection_tolerance_A
+ && tmp_curvest[i].DistanceTo(curvest[j]) <
intersection_tolerance_B)
break;
// TODO: Use 2D tolerance
if (j == curvept.Count()) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits