// Created on: 1993-11-18
// Created by: Jean Yves LEBEY
// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
-#include <TopOpeBRep_FacesIntersector.ixx>
+#include <Bnd_Box.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRepTopAdaptor_TopolTool.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopOpeBRep_FacesIntersector.hxx>
+#include <TopOpeBRep_LineInter.hxx>
#ifdef DRAW
#include <TopOpeBRep_DRAW.hxx>
Standard_EXPORT Standard_Real GLOBAL_tolFF = 1.e-7;
-#ifdef DEB
+#ifdef OCCT_DEBUG
#include <TopAbs.hxx>
-Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceFI();
-Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceFITOL();
-Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSAVFF();
+extern Standard_Boolean TopOpeBRep_GettraceFI();
+extern Standard_Boolean TopOpeBRep_GettraceFITOL();
+extern Standard_Boolean TopOpeBRep_GettraceSAVFF();
-Standard_EXPORT Standard_Integer SAVFFi1 = 0;
-Standard_EXPORT Standard_Integer SAVFFi2 = 0;
+Standard_Integer SAVFFi1 = 0;
+Standard_Integer SAVFFi2 = 0;
static void SAVFF(const TopoDS_Face& F1,const TopoDS_Face& F2)
{
TCollection_AsciiString an1("SAVA");if (SAVFFi1) an1=an1+SAVFFi1;
cout<<"FaceIntersector : write "<<n1<<","<<n2<<endl;BRepTools::Write(F1,n1);BRepTools::Write(F2,n2);
}
-Standard_EXPORT Standard_Boolean TopOpeBRepTool_GettraceKRO();
+extern Standard_Boolean TopOpeBRepTool_GettraceKRO();
#include <TopOpeBRepTool_KRO.hxx>
Standard_EXPORT TOPKRO KRO_DSFILLER_INTFF("intersection face/face");
void TopOpeBRep_FacesIntersector::Perform(const TopoDS_Shape& F1,const TopoDS_Shape& F2,
const Bnd_Box& B1,const Bnd_Box& B2)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRep_GettraceSAVFF()) SAVFF(TopoDS::Face(F1),TopoDS::Face(F2));
#endif
BRepAdaptor_Surface& S2 = mySurface2->ChangeSurface(); S2.Initialize(myFace2);
mySurfaceType1 = S1.GetType();
mySurfaceType2 = S2.GetType();
- myDomain1->Initialize(mySurface1);
- myDomain2->Initialize(mySurface2);
+ const Handle(Adaptor3d_HSurface)& aSurf1 = mySurface1; // to avoid ambiguity
+ myDomain1->Initialize(aSurf1);
+ const Handle(Adaptor3d_HSurface)& aSurf2 = mySurface2; // to avoid ambiguity
+ myDomain2->Initialize(aSurf2);
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFF.Start();
#endif
Standard_Real tol2 = myTol2;
GLOBAL_tolFF = Max(tol1,tol2);
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRep_GettraceFITOL()) {
cout<<"FacesIntersector : Perform tol1 = "<<tol1<<endl;
cout<<" tol2 = "<<tol2<<endl;
#endif
myIntersector.SetTolerances(myTol1,myTol2,MaxUV,Deflection);
- myIntersector.Perform(mySurface1,myDomain1,mySurface2,myDomain2,myTol1,myTol2);
+ myIntersector.Perform(mySurface1,myDomain1,mySurface2,myDomain2,
+ myTol1,myTol2,Standard_True,Standard_True,
+ Standard_False);
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFF.Stop();
#endif
}
}
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRep_GettraceFI()) cout<<"Perform : isempty "<<IsEmpty()<<endl;
#endif
}
myTol1 = Tol1;
myTol2 = Tol2;
myForceTolerances = Standard_True;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRep_GettraceFITOL())
cout<<"ForceTolerances : myTol1,myTol2 = "<<myTol1<<","<<myTol2<<endl;
#endif
//purpose : (private)
//=======================================================================
-#ifdef DEB
+#ifdef OCCT_DEBUG
void TopOpeBRep_FacesIntersector::ShapeTolerances(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
#else
myTol1 = Precision::Confusion();
myTol2 = myTol1;
myForceTolerances = Standard_False;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (TopOpeBRep_GettraceFITOL()) {
cout<<"ShapeTolerances on S1 = ";TopAbs::Print(S1.ShapeType(),cout);
cout<<" S2 = ";TopAbs::Print(S2.ShapeType(),cout);
Standard_Real Fp = 0., Lp = 0.;
- if( WLineRank == 1 )
- {
- Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
- Standard_Integer arcnumber = GetArc(theSlin,WLineRank,theSurface1,theDomain1,theSurface2,testPoint,TolVrtx,aLineOn2S,Fp,Lp);
-
- if( arcnumber == 0 )
- return;
-
- Handle(IntPatch_WLine) anWLine = NULL;
- anWLine = GetMergedWLineOnRestriction(theSlin,TolVrtx,aLineOn2S);
-#ifdef DEB
- cout << "*** TopOpeBRep_FaceIntersector: Merge WLines on Restriction S1 to WLine ***" << endl;
-#endif
- theSlin.Clear();
- theSlin.Append(anWLine);
- }
- else
- {
- Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
- Standard_Integer arcnumber = GetArc(theSlin,WLineRank,theSurface2,theDomain2,theSurface1,testPoint,TolVrtx,aLineOn2S,Fp,Lp);
-
- if( arcnumber == 0 )
- return;
-
- Handle(IntPatch_WLine) anWLine = NULL;
- anWLine = GetMergedWLineOnRestriction(theSlin,TolVrtx,aLineOn2S);
-#ifdef DEB
- cout << "*** TopOpeBRep_FaceIntersector: Merge WLines on Restriction S2 to WLine***" << endl;
+ Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
+ //
+ Standard_Integer arcnumber = (WLineRank == 1) ?
+ GetArc(theSlin,WLineRank,theSurface1,theDomain1,theSurface2,testPoint,TolVrtx,aLineOn2S,Fp,Lp) :
+ GetArc(theSlin,WLineRank,theSurface2,theDomain2,theSurface1,testPoint,TolVrtx,aLineOn2S,Fp,Lp);
+ //
+ if (arcnumber == 0) {
+ return;
+ }
+ //
+ Handle(IntPatch_WLine) anWLine = GetMergedWLineOnRestriction(theSlin,TolVrtx,aLineOn2S);
+ if (!anWLine.IsNull()) {
+ theSlin.Clear();
+ theSlin.Append(anWLine);
+#ifdef OCCT_DEBUG
+ cout << "*** TopOpeBRep_FaceIntersector: Merge WLines on Restriction "
+ << ((WLineRank == 1) ? "S1" : "S2") << " to WLine***" << endl;
#endif
- theSlin.Clear();
- theSlin.Append(anWLine);
- }
+ }
}
//=========================================================================================
}
}
// c. all middle gaps
- Standard_Integer NbChkPnts = theSlin.Length() - 1;
+ Standard_Integer NbChkPnts = WLVertexParameters.Length() / 2 - 1;
for(i = 1; i <= NbChkPnts; i++)
{
if( Abs(WLVertexParameters.Value(i*2+1) - WLVertexParameters.Value(i*2)) > arc->Resolution(MaxVertexTol))
Extrema_ExtPS extPS(theTestPnt,theTestSurface,ExtTol,ExtTol);
if( extPS.IsDone() && extPS.NbExt() > 0 )
{
- Standard_Integer i = 0, minext = 1;
+ Standard_Integer i = 0;
Standard_Real MinDist2 = 1.e+200;
for(i = 1; i <= extPS.NbExt(); i++)
{
if( extPS.SquareDistance(i) < MinDist2 )
{
- minext = i;
MinDist2 = extPS.SquareDistance(i);
}
}
const Standard_Real& theVrtxTol,
const Handle(IntSurf_LineOn2S)& theLineOn2S)
{
+ Handle(IntPatch_WLine) mWLine;
+ if (theLineOn2S->NbPoints() == 0) {
+ return mWLine;
+ }
+ //
IntSurf_TypeTrans trans1 = IntSurf_Undecided;
IntSurf_TypeTrans trans2 = IntSurf_Undecided;
Standard_Integer i = 0;
trans2 = aWLine->TransitionOnS2();
}
- Handle(IntPatch_WLine) mWLine = new IntPatch_WLine(theLineOn2S, Standard_False, trans1, trans2);
+ mWLine = new IntPatch_WLine(theLineOn2S, Standard_False, trans1, trans2);
Standard_Integer NbPnts = mWLine->NbPnts();
IntPatch_Point aFirstVertex, aLastVertex;