Revision: 56379
          http://sourceforge.net/p/brlcad/code/56379
Author:   phoenixyjll
Date:     2013-07-31 05:04:57 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Use build_curve_root() instead of duplicating that routine.

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/intersect.cpp

Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp      2013-07-31 04:20:03 UTC (rev 
56378)
+++ brlcad/trunk/src/libbrep/intersect.cpp      2013-07-31 05:04:57 UTC (rev 
56379)
@@ -300,6 +300,34 @@
 }
 
 
+// Build the curve tree root within a given domain
+bool
+build_curve_root(const ON_Curve* curve, const ON_Interval* domain, Subcurve& 
root)
+{
+    if (domain == NULL || *domain == curve->Domain()) {
+       root.m_curve = curve->Duplicate();
+       root.m_t = curve->Domain();
+    } else {
+       // Use ON_Curve::Split() to get the sub-curve inside the domain
+       ON_Curve *temp_curve1 = NULL, *temp_curve2 = NULL, *temp_curve3 = NULL;
+       if (!curve->Split(domain->Min(), temp_curve1, temp_curve2))
+           return false;
+       delete temp_curve1;
+       temp_curve1 = NULL;
+       if (!temp_curve2->Split(domain->Max(), temp_curve1, temp_curve3))
+           return false;
+       delete temp_curve1;
+       delete temp_curve2;
+       root.m_curve = temp_curve3;
+       root.m_t = *domain;
+    }
+
+    root.SetBBox(root.m_curve->BoundingBox());
+    root.m_islinear = root.m_curve->IsLinear();
+    return true;
+}
+
+
 /**
  * Point-point intersections (PPI)
  *
@@ -381,28 +409,9 @@
     check_domain(curveB_domain, curveB.Domain(), "curveB_domain");
 
     Subcurve root;
-    if (curveB_domain == NULL || *curveB_domain == curveB.Domain()) {
-       root.m_curve = curveB.Duplicate();
-       root.m_t = curveB.Domain();
-    }
-    else {
-       // Use ON_Curve::Split() to get the sub-curve inside curveB_domain
-       ON_Curve *temp_curve1 = NULL, *temp_curve2 = NULL, *temp_curve3 = NULL;
-       if (!curveB.Split(curveB_domain->Min(), temp_curve1, temp_curve2))
-           return false;
-       delete temp_curve1;
-       temp_curve1 = NULL;
-       if (!temp_curve2->Split(curveB_domain->Max(), temp_curve1, temp_curve3))
-           return false;
-       delete temp_curve1;
-       delete temp_curve2;
-       root.m_curve = temp_curve3;
-       root.m_t = *curveB_domain;
-    }
+    if (!build_curve_root(&curveB, curveB_domain, root))
+       return false;
 
-    root.SetBBox(root.m_curve->BoundingBox());
-    root.m_islinear = root.m_curve->IsLinear();
-
     if (!root.IsPointIn(pointA, tolerance))
        return false;
 
@@ -609,34 +618,6 @@
 #define CCI_OVERLAP_TEST_POINTS 16
 
 
-// Build the curve tree root within a given domain
-bool
-build_curve_root(const ON_Curve* curve, const ON_Interval* domain, Subcurve& 
root)
-{
-    if (domain == NULL || *domain == curve->Domain()) {
-       root.m_curve = curve->Duplicate();
-       root.m_t = curve->Domain();
-    } else {
-       // Use ON_Curve::Split() to get the sub-curve inside the domain
-       ON_Curve *temp_curve1 = NULL, *temp_curve2 = NULL, *temp_curve3 = NULL;
-       if (!curve->Split(domain->Min(), temp_curve1, temp_curve2))
-           return false;
-       delete temp_curve1;
-       temp_curve1 = NULL;
-       if (!temp_curve2->Split(domain->Max(), temp_curve1, temp_curve3))
-           return false;
-       delete temp_curve1;
-       delete temp_curve2;
-       root.m_curve = temp_curve3;
-       root.m_t = *domain;
-    }
-
-    root.SetBBox(root.m_curve->BoundingBox());
-    root.m_islinear = root.m_curve->IsLinear();
-    return true;
-}
-
-
 void
 newton_cci(double& t_a, double& t_b, const ON_Curve* curveA, const ON_Curve* 
curveB, double intersection_tolerance)
 {

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


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to