0026173: Wrong result of ChFi3d_ChBuilder algorithm: incorrect processing of G1 junct...
[occt.git] / src / ChFiDS / ChFiDS_Spine.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 48a04ed..4816b18
@@ -1,25 +1,43 @@
-// File:       ChFiDS_Spine.cxx
-// Created:    Thu Nov 18 12:36:53 1993
-// Author:     Isabelle GRIGNON
-//             <isg@zerox>
-// Modified by isg, Thu Mar 17 09:21:31 1994
+// Created on: 1993-11-18
+// Created by: Isabelle GRIGNON
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
+// Modified by isg, Thu Mar 17 09:21:31 1994
 
-#include <ChFiDS_Spine.ixx>
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <ChFiDS_ErrorStatus.hxx>
 #include <ChFiDS_HElSpine.hxx>
-#include <ChFiDS_ErrorStatus.hxx> 
 #include <ChFiDS_ListIteratorOfListOfHElSpine.hxx>
-#include <GCPnts_AbscissaPoint.hxx>
-#include <TopExp.hxx>
-#include <BRep_Tool.hxx>
+#include <ChFiDS_Spine.hxx>
 #include <ElCLib.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
 #include <Precision.hxx>
+#include <Standard_Type.hxx>
+#include <TopExp.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
 
 //=======================================================================
 //function : ChFiDS_Spine
 //purpose  : 
 //=======================================================================
-
 ChFiDS_Spine::ChFiDS_Spine():
        splitdone(Standard_False),
        tolesp(Precision::Confusion()),
@@ -75,14 +93,19 @@ Handle(ChFiDS_HElSpine) ChFiDS_Spine::ElSpine(const Standard_Integer IE) const
 
 Handle(ChFiDS_HElSpine) ChFiDS_Spine::ElSpine(const Standard_Real W) const 
 {
-  ChFiDS_ListIteratorOfListOfHElSpine It(elspines);
-  for (; It.More(); It.Next()) {
-    Handle(ChFiDS_HElSpine) cur = It.Value();
-    Standard_Real uf = cur->FirstParameter();
-    Standard_Real ul = cur->LastParameter();
-    if(uf <= W && W <= ul) return cur;
-  }  
-  return Handle(ChFiDS_HElSpine)();
+  if (elspines.Extent() == 1)
+    return elspines.First();
+  else
+  {
+    ChFiDS_ListIteratorOfListOfHElSpine It(elspines);
+    for (; It.More(); It.Next()) {
+      Handle(ChFiDS_HElSpine) cur = It.Value();
+      Standard_Real uf = cur->FirstParameter();
+      Standard_Real ul = cur->LastParameter();
+      if(uf <= W && W <= ul) return cur;
+    }  
+    return Handle(ChFiDS_HElSpine)();
+  }
 }
 
 //=======================================================================
@@ -162,7 +185,7 @@ Standard_Real  ChFiDS_Spine::LastParameter() const
 
 void ChFiDS_Spine::SetFirstParameter(const Standard_Real Par) 
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if(Par >= Precision::Confusion()) 
     cout<<"Interior extension at the start of guideline"<<endl;
   if(IsPeriodic())
@@ -180,7 +203,7 @@ void ChFiDS_Spine::SetFirstParameter(const Standard_Real Par)
 
 void ChFiDS_Spine::SetLastParameter(const Standard_Real Par) 
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Real lll = abscissa->Value(abscissa->Upper());
   if((Par - lll) <= -Precision::Confusion()) 
     cout<<"Interior extension at the end of guideline"<<endl;
@@ -335,7 +358,7 @@ void  ChFiDS_Spine::SetFirstTgt(const Standard_Real W)
 {
   if(IsPeriodic()) Standard_Failure::Raise
     ("No extension by tangent on periodic contours"); 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if(W >= Precision::Confusion()) 
     cout<<"Interior extension at start of the guideline"<<endl;
 #endif
@@ -359,7 +382,7 @@ void  ChFiDS_Spine::SetLastTgt(const Standard_Real W)
   if(IsPeriodic()) Standard_Failure::Raise
     ("No extension by tangent periodic contours"); 
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Real L = W - abscissa->Value(abscissa->Upper());
   if(L <= -Precision::Confusion()) 
     cout<<"Interior extension at the end of guideline"<<endl;
@@ -479,7 +502,7 @@ void  ChFiDS_Spine::UnsetReference()
 void  ChFiDS_Spine::Load()
 {
   if(!abscissa.IsNull()){
-#ifdef DEB
+#ifdef OCCT_DEBUG
     cout<<"new load of CE"<<endl;
 #endif
   }