diff --git a/src/Adaptor3d/Adaptor3d_TopolTool.cxx b/src/Adaptor3d/Adaptor3d_TopolTool.cxx index 3c75598654..46ec7873e9 100755 --- a/src/Adaptor3d/Adaptor3d_TopolTool.cxx +++ b/src/Adaptor3d/Adaptor3d_TopolTool.cxx @@ -765,7 +765,6 @@ Standard_Boolean Adaptor3d_TopolTool::DomainIsInfinite() { if(Precision::IsPositiveInfinite(Vsup)) return(Standard_True); return(Standard_False); } -//modified by NIZNHY-PKV Mon Apr 23 16:00:31 2001 f //======================================================================= //function : Edge //purpose : @@ -774,8 +773,6 @@ Standard_Boolean Adaptor3d_TopolTool::DomainIsInfinite() { { return NULL; } -//modified by NIZNHY-PKV Mon Apr 23 16:00:35 2001 t - //======================================================================= //function : Has3d //purpose : @@ -1211,8 +1208,52 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, myNbSamplesV = myMinPnts; aVFlg(j) = Standard_True; } - - + // + //modified by NIZNHY-PKV Fri Dec 16 10:05:01 2011f + // + Standard_Boolean bFlag; + // + // U + bFlag=(myNbSamplesU < theNUmin); + if (bFlag) { + myNbSamplesU=nbsu; + } + // + myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU); + // + for(j = 0, i = 1; i <= nbsu; ++i) { + if (bFlag) { + myUPars->SetValue(i,anUPars(i)); + } + else { + if(anUFlg(i)) { + ++j; + myUPars->SetValue(j,anUPars(i)); + } + } + } + // + // V + bFlag=(myNbSamplesV < theNVmin); + if (bFlag) { + myNbSamplesV=nbsv; + } + // + myVPars = new TColStd_HArray1OfReal(1, myNbSamplesV); + // + for(j = 0, i = 1; i <= nbsv; ++i) { + if (bFlag) { + myVPars->SetValue(i,aVPars(i)); + } + else { + if(aVFlg(i)) { + ++j; + myVPars->SetValue(j,aVPars(i)); + } + } + } + // + /* myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU); myVPars = new TColStd_HArray1OfReal(1, myNbSamplesV); @@ -1231,10 +1272,15 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, myVPars->SetValue(j,aVPars(i)); } } - + */ + //modified by NIZNHY-PKV Mon Dec 26 12:25:35 2011t } +//======================================================================= +//function : IsUniformSampling +//purpose : +//======================================================================= Standard_Boolean Adaptor3d_TopolTool::IsUniformSampling() const { GeomAbs_SurfaceType typS = myS->GetType(); diff --git a/src/IntTools/IntTools_EdgeEdge.cxx b/src/IntTools/IntTools_EdgeEdge.cxx index b4efdf0f5a..a2b22f90e2 100755 --- a/src/IntTools/IntTools_EdgeEdge.cxx +++ b/src/IntTools/IntTools_EdgeEdge.cxx @@ -3,60 +3,42 @@ // Author: Peter KURNEV // // - #include -#include +#include -#include - -#include -#include - -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include #include #include -#include -#include -#include -// -#include -#include -#include -#include -#include -#include +#include +#include + +#include +#include #include -#include + +#include + #include #include +#include + #include -#include +#include + +#include +#include +#include +#include +#include +#include +#include //======================================================================= //function : IntTools_EdgeEdge::IntTools_EdgeEdge @@ -273,7 +255,6 @@ return; } // - //modified by NIZNHY-PKV Mon Oct 31 14:52:09 2011f bIsSameCurves=IsSameCurves(); if (bIsSameCurves) { aCommonPrt.SetType(TopAbs_EDGE); @@ -283,7 +264,6 @@ 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); @@ -373,147 +353,7 @@ // myIsDone=Standard_True; } -//modified by NIZNHY-PKV Mon Oct 31 14:04:36 2011f -//======================================================================= -//function : IsSameCurves -//purpose : -//======================================================================= -Standard_Boolean IntTools_EdgeEdge::IsSameCurves() -{ - Standard_Boolean bRet; - GeomAbs_CurveType aCTFrom, aCTTo; - // - aCTFrom = myCFrom.GetType(); - aCTTo = myCTo.GetType(); - // - bRet = (aCTFrom==aCTTo); - if (!bRet) { - return bRet; - } - // - bRet=Standard_False; - // - if (aCTTo==GeomAbs_BSplineCurve) { - Standard_Boolean bIsRational, bIsPreiodic; - Standard_Integer iNbPoles, iNbKnots, iDegree; - Standard_Real dT, aEpsilon; - // - aEpsilon=Epsilon(myTminFrom); - dT=myTminFrom-myTminTo; - bRet=(fabs(dT)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 : @@ -1376,12 +1216,7 @@ Standard_Boolean IntTools_EdgeEdge::IsSameCurves() // on myCTo // -#include -#include -#include -#include -#include -#include + //======================================================================= //function : CheckTouchVertex //purpose : line/Circle refinement @@ -1783,3 +1618,313 @@ Standard_Boolean IntTools_EdgeEdge::IsSameCurves() mySeqOfCommonPrts.Append(aCommonPrt); } +//modified by NIZNHY-PKV Mon Dec 26 13:44:53 2011f +static + Standard_Boolean IsSameReal(const Standard_Real aR1, + const Standard_Real aR2); +static + Standard_Boolean IsSameXYZ(const gp_XYZ& aXYZ1, const gp_XYZ& aXYZ2); +static + Standard_Boolean IsSameDir(const gp_Dir& aDir1, const gp_Dir& aDir2); +static + Standard_Boolean IsSamePnt(const gp_Pnt& aP1, const gp_Pnt& aP2); +static + Standard_Boolean IsSameAx1(const gp_Ax1& aAx1, const gp_Ax1& aAx2); +static + Standard_Boolean IsSameAx2(const gp_Ax2& aAx21, const gp_Ax2& aAx22); +static + Standard_Boolean IsSameElips(const gp_Elips& aElips1, + const gp_Elips& aElips2); +static + Standard_Boolean IsSameBSplineCurve(const BRepAdaptor_Curve& myCFrom, + const BRepAdaptor_Curve& myCTo); + +//======================================================================= +//function : IsSameCurves +//purpose : +//======================================================================= +Standard_Boolean IntTools_EdgeEdge::IsSameCurves() +{ + Standard_Boolean bRet; + GeomAbs_CurveType aCTFrom, aCTTo; + // + aCTFrom=myCFrom.GetType(); + aCTTo =myCTo.GetType(); + // + bRet=(aCTFrom==aCTTo); + if (!bRet) { + return bRet; + } + // + bRet=IsSameReal(myTminFrom, myTminTo); + if (!bRet) { + return bRet; + } + // + bRet=IsSameReal(myTmaxFrom, myTmaxTo); + if (!bRet) { + return bRet; + } + // + bRet=!bRet; // false + // + if (aCTTo==GeomAbs_Ellipse) { + gp_Elips aC1, aC2; + // + aC1=myCFrom.Ellipse(); + aC2=myCTo.Ellipse(); + // + bRet=IsSameElips(aC1, aC2); + // + return bRet; + } //if (aCTTo==GeomAbs_Ellipse) { + // + else if (aCTTo==GeomAbs_BSplineCurve) { + bRet=IsSameBSplineCurve(myCFrom, myCTo); + if(!bRet) { + return bRet; + } + }// if (aCTTo==GeomAbs_BSplineCurve) { + return bRet; +} +//======================================================================= +//function : IsSameBSplineCurve +//purpose : +//======================================================================= +Standard_Boolean IsSameBSplineCurve(const BRepAdaptor_Curve& myCFrom, + const BRepAdaptor_Curve& myCTo) +{ + Standard_Boolean bRet, bIsRational, bIsPreiodic; + Standard_Integer iNbPoles, iNbKnots, iDegree; + // + bIsRational=myCFrom.IsRational(); + bRet=(bIsRational==myCTo.IsRational()); + if (!bRet) { + return bRet; + } + // + iNbPoles=myCFrom.NbPoles(); + bRet=(iNbPoles==myCTo.NbPoles()); + if (!bRet) { + return bRet; + } + // + iNbKnots=myCFrom.NbKnots(); + bRet=(iNbKnots==myCTo.NbKnots()); + if (!bRet) { + return bRet; + } + // + iDegree=myCFrom.Degree(); + bRet=(iDegree==myCTo.Degree()); + if (!bRet) { + return bRet; + } + // + bIsPreiodic=myCFrom.IsPeriodic(); + bRet=(bIsPreiodic==myCTo.IsPeriodic()); + if (!bRet) { + return bRet; + } + //------------------------------------------- + Standard_Integer i, j, aM[2]; + Standard_Real aT1[2], aT2[2], aX0[4], aX1[4]; + gp_Pnt aP; + Handle(Geom_Curve) aC; + Handle(Geom_BSplineCurve) aBSp[2]; + TopoDS_Edge aE[2]; + // + aE[0]=myCFrom.Edge(); + aE[1]=myCTo.Edge(); + // + aC=BRep_Tool::Curve (aE[0], aT1[0], aT2[0]); + aBSp[0]=Handle(Geom_BSplineCurve)::DownCast(aC); + // + aC=BRep_Tool::Curve (aE[1], aT1[1], aT2[1]); + aBSp[1]=Handle(Geom_BSplineCurve)::DownCast(aC); + // + bRet=IsSameReal(aT1[0], aT1[1]); + if (!bRet) { + return bRet; + } + // + bRet=IsSameReal(aT2[0], aT2[1]); + if (!bRet) { + return bRet; + } + // + // Poles / Weights + for(i=1; i<=iNbPoles; ++i) { + aP=aBSp[0]->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) { + bRet=IsSameReal(aX0[j], aX1[j]); + if(!bRet) { + return bRet; + } + } + }//for(i=1; iKnot(i); + aX0[1]=aBSp[1]->Knot(i); + bRet=IsSameReal(aX0[0], aX0[1]); + if(!bRet) { + return bRet; + } + // + aM[0]=aBSp[0]->Multiplicity(i); + aM[1]=aBSp[1]->Multiplicity(i); + bRet=(aM[0]==aM[1]); + if(!bRet) { + return bRet; + } + }// for(i=1; i<=iNbKnots; ++i) { + return bRet; +} +//======================================================================= +//function : IsSameElips +//purpose : +//======================================================================= +Standard_Boolean IsSameElips(const gp_Elips& aElips1, + const gp_Elips& aElips2) +{ + Standard_Boolean bRet; + Standard_Real aR1, aR2; + // + aR1=aElips1.MajorRadius(); + aR2=aElips2.MajorRadius(); + bRet=IsSameReal(aR1, aR2); + if (!bRet) { + return bRet; + } + // + aR1=aElips1.MinorRadius(); + aR2=aElips2.MinorRadius(); + bRet=IsSameReal(aR1, aR2); + if (!bRet) { + return bRet; + } + // + const gp_Ax2& aAx21=aElips1.Position(); + const gp_Ax2& aAx22=aElips2.Position(); + bRet=IsSameAx2(aAx21, aAx22); + return bRet; +} +//======================================================================= +//function : IsSameAx2 +//purpose : +//======================================================================= +Standard_Boolean IsSameAx2(const gp_Ax2& aAx21, const gp_Ax2& aAx22) +{ + Standard_Boolean bRet; + // + const gp_Ax1& aAx1=aAx21.Axis(); + const gp_Ax1& aAx2=aAx22.Axis(); + // + bRet=IsSameAx1(aAx1, aAx2); + if (!bRet) { + return bRet; + } + // + const gp_Dir& aDirX1=aAx21.XDirection(); + const gp_Dir& aDirX2=aAx22.XDirection(); + // + bRet=IsSameDir(aDirX1, aDirX2); + if (!bRet) { + return bRet; + } + // + // + const gp_Dir& aDirY1=aAx21.YDirection(); + const gp_Dir& aDirY2=aAx22.YDirection(); + // + bRet=IsSameDir(aDirY1, aDirY2); + // + return bRet; +} +//======================================================================= +//function : IsSameAx1 +//purpose : +//======================================================================= +Standard_Boolean IsSameAx1(const gp_Ax1& aAx1, const gp_Ax1& aAx2) +{ + Standard_Boolean bRet; + // + const gp_Pnt& aP1=aAx1.Location(); + const gp_Pnt& aP2=aAx2.Location(); + // + bRet=IsSamePnt(aP1, aP2); + if (!bRet) { + return bRet; + } + // + const gp_Dir& aDir1=aAx1.Direction(); + const gp_Dir& aDir2=aAx2.Direction(); + // + bRet=IsSameDir(aDir1, aDir2); + return bRet; +} +//======================================================================= +//function : IsSamePnt +//purpose : +//======================================================================= +Standard_Boolean IsSamePnt(const gp_Pnt& aP1, const gp_Pnt& aP2) +{ + const gp_XYZ& aXYZ1=aP1.XYZ(); + const gp_XYZ& aXYZ2=aP2.XYZ(); + return IsSameXYZ(aXYZ1, aXYZ2); +} +//======================================================================= +//function : IsSameDir +//purpose : +//======================================================================= +Standard_Boolean IsSameDir(const gp_Dir& aDir1, const gp_Dir& aDir2) +{ + const gp_XYZ& aXYZ1=aDir1.XYZ(); + const gp_XYZ& aXYZ2=aDir2.XYZ(); + return IsSameXYZ(aXYZ1, aXYZ2); +} +//======================================================================= +//function : IsSameXYZ +//purpose : +//======================================================================= +Standard_Boolean IsSameXYZ(const gp_XYZ& aXYZ1, const gp_XYZ& aXYZ2) +{ + Standard_Boolean bRet; + Standard_Integer i; + Standard_Real aX1[3], aX2[3]; + + aXYZ1.Coord(aX1[0], aX1[1], aX1[2]); + aXYZ2.Coord(aX2[0], aX2[1], aX2[2]); + // + for (i=0; i<3; ++i) { + bRet=IsSameReal(aX1[i], aX2[i]); + if(!bRet) { + break; + } + } + return bRet; +} +//======================================================================= +//function : IsSameReal +//purpose : +//======================================================================= +Standard_Boolean IsSameReal(const Standard_Real aR1, + const Standard_Real aR2) +{ + Standard_Boolean bRet; + Standard_Real aEpsilon; + // + aEpsilon=Epsilon(aR1); + bRet=(fabs(aR1-aR2) #include - -//modified by NIZNHY-PKV Fri Nov 25 12:03:55 2011f +//modified by NIZNHY-PKV Mon Dec 26 13:37:52 2011f +static + void RefineVector(gp_Vec2d& aV2D); +//modified by NIZNHY-PKV Mon Dec 26 13:37:54 2011t static void DumpWLine(const Handle(IntPatch_WLine)& aWLine); -//modified by NIZNHY-PKV Fri Nov 25 12:03:58 2011t // static void TolR3d(const TopoDS_Face& , @@ -2710,7 +2711,6 @@ Standard_Boolean IsDegeneratedZone(const gp_Pnt2d& aP2d, //========================================================================= Handle(IntPatch_WLine) ComputePurgedWLine(const Handle(IntPatch_WLine)& theWLine) { - //modified by NIZNHY-PKV Tue Nov 29 12:14:07 2011f Standard_Integer i, k, v, nb, nbvtx; Handle(IntPatch_WLine) aResult; nbvtx = theWLine->NbVertex(); @@ -2727,7 +2727,6 @@ Handle(IntPatch_WLine) ComputePurgedWLine(const Handle(IntPatch_WLine)& theWLine Handle(IntPatch_WLine) aTmpWLine = theWLine; Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S(); aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False); - //modified by NIZNHY-PKV Tue Nov 29 12:13:19 2011t for(i = 1; i <= nb; i++) { aLineOn2S->Add(theWLine->Point(i)); } @@ -2742,10 +2741,7 @@ Handle(IntPatch_WLine) ComputePurgedWLine(const Handle(IntPatch_WLine)& theWLine nb = aLineOn2S->NbPoints(); anEndIndex = (anEndIndex > nb) ? nb : anEndIndex; - //modified by NIZNHY-PKV Fri Nov 25 13:02:40 2011f if((aStartIndex > nb) || (anEndIndex <= 1)) { - //if((aStartIndex >= nb) || (anEndIndex <= 1)) { - //modified by NIZNHY-PKV Fri Nov 25 13:02:47 2011t continue; } k = aStartIndex; @@ -2901,6 +2897,9 @@ Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint, } gp_Vec2d anormvec = aVec; anormvec.Normalize(); + //modified by NIZNHY-PKV Mon Dec 19 11:46:06 2011f + RefineVector(anormvec); + //modified by NIZNHY-PKV Mon Dec 19 11:46:10 2011t Standard_Real adot1 = anormvec.Dot(anOtherVecNormal); if(fabs(adot1) < Precision::Angular()) @@ -4536,8 +4535,6 @@ Standard_Integer IndexType(const GeomAbs_SurfaceType aType) } return aIndex; } - -//modified by NIZNHY-PKV Fri Nov 25 11:58:12 2011f //======================================================================= //function : DumpWLine //purpose : @@ -4559,4 +4556,36 @@ void DumpWLine(const Handle(IntPatch_WLine)& aWLine) i, aX, aY, aZ, aU1, aV1, aU2, aV2); } } -//modified by NIZNHY-PKV Fri Nov 25 11:58:19 2011t +//modified by NIZNHY-PKV Wed Dec 14 12:22:48 2011f +//======================================================================= +//function : RefineVector +//purpose : +//======================================================================= +void RefineVector(gp_Vec2d& aV2D) +{ + Standard_Integer k,m; + Standard_Real aC[2], aEps, aR1, aR2, aNum; + // + aEps=RealEpsilon(); + aR1=1.-aEps; + aR2=1.+aEps; + // + aV2D.Coord(aC[0], aC[1]); + // + for (k=0; k<2; ++k) { + m=(k+1)%2; + aNum=fabs(aC[k]); + if (aNum>aR1 && aNum