From f793011ee61ea62242341e501aa9961a73877a12 Mon Sep 17 00:00:00 2001 From: PKV <> Date: Fri, 16 Dec 2011 10:37:05 +0000 Subject: [PATCH] 0022790: Boolean opeation Fuse fails. --- src/IFSelect/IFSelect_WorkSession.cxx | 2 +- src/IntImp/IntImp_ComputeTangence.cxx | 67 +-- src/IntTools/IntTools_EdgeEdge.cdl | 225 +++++----- src/IntTools/IntTools_EdgeEdge.cxx | 615 ++++++++++---------------- 4 files changed, 386 insertions(+), 523 deletions(-) diff --git a/src/IFSelect/IFSelect_WorkSession.cxx b/src/IFSelect/IFSelect_WorkSession.cxx index 7f02ee6098..4bd6ec87a6 100755 --- a/src/IFSelect/IFSelect_WorkSession.cxx +++ b/src/IFSelect/IFSelect_WorkSession.cxx @@ -3582,7 +3582,7 @@ void IFSelect_WorkSession::PrintCheckList Interface_CheckIterator chks = checklist; Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary); - counter->Analyse (chks,themodel,Standard_False,failsonly); + counter->Analyse (chks,themodel,Standard_True,failsonly); counter->PrintList (sout,themodel,mode); } } diff --git a/src/IntImp/IntImp_ComputeTangence.cxx b/src/IntImp/IntImp_ComputeTangence.cxx index 85859a004f..0d634cf726 100755 --- a/src/IntImp/IntImp_ComputeTangence.cxx +++ b/src/IntImp/IntImp_ComputeTangence.cxx @@ -13,8 +13,10 @@ Standard_EXPORT const IntImp_ConstIsoparametric *ChoixRef = staticChoixRef ; #include -//Standard_EXPORT IntImp_ConstIsoparametric *ChoixRef = staticChoixRef ; - +//======================================================================= +//function : IntImp_ComputeTangence +//purpose : +//======================================================================= Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[], const Standard_Real EpsUV[], Standard_Real Tgduv[], @@ -49,40 +51,45 @@ Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[], // l intersection { - Standard_Real NormDuv[4]; -// Standard_Real Tampon; -// Standard_Integer Irang[4],i,j; + Standard_Real NormDuv[4], aM2, aTol2; Standard_Integer i; - - - NormDuv[0] = DPuv[0].Magnitude(); - if(NormDuv[0]<=1e-16) { - return(Standard_True); - } - NormDuv[1] = DPuv[1].Magnitude(); - if(NormDuv[1]<=1e-16) { - return(Standard_True); - } - NormDuv[2] = DPuv[2].Magnitude(); - if(NormDuv[2]<=1e-16) { - return(Standard_True); - } - NormDuv[3] = DPuv[3].Magnitude(); - if(NormDuv[3]<=1e-16) { - return(Standard_True); - } - - - + // + aTol2=1.e-32; + // + for (i=0; i<4; ++i) { + NormDuv[i] = DPuv[i].SquareMagnitude(); + if(NormDuv[i]<=aTol2) { + return Standard_True; + } + } + // + //------------------------------------------------- gp_Vec N1 = DPuv[0]; N1.Cross(DPuv[1]); - + // + //modified by NIZNHY-PKV Tue Nov 01 08:37:32 2011f + aM2=N1.SquareMagnitude(); + if (aM2 #include #include +#include //======================================================================= //function : IntTools_EdgeEdge::IntTools_EdgeEdge @@ -239,23 +240,29 @@ //======================================================================= void IntTools_EdgeEdge::Perform() { - Standard_Integer i, pri; + Standard_Boolean bIsSameCurves; + Standard_Integer i, pri, aNbCommonPrts, aNbRange; + Standard_Real aT1, aT2, aPC; IntTools_CommonPrt aCommonPrt; - GeomAbs_CurveType aCTFrom, aCTTo; - + GeomAbs_CurveType aCTFrom, aCTTo; + // + myIsDone=Standard_False; myErrorStatus=0; + // CheckData(); if (myErrorStatus) return; // - // ProjectableRanges, etc Prepare(); + if (myErrorStatus) { return; } // - - if(myCFrom.GetType() == GeomAbs_Line && myCTo.GetType() == GeomAbs_Line) { + aCTFrom = myCFrom.GetType(); + aCTTo = myCTo.GetType(); + // + if(aCTFrom==GeomAbs_Line && aCTTo==GeomAbs_Line) { ComputeLineLine(); if (myOrder) { TopoDS_Edge aTmp; @@ -265,66 +272,87 @@ } return; } - + // + //modified by NIZNHY-PKV Mon Oct 31 14:52:09 2011f + bIsSameCurves=IsSameCurves(); + if (bIsSameCurves) { + aCommonPrt.SetType(TopAbs_EDGE); + aCommonPrt.SetRange1 (myTminFrom, myTmaxFrom); + aCommonPrt.AppendRange2 (myTminTo, myTmaxTo); + mySeqOfCommonPrts.Append(aCommonPrt); + myIsDone=Standard_True; + return; + } + //modified by NIZNHY-PKV Mon Oct 31 14:52:11 2011t + // IntTools_BeanBeanIntersector anIntersector(myCFrom, myCTo, myTolFrom, myTolTo); anIntersector.SetBeanParameters(Standard_True, myTminFrom, myTmaxFrom); anIntersector.SetBeanParameters(Standard_False, myTminTo, myTmaxTo); + // anIntersector.Perform(); - if(!anIntersector.IsDone()) { myIsDone = Standard_False; return; } - aCTFrom = myCFrom.GetType(); - aCTTo = myCTo.GetType(); - + // + aPC=Precision::PConfusion(); aCommonPrt.SetEdge1(myCFrom.Edge()); aCommonPrt.SetEdge2(myCTo.Edge()); - - for(Standard_Integer r = 1; r <= anIntersector.Result().Length(); r++) { - const IntTools_Range& aRange = anIntersector.Result().Value(r); - - if(IsProjectable(IntTools_Tools::IntermediatePoint(aRange.First(), aRange.Last()))) { - aCommonPrt.SetRange1(aRange.First(), aRange.Last()); - - if(((aRange.First() - myTminFrom) < Precision::PConfusion()) && - ((myTmaxFrom - aRange.Last()) < Precision::PConfusion())) { + // + const IntTools_SequenceOfRanges& aSR=anIntersector.Result(); + aNbRange=aSR.Length(); + for(i=1; i <=aNbRange; ++i) { + const IntTools_Range& aRange =aSR.Value(i); + aT1=aRange.First(); + aT2=aRange.Last(); + // + if(IsProjectable(IntTools_Tools::IntermediatePoint(aT1, aT2))) { + aCommonPrt.SetRange1(aT1, aT2); + // + if(((aT1 - myTminFrom)Pole(i); + aP.Coord(aX0[0], aX0[1], aX0[2]); + aX0[3]=aBSp[0]->Weight(i); + // + aP=aBSp[1]->Pole(i); + aP.Coord(aX1[0], aX1[1], aX1[2]); + aX1[3]=aBSp[1]->Weight(i); + // + for (j=0; j<4; ++j) { + aEpsilon=Epsilon(aX0[j]); + dT=aX0[j]-aX1[j]; + bRet=(fabs(dT)Knot(i); + aX0[1]=aBSp[1]->Knot(i); + aEpsilon=Epsilon(aX0[0]); + dT=aX0[0]-aX0[1]; + bRet=(fabs(dT)Multiplicity(i); + aM[1]=aBSp[1]->Multiplicity(i); + bRet=(aM[0]==aM[1]); + if(!bRet) { + return bRet; + } + }//for(i=1; i<=iNbKnots; ++i) { + }// if (aCTTo==GeomAbs_BSplineCurve) { + return bRet; +} +//modified by NIZNHY-PKV Mon Oct 31 14:04:40 2011t //======================================================================= //function : CheckData //purpose : @@ -383,29 +539,24 @@ //======================================================================= void IntTools_EdgeEdge::Prepare() { - Standard_Real aLE1, aLE2; - + Standard_Real aLE1, aLE2, aT1, aT2, aTol1, aTol2; + GeomAdaptor_Curve aGAC; + GeomAbs_CurveType aCT1, aCT2; // // 1.Prepare Curves' data - aLE1 = 0.; - - if (!BRep_Tool::Degenerated(myEdge1) && - BRep_Tool::IsGeometric(myEdge1)) { - Standard_Real f, l; - const Handle(Geom_Curve)& aCurve =BRep_Tool::Curve (myEdge1, f, l); - GeomAdaptor_Curve aGACurve (aCurve, myRange1.First(), myRange1.Last()); - aLE1 = CPnts_AbscissaPoint::Length(aGACurve, myRange1.First(), myRange1.Last()); - } - aLE2 = 0.; - - if (!BRep_Tool::Degenerated(myEdge2) && - BRep_Tool::IsGeometric(myEdge2)) { - Standard_Real f, l; - const Handle(Geom_Curve)& aCurve =BRep_Tool::Curve (myEdge2, f, l); - GeomAdaptor_Curve aGACurve (aCurve, myRange2.First(), myRange2.Last()); - aLE2 = CPnts_AbscissaPoint::Length(aGACurve, myRange2.First(), myRange2.Last()); - } - + const Handle(Geom_Curve)& aC1=BRep_Tool::Curve (myEdge1, aT1, aT2); + aT1=myRange1.First(); + aT2=myRange1.Last(); + aGAC.Load(aC1, myRange1.First(), myRange1.Last()); + aLE1=CPnts_AbscissaPoint::Length(aGAC, aT1, aT2); + // + const Handle(Geom_Curve)& aC2=BRep_Tool::Curve (myEdge2, aT1, aT2); + aT1=myRange2.First(); + aT2=myRange2.Last(); + aGAC.Load(aC2, aT1, aT2); + aLE2=CPnts_AbscissaPoint::Length(aGAC, aT1, aT2); + // + myOrder=Standard_False; if (aLE1 <= aLE2) { myCFrom.Initialize(myEdge1); myCTo .Initialize(myEdge2); @@ -425,82 +576,24 @@ myTmaxFrom=myRange2.Last (); myTminTo =myRange1.First(); myTmaxTo =myRange1.Last (); - + // myOrder=Standard_True; // revesed order } // // 2.Prepare myCriteria - GeomAbs_CurveType aCT1, aCT2; aCT1=myCFrom.GetType(); - aCT2=myCTo.GetType() ; - - Standard_Real aTol1, aTol2; - aTol1=(aCT1==GeomAbs_BSplineCurve|| - aCT1==GeomAbs_BezierCurve) ? 1.20*myTol1 : myTol1; - - aTol2=(aCT2==GeomAbs_BSplineCurve|| - aCT2==GeomAbs_BezierCurve) ? 1.20*myTol2 : myTol2; - + aCT2=myCTo.GetType(); + // + aTol1=myTol1; + if(aCT1==GeomAbs_BSplineCurve|| aCT1==GeomAbs_BezierCurve){ + aTol1=1.2*myTol1; + } + aTol2=myTol2; + if(aCT2==GeomAbs_BSplineCurve|| aCT2==GeomAbs_BezierCurve){ + aTol2=1.2*myTol2; + } myCriteria=aTol1+aTol2; } - -//======================================================================= -//function : FindProjectableRoot -//purpose : -//======================================================================= - void IntTools_EdgeEdge::FindProjectableRoot (const Standard_Real tt1, - const Standard_Real tt2, - const Standard_Integer ff1, - const Standard_Integer ff2, - Standard_Real& tRoot) -{ - Standard_Real tm, t1, t2; - Standard_Integer anIsProj1, anIsProj2, anIsProjm; - // - // Root can be on the ends of [tt1, tt2] - Standard_Integer anOldErrorStatus=myErrorStatus; - - t1=DistanceFunction(tt1); - myErrorStatus=anOldErrorStatus; - if (fabs(t1)myEpsNull) { - return bFlag; - } - } - return !bFlag; -} - -//======================================================================= -//function : RemoveIdenticalRoots -//purpose : -//======================================================================= - void IntTools_EdgeEdge::RemoveIdenticalRoots() -{ - Standard_Integer aNbRoots, j, k; - - aNbRoots=mySequenceOfRoots.Length(); - for (j=1; j<=aNbRoots; j++) { - const IntTools_Root& aRj=mySequenceOfRoots(j); - for (k=j+1; k<=aNbRoots; k++) { - const IntTools_Root& aRk=mySequenceOfRoots(k); - - Standard_Real aTj, aTk, aDistance; - gp_Pnt aPj, aPk; - - aTj=aRj.Root(); - aTk=aRk.Root(); - - myCFrom.D0(aTj, aPj); - myCFrom.D0(aTk, aPk); - - aDistance=aPj.Distance(aPk); - if (aDistance < myCriteria) { - mySequenceOfRoots.Remove(k); - aNbRoots=mySequenceOfRoots.Length(); - } - } - } -} //======================================================================= //function : ComputeLineLine @@ -1733,7 +1732,6 @@ return; } // - //modified by NIZNHY-PKV Tue Mar 29 08:29:14 2011f { TopoDS_Iterator aIt1, aIt2; // @@ -1750,7 +1748,6 @@ } } } - //modified by NIZNHY-PKV Tue Mar 29 08:29:16 2011t // Standard_Real aSin2 = 1. - aCos*aCos; gp_Pnt O1 = C1.Location(); @@ -1786,137 +1783,3 @@ mySeqOfCommonPrts.Append(aCommonPrt); } -/* -//======================================================================= -//function : CheckTouchVertex -//purpose : -//======================================================================= - Standard_Boolean IntTools_EdgeEdge::CheckTouchVertex (const IntTools_CommonPrt& aCP, - Standard_Real& aTx1, - Standard_Real& aTx2) const -{ - Standard_Real aTF1, aTL1, aTF2, aTL2, Tol, af, al, aDist, aDistNew; - Standard_Real aTFR1, aTLR1, aTFR2, aTLR2; - Standard_Boolean theflag=Standard_False; - Standard_Integer iNb, aNbExt, i; - - aCP.Range1(aTFR1, aTLR1); - (aCP.Ranges2())(1).Range(aTFR2, aTLR2); - - Tol = Precision::PConfusion(); - - GeomAbs_CurveType aTFrom, aTTo; - - aTFrom=myCFrom.GetType(); - aTTo =myCTo.GetType(); - gp_Circ aCirc; - gp_Lin aLine; - - if (aTFrom==GeomAbs_Circle) { - aCirc=myCFrom.Circle(); - aLine=myCTo.Line(); - } - else { - aCirc=myCTo.Circle(); - aLine=myCFrom.Line(); - } - - Standard_Real aRadius; - gp_Pnt aPCenter; - aPCenter=aCirc.Location(); - aRadius =aCirc.Radius(); - - aDist=aLine.Distance(aPCenter); - aDist=fabs (aDist-aRadius); - if (aDist > Tol) { - return theflag; - } - // - aTF1=myTminFrom; - aTL1=myTmaxFrom; - aTF2=myTminTo; - aTL2=myTmaxTo; - - const Handle(Geom_Curve)& Curve1 =BRep_Tool::Curve (myCFrom.Edge(), af, al); - const Handle(Geom_Curve)& Curve2 =BRep_Tool::Curve (myCTo.Edge() , af, al); - - GeomAdaptor_Curve TheCurve1 (Curve1, aTF1, aTL1); - GeomAdaptor_Curve TheCurve2 (Curve2, aTF2, aTL2); - - Extrema_ExtCC anExtrema (TheCurve1, - TheCurve2, - aTF1-Tol, - aTL1+Tol, - aTF2-Tol, - aTL2+Tol, - Tol, Tol); - - if(!anExtrema.IsDone()) { - return theflag; - } - if (anExtrema.IsParallel()) { - return theflag; - } - - aNbExt=anExtrema.NbExt() ; - if (!aNbExt) { - return theflag; - } - // - iNb=0; - Standard_Real aTx1Av=0., aTx2Av=0.; - - gp_Pnt aPC1, aPC2; - - for (i=1; i<=aNbExt; ++i) { - Extrema_POnCurv aPOnC1, aPOnC2; - anExtrema.Points(i, aPOnC1, aPOnC2); - - aTx1=aPOnC1.Parameter(); - aTx2=aPOnC2.Parameter(); - if (fabs (aTx1-aTFR1) < 1.e-4 && fabs (aTx2-aTFR2) < 1.e-4) { - aTx1Av=aTx1Av+aTx1; - aTx2Av=aTx2Av+aTx2; - iNb++; - } - } - - if (!iNb) { - return theflag; - } - - aTx1=aTx1Av/iNb; - aTx2=aTx2Av/iNb; - - Curve1->D0(aTx1, aPC1); - Curve2->D0(aTx2, aPC2); - // - aDistNew=aPC1.Distance(aPC2); - if (aDistNew > aDist) { - aTx1=0.5*(aTFR1+aTLR1); - aTx2=0.5*(aTFR2+aTLR2); - return !theflag; - } - // - - aDist=aDistNew; - if (aDist > myCriteria) { - return theflag; - } - - if (fabs (aTx1-aTF1) < Tol) { - return !theflag; - } - - if (fabs (aTx1-aTL1) < Tol) { - return !theflag; - } - - if (aTx1 > (aTF1-Tol) && aTx1 < (aTL1+Tol) ) { - return !theflag; - } - - return theflag; -} - -*/