diff --git a/src/BOPTools/BOPTools_AlgoTools3D.cxx b/src/BOPTools/BOPTools_AlgoTools3D.cxx index 5dceb7d945..81b3ad4775 100644 --- a/src/BOPTools/BOPTools_AlgoTools3D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools3D.cxx @@ -742,7 +742,7 @@ Standard_Integer BOPTools_AlgoTools3D::PointInFace Handle(IntTools_Context)& theContext) { Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint; - Standard_Integer iErr, aIx, aNbDomains; + Standard_Integer iErr, aIx = 0, aNbDomains = 0; Standard_Real aUMin, aUMax, aVMin, aVMax; Standard_Real aVx = 0., aUx, aV1, aV2; gp_Dir2d aD2D (0., 1.); @@ -764,24 +764,36 @@ Standard_Integer BOPTools_AlgoTools3D::PointInFace BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax); // aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax); - aP2D.SetCoord(aUx, 0.); - aL2D=new Geom2d_Line (aP2D, aD2D); - Geom2dAdaptor_Curve aHCur(aL2D); - // - aIx=aHatcher.AddHatching(aHCur) ; - // - aHatcher.Trim(); - bIsDone=aHatcher.TrimDone(aIx); - if (!bIsDone) { - iErr=1; - return iErr; - } - // - aHatcher.ComputeDomains(aIx); - bIsDone=aHatcher.IsDone(aIx); - if (!bIsDone) { - iErr=2; - return iErr; + Standard_Integer i; + for(i = 1; i <= 2; ++i) + { + aP2D.SetCoord(aUx, 0.); + aL2D=new Geom2d_Line (aP2D, aD2D); + Geom2dAdaptor_Curve aHCur(aL2D); + // + aIx=aHatcher.AddHatching(aHCur) ; + // + aHatcher.Trim(aIx); + bIsDone=aHatcher.TrimDone(aIx); + if (!bIsDone) { + iErr=1; + return iErr; + } + // + if(aHatcher.NbPoints(aIx) > 1) + { + aHatcher.ComputeDomains(aIx); + bIsDone=aHatcher.IsDone(aIx); + if (!bIsDone) { + iErr=2; + return iErr; + } + break; + } + else + { + aUx = aUMax - (aUx - aUMin); + } } // aNbDomains=aHatcher.NbDomains(aIx); diff --git a/src/BRepFill/BRepFill_OffsetWire.cxx b/src/BRepFill/BRepFill_OffsetWire.cxx index 3b34558b02..32d9920f2f 100644 --- a/src/BRepFill/BRepFill_OffsetWire.cxx +++ b/src/BRepFill/BRepFill_OffsetWire.cxx @@ -100,7 +100,8 @@ #include #include #include - +#ifdef OCCT_DEBUG +//#define DRAW #ifdef DRAW #include #include @@ -114,51 +115,52 @@ static Standard_Integer NbOFFSET = 0; static Standard_Integer NbEDGES = 0; static Standard_Integer NbBISSEC = 0; #endif +#endif // Modified by Sergey KHROMOV - Thu Nov 16 17:24:39 2000 Begin static void QuasiFleche(const Adaptor3d_Curve& C, - const Standard_Real Deflection2, - const Standard_Real Udeb, - const gp_Pnt& Pdeb, - const gp_Vec& Vdeb, - const Standard_Real Ufin, - const gp_Pnt& Pfin, - const gp_Vec& Vfin, - const Standard_Integer Nbmin, - const Standard_Real Eps, - TColStd_SequenceOfReal& Parameters, - TColgp_SequenceOfPnt& Points); + const Standard_Real Deflection2, + const Standard_Real Udeb, + const gp_Pnt& Pdeb, + const gp_Vec& Vdeb, + const Standard_Real Ufin, + const gp_Pnt& Pfin, + const gp_Vec& Vfin, + const Standard_Integer Nbmin, + const Standard_Real Eps, + TColStd_SequenceOfReal& Parameters, + TColgp_SequenceOfPnt& Points); static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters, - TColgp_SequenceOfPnt& Points, - const Adaptor3d_Curve& C, - const Standard_Real Deflection, - const Standard_Real U1, - const Standard_Real U2, - const Standard_Real EPSILON, - const Standard_Integer Nbmin); + TColgp_SequenceOfPnt& Points, + const Adaptor3d_Curve& C, + const Standard_Real Deflection, + const Standard_Real U1, + const Standard_Real U2, + const Standard_Real EPSILON, + const Standard_Integer Nbmin); static void CheckBadEdges(const TopoDS_Face& Spine, const Standard_Real Offset, - const BRepMAT2d_BisectingLocus& Locus, - const BRepMAT2d_LinkTopoBilo& Link, - TopTools_ListOfShape& BadEdges); + const BRepMAT2d_BisectingLocus& Locus, + const BRepMAT2d_LinkTopoBilo& Link, + TopTools_ListOfShape& BadEdges); static Standard_Integer CutEdge (const TopoDS_Edge& E, - const TopoDS_Face& F, - Standard_Integer ForceCut, - TopTools_ListOfShape& Cuts); + const TopoDS_Face& F, + Standard_Integer ForceCut, + TopTools_ListOfShape& Cuts); static void CutCurve (const Handle(Geom2d_TrimmedCurve)& C, - const Standard_Integer nbParts, - TColGeom2d_SequenceOfCurve& theCurves); + const Standard_Integer nbParts, + TColGeom2d_SequenceOfCurve& theCurves); // Modified by Sergey KHROMOV - Thu Nov 16 17:24:47 2000 End static void EdgeVertices (const TopoDS_Edge& E, - TopoDS_Vertex& V1, - TopoDS_Vertex& V2) + TopoDS_Vertex& V1, + TopoDS_Vertex& V2) { if (E.Orientation() == TopAbs_REVERSED) { TopExp::Vertices(E,V2,V1); @@ -167,22 +169,21 @@ static void EdgeVertices (const TopoDS_Edge& E, TopExp::Vertices(E,V1,V2); } } - static Standard_Boolean VertexFromNode -(const Handle(MAT_Node)& aNode, - const Standard_Real Offset, - gp_Pnt2d& PN, - BRepFill_DataMapOfNodeShape& MapNodeVertex, - TopoDS_Vertex& VN); + (const Handle(MAT_Node)& aNode, + const Standard_Real Offset, + gp_Pnt2d& PN, + BRepFill_DataMapOfNodeShape& MapNodeVertex, + TopoDS_Vertex& VN); static void StoreInMap (const TopoDS_Shape& V1, - const TopoDS_Shape& V2, - TopTools_IndexedDataMapOfShapeShape& MapVV); + const TopoDS_Shape& V2, + TopTools_IndexedDataMapOfShapeShape& MapVV); static void TrimEdge (const TopoDS_Edge& CurrentEdge, const TopoDS_Shape& CurrentSpine, const TopoDS_Face& AllSpine, - const TopTools_ListOfShape& D, + const TopTools_ListOfShape& D, TopTools_SequenceOfShape& Sv, TColStd_SequenceOfReal& MapverPar, TopTools_SequenceOfShape& S, @@ -195,28 +196,28 @@ static Standard_Boolean IsInnerEdge(const TopoDS_Shape& ProE, Standard_Real& TrPar2); static Standard_Boolean DoubleOrNotInside (const TopTools_ListOfShape& EC, - const TopoDS_Vertex& V); + const TopoDS_Vertex& V); static Standard_Boolean IsSmallClosedEdge(const TopoDS_Edge& anEdge, - const TopoDS_Vertex& aVertex); + const TopoDS_Vertex& aVertex); static void MakeCircle -(const TopoDS_Edge& E, - const TopoDS_Vertex& V, - const TopoDS_Face& F, - const Standard_Real Offset, - BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, - const Handle(Geom_Plane)& RefPlane); + (const TopoDS_Edge& E, + const TopoDS_Vertex& V, + const TopoDS_Face& F, + const Standard_Real Offset, + BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, + const Handle(Geom_Plane)& RefPlane); static void MakeOffset -(const TopoDS_Edge& E, - const TopoDS_Face& F, - const Standard_Real Offset, - BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, - const Handle(Geom_Plane)& RefPlane, - const Standard_Boolean IsOpenResult, + (const TopoDS_Edge& E, + const TopoDS_Face& F, + const Standard_Real Offset, + BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, + const Handle(Geom_Plane)& RefPlane, + const Standard_Boolean IsOpenResult, const GeomAbs_JoinType theJoinType, - const TopoDS_Vertex * Ends); + const TopoDS_Vertex * Ends); //======================================================================= //function : KPartCircle @@ -224,13 +225,13 @@ static void MakeOffset //======================================================================= static Standard_Boolean KPartCircle -(const TopoDS_Face& mySpine, - const Standard_Real myOffset, - const Standard_Boolean IsOpenResult, - const Standard_Real Alt, - TopoDS_Shape& myShape, - BRepFill_IndexedDataMapOfOrientedShapeListOfShape& myMap, - Standard_Boolean& myIsDone) + (const TopoDS_Face& mySpine, + const Standard_Real myOffset, + const Standard_Boolean IsOpenResult, + const Standard_Real Alt, + TopoDS_Shape& myShape, + BRepFill_IndexedDataMapOfOrientedShapeListOfShape& myMap, + Standard_Boolean& myIsDone) { // The only contour which is a closed circle TopExp_Explorer exp(mySpine,TopAbs_EDGE); @@ -276,7 +277,7 @@ static Standard_Boolean KPartCircle { myIsDone = Standard_False; return Standard_False; - } + } } else { @@ -333,8 +334,8 @@ BRepFill_OffsetWire::BRepFill_OffsetWire() //======================================================================= BRepFill_OffsetWire::BRepFill_OffsetWire(const TopoDS_Face& Spine, - const GeomAbs_JoinType Join, - const Standard_Boolean IsOpenResult) + const GeomAbs_JoinType Join, + const Standard_Boolean IsOpenResult) { Init(Spine,Join,IsOpenResult); } @@ -345,48 +346,49 @@ BRepFill_OffsetWire::BRepFill_OffsetWire(const TopoDS_Face& Spine, //======================================================================= void BRepFill_OffsetWire::Init(const TopoDS_Face& Spine, - const GeomAbs_JoinType Join, - const Standard_Boolean IsOpenResult) + const GeomAbs_JoinType Join, + const Standard_Boolean IsOpenResult) { myIsDone = Standard_False; TopoDS_Shape aLocalShape = Spine.Oriented(TopAbs_FORWARD); mySpine = TopoDS::Face(aLocalShape); -// mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); + // mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); myJoinType = Join; myIsOpenResult = IsOpenResult; + myMap.Clear(); myMapSpine.Clear(); //------------------------------------------------------------------ // cut the spine for bissectors. //------------------------------------------------------------------ -// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 Begin + // Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 Begin static BRepMAT2d_Explorer Exp; Exp.Perform(mySpine); -// TopoDS_Face anOldSpine = mySpine; + // TopoDS_Face anOldSpine = mySpine; mySpine = TopoDS::Face(Exp.ModifiedShape(mySpine)); PrepareSpine (); -// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End + // Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End TopoDS_Shape aShape; BRepFill_IndexedDataMapOfOrientedShapeListOfShape aMap; Standard_Boolean Done; if (KPartCircle(myWorkSpine,1.,myIsOpenResult,0.,aShape,aMap,Done)) return; - + //----------------------------------------------------- // Calculate the map of bissectors to the left. // and Links Topology -> base elements of the map. //----------------------------------------------------- -// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 Begin -// static BRepMAT2d_Explorer Exp; -// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End + // Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 Begin + // static BRepMAT2d_Explorer Exp; + // Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End Exp.Perform(myWorkSpine); myBilo.Compute(Exp, 1 ,MAT_Left, myJoinType, myIsOpenResult); - myLink.Perform(Exp, myBilo); + myLink.Perform(Exp,myBilo); } @@ -429,7 +431,7 @@ const TopoDS_Shape& BRepFill_OffsetWire::Shape() const //======================================================================= const TopTools_ListOfShape& BRepFill_OffsetWire::GeneratedShapes -(const TopoDS_Shape& SpineShape) + (const TopoDS_Shape& SpineShape) { if (!myCallGen) { if (!myMapSpine.IsEmpty()) { @@ -472,7 +474,7 @@ const TopTools_ListOfShape& BRepFill_OffsetWire::GeneratedShapes } myCallGen = Standard_True; } - + if (myMap.Contains(SpineShape)) { return myMap.FindFromKey(SpineShape); } @@ -499,7 +501,7 @@ GeomAbs_JoinType BRepFill_OffsetWire::JoinType() const //======================================================================= void BRepFill_OffsetWire::Perform (const Standard_Real Offset, - const Standard_Real Alt) + const Standard_Real Alt) { // Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 Begin try @@ -538,7 +540,7 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset, GeomAdaptor_Curve AC(G3d,f,l); PerformCurve(Parameters, Points, AC, aDefl, f, - l, Precision::Confusion(), 2); + l, Precision::Confusion(), 2); Standard_Integer NPnts = Points.Length(); if(NPnts > 2) @@ -603,9 +605,9 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset, TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itmap( wwmap ); for (; itmap.More(); itmap.Next()) aSubst.Substitute( itmap.Key(), itmap.Value() ); - + aSubst.Build(myWorkSpine); - + if(aSubst.IsCopied(myWorkSpine)) { myWorkSpine = TopoDS::Face(aSubst.Copy(myWorkSpine).First()); @@ -653,10 +655,10 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset, if (!myIsOpenResult) { TopExp_Explorer anExp(myShape, TopAbs_WIRE); - + for (; anExp.More(); anExp.Next()) { const TopoDS_Shape &aWire = anExp.Current(); - + if (!aWire.Closed()) { myShape.Nullify(); myIsDone = Standard_False; @@ -673,9 +675,9 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset, //======================================================================= void Compute (const TopoDS_Face& Spine, - TopoDS_Shape& aShape, - BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, - const Standard_Real Alt) + TopoDS_Shape& aShape, + BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, + const Standard_Real Alt) { BRep_Builder B; B.MakeCompound(TopoDS::Compound(aShape)); @@ -689,7 +691,7 @@ void Compute (const TopoDS_Face& Spine, const TopoDS_Wire& CurW = TopoDS::Wire(exp.Current()); TopoDS_Shape aLocalShape = CurW.Moved(L); TopoDS_Wire NewW = TopoDS::Wire(aLocalShape); -// TopoDS_Wire NewW = TopoDS::Wire(CurW.Moved(L)); + // TopoDS_Wire NewW = TopoDS::Wire(CurW.Moved(L)); B.Add(aShape,NewW); // update Map. TopoDS_Iterator it1( CurW); @@ -708,17 +710,17 @@ void Compute (const TopoDS_Face& Spine, //======================================================================= void BRepFill_OffsetWire::PerformWithBiLo -(const TopoDS_Face& Spine, - const Standard_Real Offset, - const BRepMAT2d_BisectingLocus& Locus, - BRepMAT2d_LinkTopoBilo& Link, - const GeomAbs_JoinType Join, - const Standard_Real Alt) + (const TopoDS_Face& Spine, + const Standard_Real Offset, + const BRepMAT2d_BisectingLocus& Locus, + BRepMAT2d_LinkTopoBilo& Link, + const GeomAbs_JoinType Join, + const Standard_Real Alt) { myIsDone = Standard_False; TopoDS_Shape aLocalShape = Spine.Oriented(TopAbs_FORWARD); myWorkSpine = TopoDS::Face(aLocalShape); -// myWorkSpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); + // myWorkSpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); myJoinType = Join; myOffset = Offset ; myShape.Nullify(); @@ -727,8 +729,8 @@ void BRepFill_OffsetWire::PerformWithBiLo if (mySpine.IsNull()) { TopoDS_Shape aLocalShape = Spine.Oriented(TopAbs_FORWARD); mySpine = TopoDS::Face(aLocalShape); -// mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); -} + // mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); + } myMap.Clear(); if ( Abs(myOffset) < Precision::Confusion()) { @@ -745,7 +747,7 @@ void BRepFill_OffsetWire::PerformWithBiLo BRep_Builder myBuilder; myBuilder.MakeCompound(TopoDS::Compound(myShape)); - + //--------------------------------------------------------------------- // MapNodeVertex : associate to each node of the map (key1) and to // each element of the profile (key2) a vertex (item). @@ -785,7 +787,7 @@ void BRepFill_OffsetWire::PerformWithBiLo theWire = TopoDS::Wire(iter.Value()); TopExp::Vertices(theWire, Ends[0], Ends[1]); } - + for (Standard_Integer ic = 1; ic <= Locus.NumberOfContours(); ic++) { TopoDS_Shape PEE = Link.GeneratingShape(Locus.BasicElt(ic,Locus.NumberOfElts(ic))); TopoDS_Shape& PE = PEE ; @@ -797,19 +799,21 @@ void BRepFill_OffsetWire::PerformWithBiLo myWorkSpine,myOffset,myMap,RefPlane); } else { - MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane, + MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane, myIsOpenResult, myJoinType, Ends); - PE = SE; + PE = SE; } } } +#ifdef OCCT_DEBUG #ifdef DRAW if (AffichEdge) { cout << " End Construction of geometric primitives "<Arc(i); Bisector_Bisec Bisec = Locus.GeomBis(CurrentArc,Reverse); - +#ifdef OCCT_DEBUG #ifdef DRAW - if ( AffichGeom) { - char name[256]; - sprintf(name,"BISSEC_%d",NbBISSEC++); - DrawTrSurf::Set(name,Bisec.Value()); - } + + if ( AffichGeom) { + char name[256]; + sprintf(name,"BISSEC_%d",NbBISSEC++); + DrawTrSurf::Set(name,Bisec.Value()); + } +#endif #endif //------------------------------------------------------------------- @@ -847,7 +853,7 @@ void BRepFill_OffsetWire::PerformWithBiLo TopTools_SequenceOfShape Vertices; TColgp_SequenceOfPnt Params; - + TopTools_DataMapOfShapeSequenceOfShape MapSeqVer; BRepFill_DataMapOfShapeSequenceOfPnt MapSeqPar; @@ -876,29 +882,29 @@ void BRepFill_OffsetWire::PerformWithBiLo Node1 = CurrentArc->FirstNode(); Node2 = CurrentArc->SecondNode(); } - + Standard_Boolean StartOnEdge = 0, EndOnEdge = 0; - + if (!Node1->Infinite()) { gp_Pnt2d aLocalPnt2d = Locus.GeomElt(Node1); StartOnEdge = VertexFromNode(Node1, myOffset, aLocalPnt2d ,MapNodeVertex,VS); -// StartOnEdge = VertexFromNode(Node1, myOffset, Locus.GeomElt(Node1), -// MapNodeVertex,VS); + // StartOnEdge = VertexFromNode(Node1, myOffset, Locus.GeomElt(Node1), + // MapNodeVertex,VS); } if (!Node2->Infinite()) { gp_Pnt2d aLocalPnt2d = Locus.GeomElt(Node2) ; EndOnEdge = VertexFromNode(Node2, myOffset, aLocalPnt2d ,MapNodeVertex,VE); -// EndOnEdge = VertexFromNode(Node2, myOffset, Locus.GeomElt(Node2), -// MapNodeVertex,VE); + // EndOnEdge = VertexFromNode(Node2, myOffset, Locus.GeomElt(Node2), + // MapNodeVertex,VE); } //--------------------------------------------- // Construction of geometries. //--------------------------------------------- BRepFill_TrimEdgeTool Trim (Bisec, - Locus.GeomElt(CurrentArc->FirstElement()), - Locus.GeomElt(CurrentArc->SecondElement()), - myOffset); + Locus.GeomElt(CurrentArc->FirstElement()), + Locus.GeomElt(CurrentArc->SecondElement()), + myOffset); //----------------------------------------------------------- // Construction of vertices on edges parallel to the spine. @@ -919,21 +925,21 @@ void BRepFill_OffsetWire::PerformWithBiLo Standard_Boolean Start = 1; Trim.AddOrConfuse(Start, E[0], E[1], Params); if (Params.Length() == Vertices.Length()) - Vertices.SetValue(1,VS); + Vertices.SetValue(1,VS); else - // the point was not found by IntersectWith - Vertices.Prepend(VS); + // the point was not found by IntersectWith + Vertices.Prepend(VS); } if (EndOnEdge) { Standard_Boolean Start = 0; Trim.AddOrConfuse(Start, E[0], E[1], Params); if (Params.Length() == Vertices.Length()) - Vertices.SetValue(Params.Length(),VE); + Vertices.SetValue(Params.Length(),VE); else - // the point was not found by IntersectWith - Vertices.Append(VE); + // the point was not found by IntersectWith + Vertices.Append(VE); } //------------------------------------------------------------ @@ -949,22 +955,22 @@ void BRepFill_OffsetWire::PerformWithBiLo UpdateDetromp (Detromp, S[0], S[1], Vertices, Params, - Bisec, StartOnEdge, EndOnEdge, Trim); + Bisec, StartOnEdge, EndOnEdge, Trim); //---------------------------------------------- // Storage of vertices on parallel edges. // fill MapBis and MapVerPar. //---------------------------------------------- if (!Vertices.IsEmpty()) { for (k = 0; k <= 1; k++) { - if (!MapBis.IsBound(E[k])) { - MapBis .Bind(E[k],EmptySeq); - MapVerPar.Bind(E[k],EmptySeqOfReal); - } - for (Standard_Integer ii = 1; ii <= Vertices.Length(); ii++) { - MapBis (E[k]).Append(Vertices.Value(ii)); - if (k == 0) MapVerPar (E[k]).Append(Params.Value(ii).Y()); - else MapVerPar (E[k]).Append(Params.Value(ii).Z()); - } + if (!MapBis.IsBound(E[k])) { + MapBis .Bind(E[k],EmptySeq); + MapVerPar.Bind(E[k],EmptySeqOfReal); + } + for (Standard_Integer ii = 1; ii <= Vertices.Length(); ii++) { + MapBis (E[k]).Append(Vertices.Value(ii)); + if (k == 0) MapVerPar (E[k]).Append(Params.Value(ii).Y()); + else MapVerPar (E[k]).Append(Params.Value(ii).Z()); + } } } else { @@ -975,20 +981,22 @@ void BRepFill_OffsetWire::PerformWithBiLo // if myoffset is < distance of nodes the parallel can be valid. //------------------------------------------------------------- for (k = 0; k <= 1; k++) { - if (!MapBis.IsBound(E[k])) { - if (Node1->Distance() > myOffset && Node2->Distance() > myOffset) { - MapBis .Bind(E[k],EmptySeq); - MapVerPar.Bind(E[k],EmptySeqOfReal); - } - } + if (!MapBis.IsBound(E[k])) { + if (Node1->Distance() > myOffset && Node2->Distance() > myOffset) { + MapBis .Bind(E[k],EmptySeq); + MapVerPar.Bind(E[k],EmptySeqOfReal); + } + } } } } - + +#ifdef OCCT_DEBUG #ifdef DRAW if (AffichEdge) { cout << " End Construction of vertices on offsets"<Copy() ); - theCurve->Transform( loc.Transformation() ); - gp_Pnt f3d = theCurve->Value( f ); - gp_Pnt l3d = theCurve->Value( l ); + { + TopoDS_Edge E = TopoDS::Edge( Explo.Current() ); + TopoDS_Vertex V1, V2; + TopExp::Vertices( E, V1, V2 ); + Handle(BRep_TVertex)& TV1 = *((Handle(BRep_TVertex)*) &(V1).TShape()); + Handle(BRep_TVertex)& TV2 = *((Handle(BRep_TVertex)*) &(V2).TShape()); - Standard_Real dist1, dist2; - dist1 = f3d.Distance( TV1->Pnt() ); - dist2 = l3d.Distance( TV2->Pnt() ); - if (! MapVertex.Contains( V1 )) - { - TV1->Pnt( f3d ); - MapVertex.Add( V1 ); - } - else - TV1->UpdateTolerance( 1.5*dist1 ); - if (! MapVertex.Contains( V2 )) - { - TV2->Pnt( l3d ); - MapVertex.Add( V2 ); - } - else - TV2->UpdateTolerance( 1.5*dist2 ); + TopLoc_Location loc; + Standard_Real f, l; + Handle( Geom_Curve ) theCurve = BRep_Tool::Curve( E, loc, f, l ); + theCurve = Handle( Geom_Curve )::DownCast( theCurve->Copy() ); + theCurve->Transform( loc.Transformation() ); + gp_Pnt f3d = theCurve->Value( f ); + gp_Pnt l3d = theCurve->Value( l ); + + Standard_Real dist1, dist2; + dist1 = f3d.Distance( TV1->Pnt() ); + dist2 = l3d.Distance( TV2->Pnt() ); + if (! MapVertex.Contains( V1 )) + { + + TV1->Pnt( f3d ); + MapVertex.Add( V1 ); } + else + TV1->UpdateTolerance( 1.5*dist1 ); + if (! MapVertex.Contains( V2 )) + { + TV2->Pnt( l3d ); + MapVertex.Add( V2 ); + } + else + TV2->UpdateTolerance( 1.5*dist2 ); + } FixHoles(); @@ -1132,7 +1141,7 @@ void BRepFill_OffsetWire::PerformWithBiLo //======================================================================= BRepFill_IndexedDataMapOfOrientedShapeListOfShape& -BRepFill_OffsetWire::Generated() + BRepFill_OffsetWire::Generated() { return myMap; } @@ -1163,7 +1172,7 @@ void BRepFill_OffsetWire::PrepareSpine() TopoDS_Wire NW; B.MakeWire (NW); -// Modified by Sergey KHROMOV - Thu Nov 16 17:29:55 2000 Begin + // Modified by Sergey KHROMOV - Thu Nov 16 17:29:55 2000 Begin Standard_Integer ForcedCut = 0; Standard_Integer nbResEdges = -1; TopTools_IndexedMapOfShape EdgeMap; @@ -1173,7 +1182,7 @@ void BRepFill_OffsetWire::PrepareSpine() if (nbEdges == 1 && !myIsOpenResult) //in case of open wire there's no need to do it ForcedCut = 2; -// Modified by Sergey KHROMOV - Thu Nov 16 17:29:48 2000 End + // Modified by Sergey KHROMOV - Thu Nov 16 17:29:48 2000 End for (TopoDS_Iterator IteW(IteF.Value()); IteW.More(); IteW.Next()) { @@ -1185,44 +1194,50 @@ void BRepFill_OffsetWire::PrepareSpine() // Cut TopoDS_Shape aLocalShape = E.Oriented(TopAbs_FORWARD); -// Modified by Sergey KHROMOV - Thu Nov 16 17:29:29 2000 Begin + // Modified by Sergey KHROMOV - Thu Nov 16 17:29:29 2000 Begin if (nbEdges == 2 && nbResEdges == 0) - ForcedCut = 1; -// Modified by Sergey KHROMOV - Thu Nov 16 17:29:33 2000 End + ForcedCut = 1; + // Modified by Sergey KHROMOV - Thu Nov 16 17:29:33 2000 End nbResEdges = CutEdge (TopoDS::Edge(aLocalShape), mySpine, ForcedCut, Cuts); if (Cuts.IsEmpty()) { - B.Add(NW,E); - myMapSpine.Bind(E,E); + B.Add(NW,E); + myMapSpine.Bind(E,E); } else { - for (IteCuts.Initialize(Cuts); IteCuts.More(); IteCuts.Next()) { - TopoDS_Edge NE = TopoDS::Edge(IteCuts.Value()); - NE.Orientation(E.Orientation()); - B.Add(NW,NE); - myMapSpine.Bind(NE,E); - EdgeVertices(NE,V1,V2); - if (!myMapSpine.IsBound(V1)) myMapSpine.Bind(V1,E); - if (!myMapSpine.IsBound(V2)) myMapSpine.Bind(V2,E); - } + for (IteCuts.Initialize(Cuts); IteCuts.More(); IteCuts.Next()) { + TopoDS_Edge NE = TopoDS::Edge(IteCuts.Value()); + NE.Orientation(E.Orientation()); + B.Add(NW,NE); + myMapSpine.Bind(NE,E); + EdgeVertices(NE,V1,V2); + if (!myMapSpine.IsBound(V1)) myMapSpine.Bind(V1,E); + if (!myMapSpine.IsBound(V2)) myMapSpine.Bind(V2,E); + } } } -// Modified by Sergey KHROMOV - Thu Mar 7 09:17:41 2002 Begin + // Modified by Sergey KHROMOV - Thu Mar 7 09:17:41 2002 Begin TopoDS_Vertex aV1; TopoDS_Vertex aV2; TopExp::Vertices(NW, aV1, aV2); NW.Closed(aV1.IsSame(aV2)); -// Modified by Sergey KHROMOV - Thu Mar 7 09:17:43 2002 End + + // Modified by Sergey KHROMOV - Thu Mar 7 09:17:43 2002 End B.Add(myWorkSpine, NW); } +#ifdef OCCT_DEBUG #ifdef DRAW if ( AffichEdge) { DBRep::Set("WS",myWorkSpine); + DBRep::Set("MS",mySpine); + BRepTools::Write(myWorkSpine, "WS"); + BRepTools::Write(mySpine, "MS"); } #endif +#endif } @@ -1266,7 +1281,7 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh gp_Pnt2d P = Bis->Value((U2 + U1)*0.5); Standard_Boolean IsP_inside = Standard_True; - if (myJoinType == GeomAbs_Arc) + if ((myJoinType != GeomAbs_Intersection) || EOnE) IsP_inside = Trim.IsInside(P); if (!IsP_inside) { if (!V1.IsNull()) { @@ -1290,19 +1305,26 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh if (myJoinType == GeomAbs_Arc) IsP_inside = Trim.IsInside(P); if (!IsP_inside) { - if (!V1.IsNull()) { - Detromp(Shape1).Append(V1); - Detromp(Shape2).Append(V1); - } + if (!V1.IsNull()) { + Detromp(Shape1).Append(V1); + Detromp(Shape2).Append(V1); + } } } else { if (!V1.IsNull()) { - Detromp(Shape1).Append(V1); - Detromp(Shape2).Append(V1); + Detromp(Shape1).Append(V1); + Detromp(Shape2).Append(V1); } } } + //else if(myJoinType != GeomAbs_Arc) + //{ + // if (!V1.IsNull()) { + // Detromp(Shape1).Append(V1); + // Detromp(Shape2).Append(V1); + // } + //} } //======================================================================= @@ -1329,15 +1351,15 @@ void BRepFill_OffsetWire::MakeWires() const TopoDS_Edge& E = TopoDS::Edge(itl.Value()); TopExp::Vertices (E,V1,V2); if (V1.IsSame(V2) && IsSmallClosedEdge(E, V1)) - continue; //remove small closed edges + continue; //remove small closed edges if (!MVE.Contains(V1)) { - TopTools_ListOfShape empty; - MVE.Add(V1,empty); + TopTools_ListOfShape empty; + MVE.Add(V1,empty); } MVE.ChangeFromKey(V1).Append(E); if (!MVE.Contains(V2)) { - TopTools_ListOfShape empty; - MVE.Add(V2,empty); + TopTools_ListOfShape empty; + MVE.Add(V2,empty); } MVE.ChangeFromKey(V2).Append(E); } @@ -1348,9 +1370,10 @@ void BRepFill_OffsetWire::MakeWires() //-------------------------------------- BRep_Builder B; -// Standard_Integer NbEdges; -// Standard_Boolean NewWire = Standard_True; -// Standard_Boolean AddEdge = Standard_False; + + // Standard_Integer NbEdges; + // Standard_Boolean NewWire = Standard_True; + // Standard_Boolean AddEdge = Standard_False; TopoDS_Wire NW; Standard_Boolean End; @@ -1373,9 +1396,10 @@ void BRepFill_OffsetWire::MakeWires() End = Standard_False; MVE.ChangeFromKey(CV).RemoveFirst(); -// Modified by Sergey KHROMOV - Thu Mar 14 11:29:59 2002 Begin + // Modified by Sergey KHROMOV - Thu Mar 14 11:29:59 2002 Begin Standard_Boolean isClosed = Standard_False; -// Modified by Sergey KHROMOV - Thu Mar 14 11:30:00 2002 End + + // Modified by Sergey KHROMOV - Thu Mar 14 11:30:00 2002 End while(!End) { //------------------------------- @@ -1387,11 +1411,11 @@ void BRepFill_OffsetWire::MakeWires() B.Add (NW,CE); if (VF.IsSame(CV) || !MVE.Contains(CV)) { -// Modified by Sergey KHROMOV - Thu Mar 14 11:30:14 2002 Begin - isClosed = VF.IsSame(CV); -// Modified by Sergey KHROMOV - Thu Mar 14 11:30:15 2002 End - End = Standard_True; - //MVE.UnBind(VF); + // Modified by Sergey KHROMOV - Thu Mar 14 11:30:14 2002 Begin + isClosed = VF.IsSame(CV); + // Modified by Sergey KHROMOV - Thu Mar 14 11:30:15 2002 End + End = Standard_True; + //MVE.UnBind(VF); TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent()); TopTools_ListOfShape LastList; LastList.Append(MVE(MVE.Extent())); @@ -1401,20 +1425,20 @@ void BRepFill_OffsetWire::MakeWires() } if (!End) { - if (MVE.FindFromKey(CV).Extent() > 2) { - //cout <<"vertex on more that 2 edges in a face."< 2) { + //cout <<"vertex on more that 2 edges in a face."<Reverse(); if (CT2d->BasisCurve()->IsKind(STANDARD_TYPE(Geom2d_Circle)) && - ( Abs(f-l) >= M_PI) ) { - return 0; + ( Abs(f-l) >= M_PI) ) { + return 0; } //------------------------- @@ -1773,45 +1810,48 @@ Standard_Integer CutEdge (const TopoDS_Edge& E, //------------------------- Cuter.Perform(CT2d); -// Modified by Sergey KHROMOV - Thu Nov 16 17:28:29 2000 Begin + // Modified by Sergey KHROMOV - Thu Nov 16 17:28:29 2000 Begin if (ForceCut == 0) { if (Cuter.UnModified()) { - //----------------------------- - // edge not modified => return. - //----------------------------- + //----------------------------- + // edge not modified => return. + //----------------------------- return 0; } else { for (Standard_Integer k = 1; k <= Cuter.NbCurves(); k++) - theCurves.Append(Cuter.Value(k)); + theCurves.Append(Cuter.Value(k)); } } else if (ForceCut == 1) { if (Cuter.UnModified()) { CutCurve (CT2d, 2, theCurves); } else { for (Standard_Integer k = 1; k <= Cuter.NbCurves(); k++) - theCurves.Append(Cuter.Value(k)); + + theCurves.Append(Cuter.Value(k)); } } else if (ForceCut == 2) { if (Cuter.UnModified()) { CutCurve (CT2d, 3, theCurves); } else { if (Cuter.NbCurves() == 2) { - Handle(Geom2d_TrimmedCurve)CC = Cuter.Value(1); - if (CC->LastParameter() > (l+f)/2.) { - CutCurve (CC, 2, theCurves); - theCurves.Append(Cuter.Value(2)); - } else { - theCurves.Append(CC); - CutCurve (Cuter.Value(2), 2, theCurves); - } + Handle(Geom2d_TrimmedCurve)CC = Cuter.Value(1); + + if (CC->LastParameter() > (l+f)/2.) { + CutCurve (CC, 2, theCurves); + theCurves.Append(Cuter.Value(2)); + } else { + theCurves.Append(CC); + CutCurve (Cuter.Value(2), 2, theCurves); + } } else { - for (Standard_Integer k = 1; k <= Cuter.NbCurves(); k++) - theCurves.Append(Cuter.Value(k)); + for (Standard_Integer k = 1; k <= Cuter.NbCurves(); k++) + theCurves.Append(Cuter.Value(k)); } } } -// Modified by Sergey KHROMOV - Thu Nov 16 17:28:37 2000 End + + // Modified by Sergey KHROMOV - Thu Nov 16 17:28:37 2000 End //-------------------------------------- // Creation of cut edges. @@ -1824,16 +1864,16 @@ Standard_Integer CutEdge (const TopoDS_Edge& E, if (k == theCurves.Length()) {VL = V2;} else { -// Modified by Sergey KHROMOV - Wed Mar 6 17:38:02 2002 Begin + // Modified by Sergey KHROMOV - Wed Mar 6 17:38:02 2002 Begin gp_Pnt P = aC->Value(CC->LastParameter()); VL = BRepLib_MakeVertex(P); B.UpdateVertex(VL, aTol); -// Modified by Sergey KHROMOV - Wed Mar 6 17:38:05 2002 End + // Modified by Sergey KHROMOV - Wed Mar 6 17:38:05 2002 End } TopoDS_Shape aLocalShape = E.EmptyCopied(); TopoDS_Edge NE = TopoDS::Edge(aLocalShape); -// TopoDS_Edge NE = TopoDS::Edge(E.EmptyCopied()); + // TopoDS_Edge NE = TopoDS::Edge(E.EmptyCopied()); NE.Orientation(TopAbs_FORWARD); B.Add (NE,VF.Oriented(TopAbs_FORWARD)); B.Add (NE,VL.Oriented(TopAbs_REVERSED)); @@ -1852,8 +1892,8 @@ Standard_Integer CutEdge (const TopoDS_Edge& E, //======================================================================= void CutCurve (const Handle(Geom2d_TrimmedCurve)& C, - const Standard_Integer nbParts, - TColGeom2d_SequenceOfCurve& theCurves) + const Standard_Integer nbParts, + TColGeom2d_SequenceOfCurve& theCurves) { Handle(Geom2d_TrimmedCurve) TrimC; Standard_Real UF,UL,UC; @@ -1877,7 +1917,7 @@ void CutCurve (const Handle(Geom2d_TrimmedCurve)& C, if (UC - UF > PTol && PC.Distance(PF) > Tol) { if ( UL - UC < PTol || PL.Distance(PC) < Tol) - continue; + continue; TrimC = new Geom2d_TrimmedCurve(C,UF,UC); theCurves.Append(TrimC); @@ -1900,11 +1940,11 @@ void CutCurve (const Handle(Geom2d_TrimmedCurve)& C, //======================================================================= void MakeCircle (const TopoDS_Edge& E, - const TopoDS_Vertex& V, - const TopoDS_Face& F, - const Standard_Real Offset, - BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, - const Handle(Geom_Plane)& RefPlane) + const TopoDS_Vertex& V, + const TopoDS_Face& F, + const Standard_Real Offset, + BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, + const Handle(Geom_Plane)& RefPlane) { // evaluate the Axis of the Circle. Standard_Real f,l; @@ -1929,6 +1969,7 @@ void MakeCircle (const TopoDS_Edge& E, LL.Append(OE); Map.Add(V,LL); +#ifdef OCCT_DEBUG #ifdef DRAW if ( AffichGeom && !OE.IsNull()) { char name[256]; @@ -1936,6 +1977,7 @@ void MakeCircle (const TopoDS_Edge& E, DBRep::Set(name,OE); } #endif +#endif } //======================================================================= @@ -1944,13 +1986,13 @@ void MakeCircle (const TopoDS_Edge& E, //======================================================================= void MakeOffset (const TopoDS_Edge& E, - const TopoDS_Face& F, - const Standard_Real Offset, - BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, - const Handle(Geom_Plane)& RefPlane, - const Standard_Boolean IsOpenResult, + const TopoDS_Face& F, + const Standard_Real Offset, + BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, + const Handle(Geom_Plane)& RefPlane, + const Standard_Boolean IsOpenResult, const GeomAbs_JoinType theJoinType, - const TopoDS_Vertex * Ends) + const TopoDS_Vertex * Ends) { Standard_Real f,l; Standard_Real anOffset = Offset; @@ -1967,10 +2009,10 @@ void MakeOffset (const TopoDS_Edge& E, TopoDS_Vertex V1, V2; TopExp::Vertices(E, V1, V2); if (V1.IsSame(Ends[0]) || - V1.IsSame(Ends[1])) + V1.IsSame(Ends[1])) ToExtendFirstPar = Standard_False; if (V2.IsSame(Ends[0]) || - V2.IsSame(Ends[1])) + V2.IsSame(Ends[1])) ToExtendLastPar = Standard_False; } @@ -1988,17 +2030,17 @@ void MakeOffset (const TopoDS_Edge& E, if (anOffset*Signe < AC.Circle().Radius() - Precision::Confusion()) { Handle(Geom2dAdaptor_HCurve) AHC = - new Geom2dAdaptor_HCurve(G2d); + new Geom2dAdaptor_HCurve(G2d); Adaptor3d_OffsetCurve Off(AHC,-anOffset); Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle()); Standard_Real Delta = 2*M_PI - l + f; if (theJoinType == GeomAbs_Arc) { - if (ToExtendFirstPar) - f -= 0.2*Delta; - if (ToExtendLastPar) - l += 0.2*Delta; + if (ToExtendFirstPar) + f -= 0.2*Delta; + if (ToExtendLastPar) + l += 0.2*Delta; } else //GeomAbs_Intersection { @@ -2030,14 +2072,14 @@ void MakeOffset (const TopoDS_Edge& E, if (ToExtendFirstPar) { if (theJoinType == GeomAbs_Arc) - f -= Delta; + f -= Delta; else //GeomAbs_Intersection f = -Precision::Infinite(); } if (ToExtendLastPar) { if (theJoinType == GeomAbs_Arc) - l += Delta; + l += Delta; else //GeomAbs_Intersection l = Precision::Infinite(); } @@ -2059,15 +2101,17 @@ void MakeOffset (const TopoDS_Edge& E, LL.Append(OE); Map.Add(E,LL); +#ifdef OCCT_DEBUG #ifdef DRAW if (AffichGeom && !OE.IsNull()) { char name[256]; sprintf(name,"OFFSET_%d",++NbOFFSET); DBRep::Set(name,OE); - Standard_Real ii = 0; + //Standard_Real ii = 0; } #endif - +#endif + } } @@ -2078,10 +2122,10 @@ void MakeOffset (const TopoDS_Edge& E, //======================================================================= Standard_Boolean VertexFromNode (const Handle(MAT_Node)& aNode, - const Standard_Real Offset, - gp_Pnt2d& PN, - BRepFill_DataMapOfNodeShape& MapNodeVertex, - TopoDS_Vertex& VN) + const Standard_Real Offset, + gp_Pnt2d& PN, + BRepFill_DataMapOfNodeShape& MapNodeVertex, + TopoDS_Vertex& VN) { Standard_Boolean Status; Standard_Real Tol = Precision::Confusion(); @@ -2114,8 +2158,8 @@ Standard_Boolean VertexFromNode (const Handle(MAT_Node)& aNode, //======================================================================= void StoreInMap (const TopoDS_Shape& V1, - const TopoDS_Shape& V2, - TopTools_IndexedDataMapOfShapeShape& MapVV) + const TopoDS_Shape& V2, + TopTools_IndexedDataMapOfShapeShape& MapVV) { TopoDS_Shape OldV = V1, NewV = V2; Standard_Integer i; @@ -2159,9 +2203,9 @@ void TrimEdge (const TopoDS_Edge& E, Change = Standard_False; for (Standard_Integer i = 1; i < ThePar.Length(); i++) { if (ThePar.Value(i) > ThePar.Value(i+1)) { - ThePar.Exchange(i,i+1); - TheVer.Exchange(i,i+1); - Change = Standard_True; + ThePar.Exchange(i,i+1); + TheVer.Exchange(i,i+1); + Change = Standard_True; } } } @@ -2172,10 +2216,10 @@ void TrimEdge (const TopoDS_Edge& E, if (!BRep_Tool::Degenerated(E)) { for (Standard_Integer k = 1; k <= TheVer.Length(); k ++) { if ( DoubleOrNotInside (Detromp, - TopoDS::Vertex(TheVer.Value(k)))) { - TheVer.Remove(k); - ThePar.Remove(k); - k--; + TopoDS::Vertex(TheVer.Value(k)))) { + TheVer.Remove(k); + ThePar.Remove(k); + k--; } } } @@ -2188,27 +2232,28 @@ void TrimEdge (const TopoDS_Edge& E, if (!BRep_Tool::Degenerated(E)) { for (Standard_Integer k = 1; k < TheVer.Length(); k ++) { if (TheVer.Value(k).IsSame(TheVer.Value(k+1)) || - Abs(ThePar.Value(k)-ThePar.Value(k+1)) <= Precision::PConfusion()) { - if(k+1 == TheVer.Length()) { - StoreInMap(TheVer(k), TheVer(k+1), MapVV); - TheVer.Remove(k); - ThePar.Remove(k); - } - else { - StoreInMap(TheVer(k+1), TheVer(k), MapVV); - TheVer.Remove(k+1); - ThePar.Remove(k+1); - } - /* - if ( DoubleOrNotInside (Detromp, - TopoDS::Vertex(TheVer.Value(k)))) { - TheVer.Remove(k); - ThePar.Remove(k); - k--; - } - */ - k--; + Abs(ThePar.Value(k)-ThePar.Value(k+1)) <= Precision::PConfusion()) { + + if(k+1 == TheVer.Length()) { + StoreInMap(TheVer(k), TheVer(k+1), MapVV); + TheVer.Remove(k); + ThePar.Remove(k); + } + else { + StoreInMap(TheVer(k+1), TheVer(k), MapVV); + TheVer.Remove(k+1); + ThePar.Remove(k+1); + } + /* + if ( DoubleOrNotInside (Detromp, + TopoDS::Vertex(TheVer.Value(k)))) { + TheVer.Remove(k); + ThePar.Remove(k); + k--; + } + */ + k--; } } } @@ -2312,6 +2357,7 @@ void TrimEdge (const TopoDS_Edge& E, TheBuilder.Range(NewEdge,ThePar.Value(k),ThePar.Value(k+1)); +#ifdef OCCT_DEBUG #ifdef DRAW if ( AffichEdge) { char name[256]; @@ -2333,7 +2379,7 @@ void TrimEdge (const TopoDS_Edge& E, Draw::Set(name,dr); } #endif - +#endif S.Append(NewEdge); } } @@ -2375,7 +2421,7 @@ static Standard_Boolean IsInnerEdge(const TopoDS_Shape& ProE, //======================================================================= Standard_Boolean DoubleOrNotInside (const TopTools_ListOfShape& LV, - const TopoDS_Vertex& V) + const TopoDS_Vertex& V) { Standard_Boolean Vu = Standard_False; TopTools_ListIteratorOfListOfShape it(LV); @@ -2391,7 +2437,7 @@ Standard_Boolean DoubleOrNotInside (const TopTools_ListOfShape& LV, } Standard_Boolean IsSmallClosedEdge(const TopoDS_Edge& anEdge, - const TopoDS_Vertex& aVertex) + const TopoDS_Vertex& aVertex) { gp_Pnt PV = BRep_Tool::Pnt(aVertex); gp_Pnt2d PV2d, Pfirst, Plast, Pmid; @@ -2422,9 +2468,9 @@ Standard_Boolean IsSmallClosedEdge(const TopoDS_Edge& anEdge, } static void CheckBadEdges(const TopoDS_Face& Spine, const Standard_Real Offset, - const BRepMAT2d_BisectingLocus& Locus, - const BRepMAT2d_LinkTopoBilo& Link, - TopTools_ListOfShape& BadEdges) + const BRepMAT2d_BisectingLocus& Locus, + const BRepMAT2d_LinkTopoBilo& Link, + TopTools_ListOfShape& BadEdges) { TopoDS_Face F = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD)); @@ -2438,82 +2484,97 @@ static void CheckBadEdges(const TopoDS_Face& Spine, const Standard_Real Offset, const TopoDS_Shape& SE = Link.GeneratingShape(Locus.BasicElt(ic,ie)); if (SE.ShapeType() == TopAbs_EDGE) { - if (aMap.Contains(SE)) { - //cout << "Edge is treated second time" << endl; - continue; - } - TopoDS_Edge E = TopoDS::Edge(SE); + if (aMap.Contains(SE)) { + //cout << "Edge is treated second time" << endl; + continue; + } - Standard_Real f,l; - Handle(Geom2d_Curve) G2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopoDS_Edge E = TopoDS::Edge(SE); - Geom2dAdaptor_Curve AC(G2d,f,l); - GeomAbs_CurveType aCType = AC.GetType(); - if(aCType != GeomAbs_Line && aCType != GeomAbs_Circle) { + Standard_Real f,l; - Standard_Boolean reverse = Standard_False; - if (E.Orientation() == TopAbs_FORWARD) reverse = Standard_True; - gp_Pnt2d P, Pc; - gp_Dir2d N; + Handle(Geom2d_Curve) G2d = BRep_Tool::CurveOnSurface(E,F,f,l); - Geom2dLProp_CLProps2d aCLProps(G2d, 2, eps); - aCLProps.SetParameter(f); - if(!aCLProps.IsTangentDefined()) { - BadEdges.Append(SE); - aMap.Add(SE); - continue; - } + Geom2dAdaptor_Curve AC(G2d,f,l); + GeomAbs_CurveType aCType = AC.GetType(); - P = aCLProps.Value(); - Standard_Real Crv = aCLProps.Curvature(); - if(Crv >= eps) { - aCLProps.Tangent(N); - Standard_Real x = N.Y(), y = -N.X(); - N.SetCoord(x, y); - if (reverse) N.Reverse(); - aCLProps.CentreOfCurvature(Pc); - gp_Vec2d Dir( P, Pc ); - if (N.Dot(Dir) > 0.) { - if (LimCurv <= Crv + eps) { - BadEdges.Append(SE); - aMap.Add(SE); - continue; - } - } - } + if(aCType != GeomAbs_Line && aCType != GeomAbs_Circle) { - aCLProps.SetParameter(l); - if(!aCLProps.IsTangentDefined()) { - BadEdges.Append(SE); - aMap.Add(SE); - continue; - } - P = aCLProps.Value(); - Crv = aCLProps.Curvature(); + Standard_Boolean reverse = Standard_False; + if (E.Orientation() == TopAbs_FORWARD) reverse = Standard_True; - if(Crv >= eps) { - aCLProps.Tangent(N); - Standard_Real x = N.Y(), y = -N.X(); - N.SetCoord(x, y); - if (reverse) N.Reverse(); - aCLProps.CentreOfCurvature(Pc); - gp_Vec2d Dir( P, Pc ); - if (N.Dot(Dir) > 0.) { - if (LimCurv <= Crv + eps) { - BadEdges.Append(SE); - aMap.Add(SE); - continue; - } - } - } - } + + gp_Pnt2d P, Pc; + gp_Dir2d N; + + + Geom2dLProp_CLProps2d aCLProps(G2d, 2, eps); + + + aCLProps.SetParameter(f); + if(!aCLProps.IsTangentDefined()) { + BadEdges.Append(SE); + aMap.Add(SE); + continue; + } + + + P = aCLProps.Value(); + Standard_Real Crv = aCLProps.Curvature(); + + + if(Crv >= eps) { + aCLProps.Tangent(N); + Standard_Real x = N.Y(), y = -N.X(); + N.SetCoord(x, y); + if (reverse) N.Reverse(); + aCLProps.CentreOfCurvature(Pc); + gp_Vec2d Dir( P, Pc ); + if (N.Dot(Dir) > 0.) { + if (LimCurv <= Crv + eps) { + BadEdges.Append(SE); + aMap.Add(SE); + continue; + } + } + } + + + aCLProps.SetParameter(l); + if(!aCLProps.IsTangentDefined()) { + BadEdges.Append(SE); + aMap.Add(SE); + continue; + } + + + P = aCLProps.Value(); + Crv = aCLProps.Curvature(); + + + if(Crv >= eps) { + aCLProps.Tangent(N); + Standard_Real x = N.Y(), y = -N.X(); + N.SetCoord(x, y); + if (reverse) N.Reverse(); + aCLProps.CentreOfCurvature(Pc); + gp_Vec2d Dir( P, Pc ); + if (N.Dot(Dir) > 0.) { + if (LimCurv <= Crv + eps) { + BadEdges.Append(SE); + aMap.Add(SE); + continue; + } + } + } + } } } } @@ -2526,13 +2587,14 @@ static void CheckBadEdges(const TopoDS_Face& Spine, const Standard_Real Offset, //======================================================================= static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters, - TColgp_SequenceOfPnt& Points, - const Adaptor3d_Curve& C, - const Standard_Real Deflection, - const Standard_Real U1, - const Standard_Real U2, - const Standard_Real EPSILON, - const Standard_Integer Nbmin) + + TColgp_SequenceOfPnt& Points, + const Adaptor3d_Curve& C, + const Standard_Real Deflection, + const Standard_Real U1, + const Standard_Real U2, + const Standard_Real EPSILON, + const Standard_Integer Nbmin) { Standard_Real UU1 = Min(U1, U2); Standard_Real UU2 = Max(U1, U2); @@ -2551,13 +2613,14 @@ static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters, if((aDelta/aDist) > 5.0e-14) { QuasiFleche(C,Deflection*Deflection, - UU1,Pdeb, - Ddeb, - UU2,Pfin, - Dfin, - Nbmin, - EPSILON*EPSILON, - Parameters,Points); + + UU1,Pdeb, + Ddeb, + UU2,Pfin, + Dfin, + Nbmin, + EPSILON*EPSILON, + Parameters,Points); } return Standard_True; @@ -2568,17 +2631,18 @@ static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters, //======================================================================= static void QuasiFleche(const Adaptor3d_Curve& C, - const Standard_Real Deflection2, - const Standard_Real Udeb, - const gp_Pnt& Pdeb, - const gp_Vec& Vdeb, - const Standard_Real Ufin, - const gp_Pnt& Pfin, - const gp_Vec& Vfin, - const Standard_Integer Nbmin, - const Standard_Real Eps, - TColStd_SequenceOfReal& Parameters, - TColgp_SequenceOfPnt& Points) + + const Standard_Real Deflection2, + const Standard_Real Udeb, + const gp_Pnt& Pdeb, + const gp_Vec& Vdeb, + const Standard_Real Ufin, + const gp_Pnt& Pfin, + const gp_Vec& Vfin, + const Standard_Integer Nbmin, + const Standard_Real Eps, + TColStd_SequenceOfReal& Parameters, + TColgp_SequenceOfPnt& Points) { Standard_Integer Ptslength = Points.Length(); Standard_Real Udelta = Ufin-Udeb; @@ -2603,10 +2667,12 @@ static void QuasiFleche(const Adaptor3d_Curve& C, Standard_Real N2 = Vdelta.SquareMagnitude(); if (N1 > Eps && N2 > Eps) { Standard_Real Normediff = - (Vdeb.Normalized().XYZ()-Vdelta.Normalized().XYZ()).SquareModulus(); + + (Vdeb.Normalized().XYZ()-Vdelta.Normalized().XYZ()).SquareModulus(); if (Normediff > Eps) { - theFleche = Normediff*Norme/64.; - flecheok = Standard_True; + + theFleche = Normediff*Norme/64.; + flecheok = Standard_True; } } } @@ -2622,23 +2688,25 @@ static void QuasiFleche(const Adaptor3d_Curve& C, } else { QuasiFleche(C,Deflection2,Udeb,Pdeb, - Vdeb, - Udeb+Udelta,Pdelta, - Vdelta, - 3, - Eps, - Parameters,Points); + + Vdeb, + Udeb+Udelta,Pdelta, + Vdelta, + 3, + Eps, + Parameters,Points); } if (Nbmin > 2) { QuasiFleche(C,Deflection2,Udeb+Udelta,Pdelta, - Vdelta, - Ufin,Pfin, - Vfin, - Nbmin-(Points.Length()-Ptslength), - Eps, - Parameters,Points); + + Vdelta, + Ufin,Pfin, + Vfin, + Nbmin-(Points.Length()-Ptslength), + Eps, + Parameters,Points); } } diff --git a/src/BRepFill/BRepFill_TrimEdgeTool.cxx b/src/BRepFill/BRepFill_TrimEdgeTool.cxx index d3c4d56275..89d90ee1ad 100644 --- a/src/BRepFill/BRepFill_TrimEdgeTool.cxx +++ b/src/BRepFill/BRepFill_TrimEdgeTool.cxx @@ -31,13 +31,17 @@ #include #include #include - +#include #include - +#ifdef OCCT_DEBUG +//#define DRAW #ifdef DRAW #include #include static Standard_Boolean Affich = Standard_False; +static Standard_Boolean AffichInt = Standard_False; +static Standard_Integer intind = 0; +#endif #endif @@ -47,7 +51,7 @@ static Standard_Boolean Affich = Standard_False; //======================================================================= static void SimpleExpression (const Bisector_Bisec& B, - Handle(Geom2d_Curve)& Bis) + Handle(Geom2d_Curve)& Bis) { Bis = B.Value(); @@ -60,8 +64,8 @@ static void SimpleExpression (const Bisector_Bisec& B, if (BT == STANDARD_TYPE(Bisector_BisecAna)) { Bis = Handle(Bisector_BisecAna)::DownCast(BasBis)->Geom2dCurve(); Bis = new Geom2d_TrimmedCurve (Bis, - TrBis->FirstParameter(), - TrBis->LastParameter()); + TrBis->FirstParameter(), + TrBis->LastParameter()); } } } @@ -83,18 +87,18 @@ BRepFill_TrimEdgeTool::BRepFill_TrimEdgeTool() //======================================================================= BRepFill_TrimEdgeTool::BRepFill_TrimEdgeTool -(const Bisector_Bisec& Bisec, - const Handle(Geom2d_Geometry)& S1, - const Handle(Geom2d_Geometry)& S2, - const Standard_Real Offset) : + (const Bisector_Bisec& Bisec, + const Handle(Geom2d_Geometry)& S1, + const Handle(Geom2d_Geometry)& S2, + const Standard_Real Offset) : myOffset(Offset), -myBisec(Bisec) + myBisec(Bisec) { isPoint1 = (S1->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint)); isPoint2 = (S2->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint)); -// return geometries of shapes. -// Standard_Real f,l; + // return geometries of shapes. + // Standard_Real f,l; if (isPoint1) { myP1 = Handle(Geom2d_Point)::DownCast(S1)->Pnt2d(); } @@ -102,10 +106,10 @@ myBisec(Bisec) myC1 = Handle(Geom2d_Curve)::DownCast(S1); #ifdef DRAW if ( Affich) { -//POP pour NT + //POP pour NT char* myC1name = "myC1"; DrawTrSurf::Set(myC1name,myC1); -// DrawTrSurf::Set("myC1",myC1); + // DrawTrSurf::Set("myC1",myC1); } #endif } @@ -118,7 +122,7 @@ myBisec(Bisec) if ( Affich) { char* myC2name = "myC2"; DrawTrSurf::Set(myC2name,myC2); -// DrawTrSurf::Set("myC2",myC2); + // DrawTrSurf::Set("myC2",myC2); } #endif } @@ -128,8 +132,8 @@ myBisec(Bisec) myBis = Geom2dAdaptor_Curve(Bis); #ifdef DRAW if ( Affich) { - char* myBisname = "myBis"; - DrawTrSurf::Set(myBisname,Bis); + char* myBisname = "myBis"; + DrawTrSurf::Set(myBisname,Bis); } #endif @@ -150,8 +154,8 @@ static void Bubble(TColgp_SequenceOfPnt& Seq) gp_Pnt P1 = Seq.Value(i); gp_Pnt P2 = Seq.Value(i+1); if (P2.X() 0) { for ( Standard_Integer i = 1; i <= NbPoints; i++) { U1 = Intersector.Point(i).ParamOnSecond(); @@ -194,11 +198,11 @@ static void EvalParameters(const Geom2dAdaptor_Curve& Bis, P = gp_Pnt(U1,U2,0.); Params.Append(P); } - + } - + NbSegments = Intersector.NbSegments(); - + if (NbSegments > 0) { IntRes2d_IntersectionSegment Seg; for ( Standard_Integer i = 1; i <= NbSegments; i++) { @@ -206,20 +210,20 @@ static void EvalParameters(const Geom2dAdaptor_Curve& Bis, U1 = Seg.FirstPoint().ParamOnSecond(); Standard_Real Ulast = Seg.LastPoint().ParamOnSecond(); if ( Abs(U1 - CBis.FirstParameter()) <= Tol && - Abs(Ulast - CBis.LastParameter()) <= Tol ) { - P = gp_Pnt(U1,Seg.FirstPoint().ParamOnFirst(),0.); - Params.Append(P); - P = gp_Pnt(Ulast,Seg.LastPoint().ParamOnFirst(),0.); - Params.Append(P); + Abs(Ulast - CBis.LastParameter()) <= Tol ) { + P = gp_Pnt(U1,Seg.FirstPoint().ParamOnFirst(),0.); + Params.Append(P); + P = gp_Pnt(Ulast,Seg.LastPoint().ParamOnFirst(),0.); + Params.Append(P); } else { - U1 += Seg.LastPoint().ParamOnSecond(); - U1 /= 2.; - U2 = Seg.FirstPoint().ParamOnFirst(); - U2 += Seg.LastPoint().ParamOnFirst(); - U2 /= 2.; - P = gp_Pnt(U1,U2,0.); - Params.Append(P); + U1 += Seg.LastPoint().ParamOnSecond(); + U1 /= 2.; + U2 = Seg.FirstPoint().ParamOnFirst(); + U2 += Seg.LastPoint().ParamOnFirst(); + U2 /= 2.; + P = gp_Pnt(U1,U2,0.); + Params.Append(P); } } } @@ -227,15 +231,15 @@ static void EvalParameters(const Geom2dAdaptor_Curve& Bis, // Order the sequence by growing parameter on the bissectrice. Bubble( Params); } - + static void EvalParametersBis(const Geom2dAdaptor_Curve& Bis, - const Geom2dAdaptor_Curve& AC, - TColgp_SequenceOfPnt& Params, - const Standard_Real Tol) + const Geom2dAdaptor_Curve& AC, + TColgp_SequenceOfPnt& Params, + const Standard_Real Tol) { Geom2dInt_GInter Intersector; Standard_Real TolC = Tol; - + Geom2dAdaptor_Curve CBis(Bis); Geom2dAdaptor_Curve CAC (AC); @@ -248,9 +252,9 @@ static void EvalParametersBis(const Geom2dAdaptor_Curve& Bis, if ( !Intersector.IsDone()) { StdFail_NotDone::Raise("BRepFill_TrimSurfaceTool::IntersectWith"); } - + NbPoints = Intersector.NbPoints(); - + if (NbPoints > 0) { for ( Standard_Integer i = 1; i <= NbPoints; i++) { U1 = Intersector.Point(i).ParamOnSecond(); @@ -258,11 +262,11 @@ static void EvalParametersBis(const Geom2dAdaptor_Curve& Bis, P = gp_Pnt(U1,U2,0.); Params.Append(P); } - + } - + NbSegments = Intersector.NbSegments(); - + if (NbSegments > 0) { IntRes2d_IntersectionSegment Seg; for ( Standard_Integer i = 1; i <= NbSegments; i++) { @@ -270,20 +274,20 @@ static void EvalParametersBis(const Geom2dAdaptor_Curve& Bis, U1 = Seg.FirstPoint().ParamOnSecond(); Standard_Real Ulast = Seg.LastPoint().ParamOnSecond(); if ( Abs(U1 - CBis.FirstParameter()) <= Tol && - Abs(Ulast - CBis.LastParameter()) <= Tol ) { - P = gp_Pnt(U1,Seg.FirstPoint().ParamOnFirst(),0.); - Params.Append(P); - P = gp_Pnt(Ulast,Seg.LastPoint().ParamOnFirst(),0.); - Params.Append(P); + Abs(Ulast - CBis.LastParameter()) <= Tol ) { + P = gp_Pnt(U1,Seg.FirstPoint().ParamOnFirst(),0.); + Params.Append(P); + P = gp_Pnt(Ulast,Seg.LastPoint().ParamOnFirst(),0.); + Params.Append(P); } else { - U1 += Seg.LastPoint().ParamOnSecond(); - U1 /= 2.; - U2 = Seg.FirstPoint().ParamOnFirst(); - U2 += Seg.LastPoint().ParamOnFirst(); - U2 /= 2.; - P = gp_Pnt(U1,U2,0.); - Params.Append(P); + U1 += Seg.LastPoint().ParamOnSecond(); + U1 /= 2.; + U2 = Seg.FirstPoint().ParamOnFirst(); + U2 += Seg.LastPoint().ParamOnFirst(); + U2 /= 2.; + P = gp_Pnt(U1,U2,0.); + Params.Append(P); } } } @@ -299,8 +303,8 @@ static void EvalParametersBis(const Geom2dAdaptor_Curve& Bis, //======================================================================= void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - TColgp_SequenceOfPnt& Params) + const TopoDS_Edge& Edge2, + TColgp_SequenceOfPnt& Params) { Params.Clear(); @@ -318,27 +322,28 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, Geom2dAdaptor_Curve AC2(C2,f,l); #ifdef DRAW - if ( Affich) { + if ( AffichInt) { f = AC1.FirstParameter(); l = AC1.LastParameter(); - char* CURVE1name = "CURVE1"; - DrawTrSurf::Set(CURVE1name, new Geom2d_TrimmedCurve(C1,f,l)); + char name[32]; + sprintf(name,"C1_%d", ++intind); + DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(C1,f,l)); f = AC2.FirstParameter(); l = AC2.LastParameter(); - char* CURVE2name = "CURVE2"; - DrawTrSurf::Set(CURVE2name, new Geom2d_TrimmedCurve(C2,f,l)); + sprintf(name,"C2_%d", intind); + DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(C2,f,l)); f = myBis.FirstParameter(); l = myBis.LastParameter(); - char* bisname = "BIS"; - DrawTrSurf::Set(bisname, new Geom2d_TrimmedCurve(myBis.Curve(),f,l)); - char* Edge1name = "E1"; - DBRep::Set(Edge1name, Edge1); - char* Edge2name = "E2"; - DBRep::Set(Edge2name, Edge2); + sprintf(name,"BIS%d", intind); + DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(myBis.Curve(),f,l)); + sprintf(name,"E1_%d", intind); + DBRep::Set(name, Edge1); + sprintf(name,"E2_%d", intind); + DBRep::Set(name, Edge2); } #endif - + // Calculate intersection TColgp_SequenceOfPnt Points2; gp_Pnt PSeq; @@ -347,33 +352,91 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, EvalParameters (myBis,AC2,Points2); + Standard_Integer SeanceDeRattrapage=0; Standard_Real TolInit= 1.e-9; Standard_Integer nn = 7; if((AC1.GetType() != GeomAbs_Circle && AC1.GetType() != GeomAbs_Line) || - (AC2.GetType() != GeomAbs_Circle && AC2.GetType() != GeomAbs_Line)) { + (AC2.GetType() != GeomAbs_Circle && AC2.GetType() != GeomAbs_Line)) { - TolInit = 1.e-8; - nn = 6; + TolInit = 1.e-8; + nn = 6; } - + + if(Params.IsEmpty() && Points2.IsEmpty()) + { + //Check, may be there are no intersections at all + // for case myBis == Line + if(myBis.GetType() == GeomAbs_Line) + { + Standard_Real dmax = TolInit; + Standard_Integer n = 0; + while(n < nn) + { + dmax *= 10.0; + ++n; + } + dmax *= dmax; + // + gp_Lin2d anL = myBis.Line(); + Standard_Boolean isFar1 = Standard_True; + Standard_Boolean isFar2 = Standard_True; + gp_Pnt2d aP; + // + Standard_Real d = RealLast(); + AC1.D0(AC1.FirstParameter(), aP); + Standard_Real par = ElCLib::Parameter(anL, aP); + if(par >= myBis.FirstParameter() && par <= myBis.LastParameter()) + { + d = anL.SquareDistance(aP); + } + AC1.D0(AC1.LastParameter(), aP); + par = ElCLib::Parameter(anL, aP); + if(par >= myBis.FirstParameter() && par <= myBis.LastParameter()) + { + d = Min(anL.SquareDistance(aP), d); + } + isFar1 = d > dmax; + // + d = RealLast(); + AC2.D0(AC2.FirstParameter(), aP); + par = ElCLib::Parameter(anL, aP); + if(par >= myBis.FirstParameter() && par <= myBis.LastParameter()) + { + d = anL.SquareDistance(aP); + } + AC2.D0(AC2.LastParameter(), aP); + par = ElCLib::Parameter(anL, aP); + if(par >= myBis.FirstParameter() && par <= myBis.LastParameter()) + { + d = Min(anL.SquareDistance(aP), d); + } + isFar2 = d > dmax; + // + if(isFar1 && isFar2) + { + return; + } + } + } + while ( SeanceDeRattrapage < nn // TolInit <= 0.01 - && ( Points2.Length() != Params.Length() || - (Points2.Length() == 0 && Params.Length() == 0) ) ) { + && ( Points2.Length() != Params.Length() || + (Points2.Length() == 0 && Params.Length() == 0) ) ) { #ifdef OCCT_DEBUG - cout << "BRepFill_TrimEdgeTool: incoherent intersection. Try with a greater tolerance" << endl; + cout << "BRepFill_TrimEdgeTool: incoherent intersection. Try with a greater tolerance" << endl; #endif - Params.Clear(); - Points2.Clear(); - - TolInit*=10.0; - - EvalParametersBis(myBis,AC1,Params,TolInit); - EvalParametersBis(myBis,AC2,Points2,TolInit); - SeanceDeRattrapage++; + Params.Clear(); + Points2.Clear(); + + TolInit*=10.0; + + EvalParametersBis(myBis,AC1,Params,TolInit); + EvalParametersBis(myBis,AC2,Points2,TolInit); + SeanceDeRattrapage++; } #ifdef OCCT_DEBUG @@ -387,7 +450,7 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, if(Params.Length() == 0 && Points2.Length() == 1) { //cout << "Params.Length() == 0 && Points2.Length() == 1" << endl; - Standard_Real dmin; + Standard_Real dmin, dmax = 0.25*myOffset*myOffset; Standard_Real tBis = Points2(1).X(); gp_Pnt2d PBis = myBis.Value(tBis); @@ -395,19 +458,26 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, gp_Pnt2d PC = AC1.Value(t); dmin = PC.SquareDistance(PBis); gp_Pnt P(tBis, t, 0.); - Params.Append(P); + if(dmin < dmax) + { + Params.Append(P); + } t = AC1.LastParameter(); PC = AC1.Value(t); - if(dmin > PC.SquareDistance(PBis)) { + Standard_Real dmin1 = PC.SquareDistance(PBis); + if(dmin > dmin1 && dmin1 < dmax ) { P.SetY(t); - Params.SetValue(1,P); + if(Params.IsEmpty()) + Params.Append(P); + else + Params.SetValue(1,P); } } else if(Params.Length() == 1 && Points2.Length() == 0) { //cout << "Params.Length() == 1 && Points2.Length() == 0" << endl; - Standard_Real dmin; + Standard_Real dmin, dmax = 0.25*myOffset*myOffset; Standard_Real tBis = Params(1).X(); gp_Pnt2d PBis = myBis.Value(tBis); @@ -415,13 +485,20 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, gp_Pnt2d PC = AC2.Value(t); dmin = PC.SquareDistance(PBis); gp_Pnt P(tBis, t, 0.); - Points2.Append(P); + if(dmin < dmax) + { + Points2.Append(P); + } t = AC2.LastParameter(); PC = AC2.Value(t); - if(dmin > PC.SquareDistance(PBis)) { + Standard_Real dmin1 = PC.SquareDistance(PBis); + if(dmin > dmin1 && dmin1 < dmax ) { P.SetY(t); - Points2.SetValue(1,P); + if(Points2.IsEmpty()) + Points2.Append(P); + else + Points2.SetValue(1,P); } } @@ -457,13 +534,13 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, #endif if(P1xP2x>TolInit) { #ifdef OCCT_DEBUG - cout << "BRepFill_TrimEdgeTool: Continue somehow" << endl; + cout << "BRepFill_TrimEdgeTool: Continue somehow" << endl; #endif - i++; + i++; } else { - if ( P1.X() < P2.X()) Params.Remove(i); - else Points2.Remove(i); + if ( P1.X() < P2.X()) Params.Remove(i); + else Points2.Remove(i); } } else i++; @@ -492,10 +569,10 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1, //======================================================================= void BRepFill_TrimEdgeTool::AddOrConfuse(const Standard_Boolean Start, - const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - TColgp_SequenceOfPnt& Params) -const + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + TColgp_SequenceOfPnt& Params) + const { Standard_Boolean ToProj = Standard_True; gp_Pnt2d PBis; @@ -521,7 +598,7 @@ const else P = AC1.Value(Params.Last ().Y()); ToProj = !PBis.IsEqual(P,Tol); } - + if (ToProj) { #ifdef OCCT_DEBUG cout << " project extremity bissectrice on parallel."< 0) { Dist = Projector.LowerDistance(); } -// Modified by Sergey KHROMOV - Fri Sep 27 11:43:43 2002 Begin -// else { -// gp_Pnt2d PF = myC1->Value(myC1->FirstParameter()); -// gp_Pnt2d PL = myC1->Value(myC1->LastParameter()); -// Dist = Min (P.Distance(PF),P.Distance(PL)); -// } + // Modified by Sergey KHROMOV - Fri Sep 27 11:43:43 2002 Begin + // else { + // gp_Pnt2d PF = myC1->Value(myC1->FirstParameter()); + // gp_Pnt2d PL = myC1->Value(myC1->LastParameter()); + // Dist = Min (P.Distance(PF),P.Distance(PL)); + // } -// Check of distances between P and first and last point of the first curve -// should be performed in any case, despite of the results of projection. + // Check of distances between P and first and last point of the first curve + // should be performed in any case, despite of the results of projection. gp_Pnt2d PF = myC1->Value(myC1->FirstParameter()); gp_Pnt2d PL = myC1->Value(myC1->LastParameter()); Standard_Real aDistMin = Min (P.Distance(PF),P.Distance(PL)); if (Dist > aDistMin) Dist = aDistMin; -// Modified by Sergey KHROMOV - Fri Sep 27 11:43:44 2002 End + // Modified by Sergey KHROMOV - Fri Sep 27 11:43:44 2002 End } - -// return (Dist < Abs(myOffset); -// return (Dist < Abs(myOffset) + Precision::Confusion()); + + // return (Dist < Abs(myOffset); + // return (Dist < Abs(myOffset) + Precision::Confusion()); return (Dist < Abs(myOffset) - Precision::Confusion()); } diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx index 3b72a6ff6b..3cfa3d2605 100644 --- a/src/BRepLib/BRepLib.cxx +++ b/src/BRepLib/BRepLib.cxx @@ -780,7 +780,13 @@ static void SetEdgeTol(const TopoDS_Edge& E, gp_Pnt Pc3d = HC->Value(u); gp_Pnt2d p2d = pc->Value(u); gp_Pnt Pcons = ElSLib::Value(p2d.X(),p2d.Y(),pln); + Standard_Real eps = Max(Pc3d.XYZ().SquareModulus(), Pcons.XYZ().SquareModulus()); + eps = Epsilon(eps); Standard_Real temp = Pc3d.SquareDistance(Pcons); + if(temp <= eps) + { + temp = 0.; + } if(temp > d2) d2 = temp; } d2 = 1.5*sqrt(d2); diff --git a/src/BRepLib/BRepLib_FindSurface.cxx b/src/BRepLib/BRepLib_FindSurface.cxx index 5363865588..5708e3e6e9 100644 --- a/src/BRepLib/BRepLib_FindSurface.cxx +++ b/src/BRepLib/BRepLib_FindSurface.cxx @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include @@ -58,7 +60,7 @@ //purpose : //======================================================================= static Standard_Real Controle(const TColgp_SequenceOfPnt& thePoints, - const Handle(Geom_Plane)& thePlane) + const Handle(Geom_Plane)& thePlane) { Standard_Real dfMaxDist=0.; Standard_Real a,b,c,d, dist; @@ -79,9 +81,9 @@ static Standard_Real Controle(const TColgp_SequenceOfPnt& thePoints, // the first vertex of theEdge2 in parametric space of theFace //======================================================================= inline static Standard_Boolean Is2DConnected(const TopoDS_Edge& theEdge1, - const TopoDS_Edge& theEdge2, - const Handle(Geom_Surface)& theSurface, - const TopLoc_Location& theLocation) + const TopoDS_Edge& theEdge2, + const Handle(Geom_Surface)& theSurface, + const TopLoc_Location& theLocation) { Standard_Real f,l; //TopLoc_Location aLoc; @@ -110,8 +112,8 @@ inline static Standard_Boolean Is2DConnected(const TopoDS_Edge& theEdge1, //======================================================================= static Standard_Boolean Is2DClosed(const TopoDS_Shape& theShape, - const Handle(Geom_Surface)& theSurface, - const TopLoc_Location& theLocation) + const Handle(Geom_Surface)& theSurface, + const TopLoc_Location& theLocation) { try { @@ -164,9 +166,9 @@ BRepLib_FindSurface::BRepLib_FindSurface() //purpose : //======================================================================= BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S, - const Standard_Real Tol, - const Standard_Boolean OnlyPlane, - const Standard_Boolean OnlyClosed) + const Standard_Real Tol, + const Standard_Boolean OnlyPlane, + const Standard_Boolean OnlyClosed) { Init(S,Tol,OnlyPlane,OnlyClosed); } @@ -175,9 +177,9 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S, //purpose : //======================================================================= void BRepLib_FindSurface::Init(const TopoDS_Shape& S, - const Standard_Real Tol, - const Standard_Boolean OnlyPlane, - const Standard_Boolean OnlyClosed) + const Standard_Real Tol, + const Standard_Boolean OnlyPlane, + const Standard_Boolean OnlyClosed) { myTolerance = Tol; myTolReached = 0.; @@ -331,27 +333,15 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S, continue; else { - const Standard_Integer aNbPolMax = 200; - Standard_Integer incr = 1; - if(iNbPol > aNbPolMax) - { - Standard_Integer nb = iNbPol; - while(nb > aNbPolMax) - { - incr++; - nb = (iNbPol-1) / incr; - } - } Handle(TColgp_HArray1OfPnt) aPoles = new (TColgp_HArray1OfPnt) (1, iNbPol); GC->Poles(aPoles->ChangeArray1()); gp_Pnt aPolePrev = aPoles->Value(1), aPoleNext; Standard_Real dfDistPrev = 0., dfDistNext; - Standard_Integer iPol; - for (iPol = 1; iPol <= iNbPol; iPol += incr) + for (Standard_Integer iPol=1; iPol<=iNbPol; iPol++) { - if (iPol <= iNbPol - incr) + if (iPolValue(iPol+incr); + aPoleNext = aPoles->Value(iPol+1); dfDistNext = aPolePrev.Distance(aPoleNext); } else @@ -436,50 +426,115 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S, aMat(1,1)+=w*p.X()*p.X(); aMat(1,2)+=w*p.X()*p.Y(); aMat(1,3)+=w*p.X()*p.Z(); - aMat(2,1)+=w*p.Y()*p.X(); + // aMat(2,2)+=w*p.Y()*p.Y(); aMat(2,3)+=w*p.Y()*p.Z(); - aMat(3,1)+=w*p.Z()*p.X(); - aMat(3,2)+=w*p.Z()*p.Y(); + // aMat(3,3)+=w*p.Z()*p.Z(); - aVec(1) -= w*p.X(); - aVec(2) -= w*p.Y(); - aVec(3) -= w*p.Z(); } - - // Solve the system of equations to get plane coefficients - math_Gauss aSolver(aMat); - Standard_Boolean isSolved = aSolver.IsDone(); + aMat(2,1) = aMat(1,2); + aMat(3,1) = aMat(1,3); + aMat(3,2) = aMat(2,3); + // + math_Jacobi anEignval(aMat); + math_Vector anEVals(1,3); + Standard_Boolean isSolved = anEignval.IsDone(); + Standard_Integer isol = 0; + if(isSolved) + { + anEVals = anEignval.Values(); + //We need vector with eigenvalue ~ 0. + Standard_Real anEMin = RealLast(); + Standard_Real anEMax = -anEMin; + for(i = 1; i <= 3; ++i) + { + Standard_Real anE = Abs(anEVals(i)); + if(anEMin > anE) + { + anEMin = anE; + isol = i; + } + if(anEMax < anE) + { + anEMax = anE; + } + } + + if(isol == 0) + { + isSolved = Standard_False; + } + else + { + Standard_Real eps = Epsilon(anEMax); + if(anEMin <= eps) + { + anEignval.Vector(isol, aVec); + } + else + { + //try using vector product of other axes + Standard_Integer ind[2] = {0,0}; + for(i = 1; i <= 3; ++i) + { + if(i == isol) + { + continue; + } + if(ind[0] == 0) + { + ind[0] = i; + continue; + } + if(ind[1] == 0) + { + ind[1] = i; + continue; + } + } + math_Vector aVec1(1, 3, 0.), aVec2(1, 3, 0.); + anEignval.Vector(ind[0], aVec1); + anEignval.Vector(ind[1], aVec2); + gp_Vec aV1(aVec1(1), aVec1(2), aVec1(3)); + gp_Vec aV2(aVec2(1), aVec2(2), aVec2(3)); + gp_Vec aN = aV1^ aV2; + aVec(1) = aN.X(); + aVec(2) = aN.Y(); + aVec(3) = aN.Z(); + } + if (aVec.Norm2() < gp::Resolution()) { + isSolved = Standard_False; + } + } + } + // // let us be more tolerant (occ415) Standard_Real dfDist = RealLast(); Handle(Geom_Plane) aPlane; // if (isSolved) { - aSolver.Solve(aVec); - if (aVec.Norm2() dfSide*myTolerance) { - Handle(Geom_Plane) aPlane2 = new Geom_Plane(aFirstPnt, aCross); + Handle(Geom_Plane) aPlane2 = new Geom_Plane(aBaryCenter, aCross); Standard_Real dfDist2 = Controle (aPoints, aPlane2); if (dfDist2 < myTolerance) { myTolReached = dfDist2; @@ -504,6 +559,23 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S, //myTolReached = dfDist; //XXt mySurface = aPlane; + //If S is wire, try to orient surface according to orientation of wire. + if(S.ShapeType() == TopAbs_WIRE && S.Closed()) + { + // + TopoDS_Wire aW = TopoDS::Wire(S); + TopoDS_Face aTmpFace = BRepLib_MakeFace(mySurface, Precision::Confusion()); + BRep_Builder BB; + BB.Add(aTmpFace, aW); + BRepTopAdaptor_FClass2d FClass(aTmpFace, 0.); + if ( FClass.PerformInfinitePoint() == TopAbs_IN ) + { + gp_Dir aN = aPlane->Position().Direction(); + aN.Reverse(); + mySurface = new Geom_Plane(aPlane->Position().Location(), aN); + } + + } } //XXf myTolReached = dfDist; diff --git a/src/BRepMAT2d/BRepMAT2d_Explorer.cxx b/src/BRepMAT2d/BRepMAT2d_Explorer.cxx index 81dd364b34..327717bf09 100644 --- a/src/BRepMAT2d/BRepMAT2d_Explorer.cxx +++ b/src/BRepMAT2d/BRepMAT2d_Explorer.cxx @@ -39,14 +39,27 @@ #include #include #include - +#include +#include +#include +#include +#include +#include +#include +#include +#include +// // Modified by Sergey KHROMOV - Thu Dec 5 10:38:14 2002 Begin static TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve, - const TopoDS_Face &theFace, - const TopoDS_Vertex &theVFirst, - const TopoDS_Vertex &theVLast); + const TopoDS_Face &theFace, + const TopoDS_Vertex &theVFirst, + const TopoDS_Vertex &theVLast); // Modified by Sergey KHROMOV - Thu Dec 5 10:38:16 2002 End - +// +static GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d); +static void AdjustCurveEnd(Handle(Geom2d_BoundedCurve)& theC2d, const gp_Pnt2d theP, + const Standard_Boolean isFirst); +// //======================================================================= //function : BRepMAT2d_Explorer //purpose : @@ -79,7 +92,7 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace) TopoDS_Face F = TopoDS::Face(aFace); F.Orientation(TopAbs_FORWARD); TopExp_Explorer Exp (F,TopAbs_WIRE); -// Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin + // Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F); TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf, Precision::Confusion()); @@ -91,8 +104,8 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace) BRepLib::BuildCurves3d(aNewF); myModifShapes.Add(aFace, aNewF); -// CheckConnection(); -// Modified by Sergey KHROMOV - Tue Nov 26 16:10:38 2002 End + // CheckConnection(); + // Modified by Sergey KHROMOV - Tue Nov 26 16:10:38 2002 End } //======================================================================= @@ -101,43 +114,43 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace) //======================================================================= void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine, - const TopoDS_Face& aFace, - TopoDS_Face& aNewFace) + const TopoDS_Face& aFace, + TopoDS_Face& aNewFace) { -// Modified by Sergey KHROMOV - Tue Nov 26 14:25:46 2002 Begin -// This method is totally rewroted to include check -// of connection and creation of a new spine. + // Modified by Sergey KHROMOV - Tue Nov 26 14:25:46 2002 Begin + // This method is totally rewroted to include check + // of connection and creation of a new spine. NewContour(); myIsClosed(currentContour) = (Spine.Closed()) ? Standard_True : Standard_False; -// Modified by skv - Wed Jun 23 12:23:01 2004 Integration Begin -// Taking into account side of bisecting loci construction. -// TopoDS_Wire aWFwd = TopoDS::Wire(Spine.Oriented(TopAbs_FORWARD)); -// BRepTools_WireExplorer anExp(aWFwd, aFace); + // Modified by skv - Wed Jun 23 12:23:01 2004 Integration Begin + // Taking into account side of bisecting loci construction. + // TopoDS_Wire aWFwd = TopoDS::Wire(Spine.Oriented(TopAbs_FORWARD)); + // BRepTools_WireExplorer anExp(aWFwd, aFace); BRepTools_WireExplorer anExp(Spine, aFace); -// Modified by skv - Wed Jun 23 12:23:02 2004 Integration End + // Modified by skv - Wed Jun 23 12:23:02 2004 Integration End TopTools_IndexedDataMapOfShapeShape anOldNewE; if (!anExp.More()) return; TopoDS_Edge aFirstEdge = anExp.Current(); + TopoDS_Edge aPrevEdge = aFirstEdge; Standard_Real UFirst,ULast, aD; - Handle(Geom2d_BSplineCurve) BCurve; Handle(Geom2d_Curve) C2d; Handle(Geom2d_TrimmedCurve) CT2d; Handle(Geom2d_TrimmedCurve) aFirstCurve; gp_Pnt2d aPFirst; gp_Pnt2d aPLast; gp_Pnt2d aPCurFirst; -// Modified by skv - Mon Jul 11 19:00:25 2005 Integration Begin -// Set the confusion tolerance in accordance with the further algo -// Standard_Real aTolConf = Precision::Confusion(); + // Modified by skv - Mon Jul 11 19:00:25 2005 Integration Begin + // Set the confusion tolerance in accordance with the further algo + // Standard_Real aTolConf = Precision::Confusion(); Standard_Real aTolConf = 1.e-8; -// Modified by skv - Mon Jul 11 19:00:25 2005 Integration End + // Modified by skv - Mon Jul 11 19:00:25 2005 Integration End Standard_Boolean isModif = Standard_False; -// Treatment of the first edge of a wire. + // Treatment of the first edge of a wire. anOldNewE.Add(aFirstEdge, aFirstEdge); C2d = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, UFirst, ULast); CT2d = new Geom2d_TrimmedCurve(C2d,UFirst,ULast); @@ -152,7 +165,7 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine, aFirstCurve = CT2d; anExp.Next(); -// Treatment of the next edges: + // Treatment of the next edges: for (; anExp.More(); anExp.Next()) { TopoDS_Edge anEdge = anExp.Current(); @@ -175,64 +188,111 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine, // code should be rewritten. isModif = Standard_True; // - //modified by NIZNHY-PKV Tue Aug 7 09:14:03 2007f - //BCurve = Geom2dConvert::CurveToBSplineCurve(CT2d); - BCurve=Geom2dConvert::CurveToBSplineCurve(CT2d, Convert_QuasiAngular); - //modified by NIZNHY-PKV Tue Aug 7 09:14:07 2007t - - BCurve->SetPole(1, aPLast); - CT2d = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(), - BCurve->LastParameter()); + Standard_Integer aNbC = theCurves.Value(currentContour).Length(); + Handle(Geom2d_BoundedCurve) CPrev = + Handle(Geom2d_BoundedCurve)::DownCast(theCurves.ChangeValue(currentContour).ChangeValue(aNbC)); + // + GeomAbs_CurveType TCPrev = GetCurveType(CPrev); + GeomAbs_CurveType TCCurr = GetCurveType(CT2d); + // + if(TCCurr <= TCPrev) + { + AdjustCurveEnd(CT2d, aPLast, Standard_True); + // Creation of new edge. + TopoDS_Edge aNewEdge; + TopoDS_Vertex aVf = TopExp::FirstVertex(anEdge); + TopoDS_Vertex aVl = TopExp::LastVertex(anEdge); - // Creation of new edge. - TopoDS_Edge aNewEdge; - TopoDS_Vertex aVf = TopExp::FirstVertex(anEdge); - TopoDS_Vertex aVl = TopExp::LastVertex(anEdge); + if (anEdge.Orientation() == TopAbs_FORWARD) + aNewEdge = MakeEdge(CT2d, aNewFace, aVf, aVl); + else + aNewEdge = MakeEdge(CT2d->Reversed(), aNewFace, aVf, aVl); - if (anEdge.Orientation() == TopAbs_FORWARD) - aNewEdge = MakeEdge(CT2d, aNewFace, aVf, aVl); - else - aNewEdge = MakeEdge(CT2d->Reversed(), aNewFace, aVf, aVl); + aNewEdge.Orientation(anEdge.Orientation()); - aNewEdge.Orientation(anEdge.Orientation()); + anOldNewE.ChangeFromKey(anEdge) = aNewEdge; + } + else + { + gp_Pnt2d aP = CT2d->Value(CT2d->FirstParameter()); + AdjustCurveEnd(CPrev, aP, Standard_False); + theCurves.ChangeValue(currentContour).ChangeValue(aNbC) = CPrev; + //Change previous edge + TopoDS_Edge aNewEdge; + TopoDS_Vertex aVf = TopExp::FirstVertex(aPrevEdge); + TopoDS_Vertex aVl = TopExp::LastVertex(aPrevEdge); + + if (aPrevEdge.Orientation() == TopAbs_FORWARD) + aNewEdge = MakeEdge(CPrev, aNewFace, aVf, aVl); + else + aNewEdge = MakeEdge(CPrev->Reversed(), aNewFace, aVf, aVl); + + aNewEdge.Orientation(aPrevEdge.Orientation()); + + anOldNewE.ChangeFromKey(aPrevEdge) = aNewEdge; + + } - anOldNewE.ChangeFromKey(anEdge) = aNewEdge; } aPLast = CT2d->Value(CT2d->LastParameter()); Add(CT2d); + aPrevEdge = anEdge; } // Check of the distance between the first and the last point of wire // if the wire is closed. - if (myIsClosed(currentContour) && aPLast.Distance(aPFirst) > aTolConf) { - isModif = Standard_True; + if (myIsClosed(currentContour) && aPLast.Distance(aPFirst) > aTolConf) { + isModif = Standard_True; - - //modified by NIZNHY-PKV Tue Aug 7 09:20:08 2007f - //Handle(Geom2d_BSplineCurve) - //BCurve = Geom2dConvert::CurveToBSplineCurve(aFirstCurve); - BCurve = Geom2dConvert::CurveToBSplineCurve(aFirstCurve, Convert_QuasiAngular); - //modified by NIZNHY-PKV Tue Aug 7 09:20:11 2007t - - BCurve->SetPole(1, aPLast); - aFirstCurve = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(), - BCurve->LastParameter()); + // + Standard_Integer aNbC = theCurves.Value(currentContour).Length(); + Handle(Geom2d_BoundedCurve) CPrev = + Handle(Geom2d_BoundedCurve)::DownCast(theCurves.ChangeValue(currentContour).ChangeValue(aNbC)); + // + GeomAbs_CurveType TCPrev = GetCurveType(CPrev); + GeomAbs_CurveType TCCurr = GetCurveType(aFirstCurve); + // + if(TCCurr <= TCPrev) + { + AdjustCurveEnd(aFirstCurve, aPLast, Standard_True); theCurves.ChangeValue(currentContour).ChangeValue(1) = aFirstCurve; - - // Creation of new first edge. + // Creation of new edge. TopoDS_Edge aNewEdge; TopoDS_Vertex aVf = TopExp::FirstVertex(aFirstEdge); TopoDS_Vertex aVl = TopExp::LastVertex(aFirstEdge); if (aFirstEdge.Orientation() == TopAbs_FORWARD) - aNewEdge = MakeEdge(aFirstCurve, aNewFace, aVf, aVl); + aNewEdge = MakeEdge(aFirstCurve, aNewFace, aVf, aVl); else - aNewEdge = MakeEdge(aFirstCurve->Reversed(), aNewFace, aVf, aVl); + aNewEdge = MakeEdge(aFirstCurve->Reversed(), aNewFace, aVf, aVl); aNewEdge.Orientation(aFirstEdge.Orientation()); + anOldNewE.ChangeFromKey(aFirstEdge) = aNewEdge; } + else + { + gp_Pnt2d aP = aFirstCurve->Value(aFirstCurve->FirstParameter()); + AdjustCurveEnd(CPrev, aP, Standard_False); + theCurves.ChangeValue(currentContour).ChangeValue(aNbC) = CPrev; + //Change previous edge + TopoDS_Edge aNewEdge; + TopoDS_Vertex aVf = TopExp::FirstVertex(aPrevEdge); + TopoDS_Vertex aVl = TopExp::LastVertex(aPrevEdge); + + if (aPrevEdge.Orientation() == TopAbs_FORWARD) + aNewEdge = MakeEdge(CPrev, aNewFace, aVf, aVl); + else + aNewEdge = MakeEdge(CPrev->Reversed(), aNewFace, aVf, aVl); + + aNewEdge.Orientation(aPrevEdge.Orientation()); + + anOldNewE.ChangeFromKey(aPrevEdge) = aNewEdge; + + } + + } TopoDS_Wire aNewWire; BRep_Builder aBuilder; @@ -263,7 +323,7 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine, aNewWire = Spine; aBuilder.Add(aNewFace, aNewWire); -// Modified by Sergey KHROMOV - Tue Nov 26 14:25:53 2002 End + // Modified by Sergey KHROMOV - Tue Nov 26 14:25:53 2002 End } //======================================================================= @@ -302,10 +362,10 @@ void BRepMAT2d_Explorer::Clear() { theCurves.Clear() ; currentContour = 0; -// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 Begin + // Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 Begin myIsClosed.Clear(); myModifShapes.Clear(); -// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 End + // Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 End } @@ -318,9 +378,9 @@ void BRepMAT2d_Explorer::NewContour() { TColGeom2d_SequenceOfCurve Contour; theCurves.Append(Contour); -// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 Begin + // Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 Begin myIsClosed.Append(Standard_False); -// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 End + // Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 End currentContour ++ ; } @@ -353,7 +413,7 @@ Standard_Integer BRepMAT2d_Explorer::NumberOfContours() const Standard_Integer BRepMAT2d_Explorer::NumberOfCurves (const Standard_Integer IndexContour) -const + const { return theCurves.Value(IndexContour).Length(); } @@ -421,7 +481,7 @@ TopoDS_Shape BRepMAT2d_Explorer::Shape() const const TColGeom2d_SequenceOfCurve& BRepMAT2d_Explorer::Contour (const Standard_Integer IC) -const + const { return theCurves.Value(IC); } @@ -434,7 +494,7 @@ const //======================================================================= Standard_Boolean BRepMAT2d_Explorer::IsModified - (const TopoDS_Shape &aShape) const + (const TopoDS_Shape &aShape) const { if (myModifShapes.Contains(aShape)) { const TopoDS_Shape &aNewShape = myModifShapes.FindFromKey(aShape); @@ -452,7 +512,7 @@ Standard_Boolean BRepMAT2d_Explorer::IsModified //======================================================================= TopoDS_Shape BRepMAT2d_Explorer::ModifiedShape - (const TopoDS_Shape &aShape) const + (const TopoDS_Shape &aShape) const { if (myModifShapes.Contains(aShape)) { const TopoDS_Shape &aNewShape = myModifShapes.FindFromKey(aShape); @@ -479,9 +539,9 @@ const TColStd_SequenceOfBoolean &BRepMAT2d_Explorer::GetIsClosed() const //======================================================================= TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve, - const TopoDS_Face &theFace, - const TopoDS_Vertex &theVFirst, - const TopoDS_Vertex &theVLast) + const TopoDS_Face &theFace, + const TopoDS_Vertex &theVFirst, + const TopoDS_Vertex &theVLast) { TopoDS_Edge aNewEdge; BRep_Builder aBuilder; @@ -498,3 +558,85 @@ TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve, return aNewEdge; } // Modified by Sergey KHROMOV - Wed Mar 6 17:40:14 2002 End +// +//======================================================================= +//function : GetCurveType +//purpose : Get curve type. +//======================================================================= + +GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d) +{ + GeomAbs_CurveType aTypeCurve = GeomAbs_OtherCurve; + Handle(Standard_Type) TheType = theC2d->DynamicType(); + if ( TheType == STANDARD_TYPE(Geom2d_TrimmedCurve)) { + TheType = (*((Handle(Geom2d_TrimmedCurve)*)&theC2d))->BasisCurve()->DynamicType(); + } + + if ( TheType == STANDARD_TYPE(Geom2d_Circle)) { + aTypeCurve = GeomAbs_Circle; + } + else if ( TheType ==STANDARD_TYPE(Geom2d_Line)) { + aTypeCurve = GeomAbs_Line; + } + else if ( TheType == STANDARD_TYPE(Geom2d_Ellipse)) { + aTypeCurve = GeomAbs_Ellipse; + } + else if ( TheType == STANDARD_TYPE(Geom2d_Parabola)) { + aTypeCurve = GeomAbs_Parabola; + } + else if ( TheType == STANDARD_TYPE(Geom2d_Hyperbola)) { + aTypeCurve = GeomAbs_Hyperbola; + } + else if ( TheType == STANDARD_TYPE(Geom2d_BezierCurve)) { + aTypeCurve = GeomAbs_BezierCurve; + } + else if ( TheType == STANDARD_TYPE(Geom2d_BSplineCurve)) { + aTypeCurve = GeomAbs_BSplineCurve; + } + else { + aTypeCurve = GeomAbs_OtherCurve; + } + return aTypeCurve; +} +//======================================================================= +//function : AdjustCurveEnd +//purpose : +//======================================================================= +void AdjustCurveEnd(Handle(Geom2d_BoundedCurve)& theC2d, const gp_Pnt2d theP, + const Standard_Boolean isFirst) +{ + GeomAbs_CurveType aType = GetCurveType(theC2d); + if(aType == GeomAbs_Line) + { + //create new line + if(isFirst) + { + gp_Pnt2d aP = theC2d->Value(theC2d->LastParameter()); + theC2d = GCE2d_MakeSegment(theP, aP); + } + else + { + gp_Pnt2d aP = theC2d->Value(theC2d->FirstParameter()); + theC2d = GCE2d_MakeSegment(aP, theP); + } + } + else + { + //Convert to BSpline and adjust first pole + Handle(Geom2d_BSplineCurve) BCurve = + Geom2dConvert::CurveToBSplineCurve(theC2d, Convert_QuasiAngular); + if(isFirst) + { + BCurve->SetPole(1, theP); + theC2d = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(), + BCurve->LastParameter()); + } + else + { + BCurve->SetPole(BCurve->NbPoles(), theP); + theC2d = new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(), + BCurve->LastParameter()); + } + } + +} diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx index 1889738d79..0f2f7d5db8 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx @@ -36,6 +36,10 @@ #include #include +#ifdef OCCT_DEBUG +#include +static Standard_Boolean AffichSpine = Standard_False; +#endif //======================================================================= //function : BRepOffsetAPI_MakeOffset @@ -183,8 +187,20 @@ static void BuildDomains(TopoDS_Face& myFace, StdFail_NotDone::Raise ("BRepOffsetAPI_MakeOffset : Build Domains"); } TopTools_ListOfShape Faces; +#ifdef OCCT_DEBUG + Standard_Integer ns = 0; +#endif for (; FR.More(); FR.Next()) { Faces.Append(FR.Current()); +#ifdef OCCT_DEBUG + if(AffichSpine) + { + char name[32]; + ns++; + sprintf(name, "FR%d",ns); + BRepTools::Write(FR.Current(), name); + } +#endif } //=========================================== diff --git a/src/Bisector/Bisector_Bisec.cxx b/src/Bisector/Bisector_Bisec.cxx index 35c4f038b3..6c45534aff 100644 --- a/src/Bisector/Bisector_Bisec.cxx +++ b/src/Bisector/Bisector_Bisec.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -31,21 +32,27 @@ #include #include #include +#include -/* +#ifdef OCCT_DEBUG +//#define DRAW +#ifdef DRAW #include -static char tname[100]; -static Standard_CString name = tname ; +#pragma comment(lib, "TKDraw.lib") +static char name[100]; static Standard_Integer nbb = 0; -*/ +static Standard_Boolean Affich = Standard_False; +#endif +#endif + static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C, - Standard_Real U, - Standard_Real& R); + Standard_Real U, + Standard_Real& R); static void ReplaceByLineIfIsToSmall (Handle(Geom2d_Curve)& Bis, - Standard_Real& UFirst, - Standard_Real& ULast); + Standard_Real& UFirst, + Standard_Real& ULast); //============================================================================= //function : Empty Constructor //============================================================================= @@ -66,48 +73,97 @@ Bisector_Bisec::Bisector_Bisec() //=========================================================================== void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , - const Handle(Geom2d_Curve)& asecondcurve , - const gp_Pnt2d& apoint , - const gp_Vec2d& afirstvector , - const gp_Vec2d& asecondvector , - const Standard_Real adirection , - const Standard_Real tolerance , - const Standard_Boolean oncurve ) + const Handle(Geom2d_Curve)& asecondcurve , + const gp_Pnt2d& apoint , + const gp_Vec2d& afirstvector , + const gp_Vec2d& asecondvector , + const Standard_Real adirection , + const Standard_Real tolerance , + const Standard_Boolean oncurve ) { Handle(Standard_Type) Type1 = afirstcurve ->DynamicType(); Handle(Standard_Type) Type2 = asecondcurve->DynamicType(); Handle(Bisector_Curve) Bis; Standard_Real UFirst,ULast; - + if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) { Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve) - ->BasisCurve()->DynamicType(); + ->BasisCurve()->DynamicType(); } if (Type2 == STANDARD_TYPE(Geom2d_TrimmedCurve)) { Type2 = Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve) - ->BasisCurve()->DynamicType(); + ->BasisCurve()->DynamicType(); + } + + Handle(Geom2d_Curve) afirstcurve1 = afirstcurve; + Handle(Geom2d_Curve) asecondcurve1 = asecondcurve; + + if(Type1 == STANDARD_TYPE(Geom2d_BSplineCurve)) + { + Handle(Geom2d_BSplineCurve) aBS; + if(afirstcurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) + { + aBS = Handle(Geom2d_BSplineCurve)::DownCast(Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve) + ->BasisCurve()); + } + else + { + aBS = Handle(Geom2d_BSplineCurve)::DownCast(afirstcurve); + } + if(aBS->Degree() == 1 && aBS->NbPoles() == 2) + { + if(aBS->Pole(1).Distance(aBS->Pole(2)) < 1.e-4) + { + afirstcurve1 = GCE2d_MakeSegment(aBS->Pole(1), aBS->Pole(2)); + Type1 = STANDARD_TYPE(Geom2d_Line); + } + } + } + + + if(Type2 == STANDARD_TYPE(Geom2d_BSplineCurve)) + { + Handle(Geom2d_BSplineCurve) aBS; + if(asecondcurve->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) + { + aBS = Handle(Geom2d_BSplineCurve)::DownCast(Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve) + ->BasisCurve()); + } + else + { + aBS = Handle(Geom2d_BSplineCurve)::DownCast(asecondcurve); + } + if(aBS->Degree() == 1 && aBS->NbPoles() == 2) + { + if(aBS->Pole(1).Distance(aBS->Pole(2)) < 1.e-4) + { + asecondcurve1 = GCE2d_MakeSegment(aBS->Pole(1), aBS->Pole(2)); + Type2 = STANDARD_TYPE(Geom2d_Line); + } + } } if ( (Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) && - (Type2 == STANDARD_TYPE(Geom2d_Circle) || Type2 == STANDARD_TYPE(Geom2d_Line)) ) { + (Type2 == STANDARD_TYPE(Geom2d_Circle) || Type2 == STANDARD_TYPE(Geom2d_Line)) ) + { //------------------------------------------------------------------ // Analytic Bissectrice. //------------------------------------------------------------------ - Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna(); - BisAna->Perform(afirstcurve , - asecondcurve , - apoint , - afirstvector , - asecondvector , - adirection , - tolerance , - oncurve ); - UFirst = BisAna->ParameterOfStartPoint(); - ULast = BisAna->ParameterOfEndPoint(); - Bis = BisAna; + Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna(); + BisAna->Perform(afirstcurve1 , + asecondcurve1 , + apoint , + afirstvector , + asecondvector , + adirection , + tolerance , + oncurve ); + UFirst = BisAna->ParameterOfStartPoint(); + ULast = BisAna->ParameterOfEndPoint(); + Bis = BisAna; } else { - Standard_Boolean IsLine = Standard_False; + Standard_Boolean IsLine = Standard_False; if (oncurve) { gp_Dir2d Fd(afirstvector); @@ -115,7 +171,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , //if (Fd.Dot(Sd) < Precision::Angular() - 1.) { //if (Fd.Dot(Sd) < 10*Precision::Angular() - 1.) //patch if (Fd.Dot(Sd) < Sqrt(2.*Precision::Angular()) - 1.) - IsLine = Standard_True; + IsLine = Standard_True; } if (IsLine) { //------------------------------------------------------------------ @@ -125,7 +181,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(apoint); Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); Handle (Geom2d_TrimmedCurve) - BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite()); + BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite()); Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); BisAna->Init(BisL); UFirst = BisAna->ParameterOfStartPoint(); @@ -137,58 +193,78 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , // Bissectrice algo //------------------------------------------------------------------- Handle(Bisector_BisecCC) BisCC = new Bisector_BisecCC(); - BisCC -> Perform(asecondcurve, - afirstcurve , - adirection , - adirection , - apoint); + BisCC -> Perform(asecondcurve1, + afirstcurve1 , + adirection , + adirection , + apoint); if (BisCC -> IsEmpty()) { - // bissectrice is empty. a point is projected at the end of the guide curve. - // Construction of a false bissectrice. -// modified by NIZHNY-EAP Mon Feb 21 12:00:13 2000 ___BEGIN___ - gp_Dir2d dir1(afirstvector), dir2(asecondvector); - Standard_Real - Nx = - dir1.X() - dir2.X(), - Ny = - dir1.Y() - dir2.Y(); - if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) { - Nx = - afirstvector.Y(); - Ny = afirstvector.X(); - } - //gp_Dir2d N ( - adirection*afirstvector.Y(), adirection*afirstvector.X()); - gp_Dir2d N ( adirection*Nx, adirection*Ny); -// modified by NIZHNY-EAP Mon Feb 21 12:00:19 2000 ___END___ - - Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(apoint); - Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); - Handle (Geom2d_TrimmedCurve) - BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite()); - Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); - BisAna->Init(BisL); - UFirst = BisAna->ParameterOfStartPoint(); - ULast = BisAna->ParameterOfEndPoint(); - Bis = BisAna; + // bissectrice is empty. a point is projected at the end of the guide curve. + // Construction of a false bissectrice. + // modified by NIZHNY-EAP Mon Feb 21 12:00:13 2000 ___BEGIN___ + gp_Pnt2d aP1 = afirstcurve1->Value(afirstcurve1->LastParameter()); + gp_Pnt2d aP2 = asecondcurve1->Value(asecondcurve1->FirstParameter()); + gp_Pnt2d aPm(.5*(aP1.XY()+aP2.XY())); + Standard_Real Nx, Ny; + if(aPm.Distance(apoint) > 10.*Precision::Confusion()) + { + Nx = apoint.X() - aPm.X(); + Ny = apoint.Y() - aPm.Y(); + if(adirection < 0) + { + Nx = -Nx; + Ny = -Ny; + } + } + else + { + gp_Dir2d dir1(afirstvector), dir2(asecondvector); + Nx = - dir1.X() - dir2.X(), + Ny = - dir1.Y() - dir2.Y(); + if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) { + Nx = -afirstvector.Y(); + Ny = afirstvector.X(); + } + } + gp_Dir2d N ( adirection*Nx, adirection*Ny); + // modified by NIZHNY-EAP Mon Feb 21 12:00:19 2000 ___END___ + + Handle (Geom2d_CartesianPoint) PG = new Geom2d_CartesianPoint(apoint); + Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); + Handle (Geom2d_TrimmedCurve) + BisL = new Geom2d_TrimmedCurve (L,0,Precision::Infinite()); + Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); + BisAna->Init(BisL); + UFirst = BisAna->ParameterOfStartPoint(); + ULast = BisAna->ParameterOfEndPoint(); + Bis = BisAna; } else { - UFirst = BisCC->FirstParameter(); - ULast = BisCC->LastParameter (); - Bis = BisCC; - ReplaceByLineIfIsToSmall(Bis,UFirst,ULast); + UFirst = BisCC->FirstParameter(); + ULast = BisCC->LastParameter (); + Bis = BisCC; + ReplaceByLineIfIsToSmall(Bis,UFirst,ULast); } } } + UFirst = Max(UFirst, Bis->FirstParameter()); + ULast = Min(ULast, Bis->LastParameter()); thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast); - -/* - sprintf( name, "c1_%d", ++nbb ); - DrawTrSurf::Set( name, afirstcurve ); - sprintf( name, "c2_%d", nbb ); - DrawTrSurf::Set( name, asecondcurve ); - sprintf( name, "p%d", nbb ); - DrawTrSurf::Set( name, apoint ); - sprintf( name, "b%d", nbb ); - DrawTrSurf::Set( name, thebisector ); -*/ +#ifdef DRAW + if(Affich) + { + sprintf( name, "c1_%d", ++nbb ); + DrawTrSurf::Set( name, afirstcurve ); + sprintf( name, "c2_%d", nbb ); + DrawTrSurf::Set( name, asecondcurve ); + sprintf( name, "p%d", nbb ); + DrawTrSurf::Set( name, apoint ); + sprintf( name, "b%d", nbb ); + DrawTrSurf::Set( name, thebisector ); + } +#endif + } //=========================================================================== @@ -204,13 +280,13 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , //=========================================================================== void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , - const Handle(Geom2d_Point)& asecondpoint , - const gp_Pnt2d& apoint , - const gp_Vec2d& afirstvector , - const gp_Vec2d& asecondvector, - const Standard_Real adirection , - const Standard_Real tolerance , - const Standard_Boolean oncurve ) + const Handle(Geom2d_Point)& asecondpoint , + const gp_Pnt2d& apoint , + const gp_Vec2d& afirstvector , + const gp_Vec2d& asecondvector, + const Standard_Real adirection , + const Standard_Real tolerance , + const Standard_Boolean oncurve ) { //gp_Pnt2d SecondPnt = asecondpoint->Pnt2d(); @@ -220,7 +296,7 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) { Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(afirstcurve) - ->BasisCurve()->DynamicType(); + ->BasisCurve()->DynamicType(); } if ( Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) { @@ -229,13 +305,13 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , //------------------------------------------------------------------ Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna(); BisAna -> Perform (afirstcurve , - asecondpoint , - apoint , - afirstvector , - asecondvector , - adirection , - tolerance , - oncurve ); + asecondpoint , + apoint , + afirstvector , + asecondvector , + adirection , + tolerance , + oncurve ); UFirst = BisAna->ParameterOfStartPoint(); ULast = BisAna->ParameterOfEndPoint(); Bis = BisAna; @@ -243,11 +319,11 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , else { Standard_Boolean IsLine = Standard_False; Standard_Real RC = Precision::Infinite(); - + if (oncurve) { if (Bisector::IsConvex(afirstcurve,adirection) || - IsMaxRC(afirstcurve,afirstcurve->LastParameter(),RC)) { - IsLine = Standard_True; + IsMaxRC(afirstcurve,afirstcurve->LastParameter(),RC)) { + IsLine = Standard_True; } } if (IsLine) { @@ -269,66 +345,73 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , //------------------------------------------------------------------- Handle(Bisector_BisecPC) BisPC = new Bisector_BisecPC(); Handle(Geom2d_Curve) afirstcurvereverse = afirstcurve->Reversed(); - + BisPC -> Perform(afirstcurvereverse , - asecondpoint->Pnt2d(), - - adirection ); -// Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin + asecondpoint->Pnt2d(), + - adirection ); + // Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin if (BisPC -> IsEmpty()) { - gp_Dir2d dir1(afirstvector), dir2(asecondvector); - Standard_Real - Nx = - dir1.X() - dir2.X(), - Ny = - dir1.Y() - dir2.Y(); - if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) { - Nx = - afirstvector.Y(); - Ny = afirstvector.X(); - } -// gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); - gp_Dir2d N ( adirection*Nx, adirection*Ny); - Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); - Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC); - Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); - BisAna->Init(BisL); - UFirst = BisAna->ParameterOfStartPoint(); - ULast = BisAna->ParameterOfEndPoint(); - Bis = BisAna; + gp_Dir2d dir1(afirstvector), dir2(asecondvector); + Standard_Real + Nx = - dir1.X() - dir2.X(), + Ny = - dir1.Y() - dir2.Y(); + if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) { + Nx = - afirstvector.Y(); + Ny = afirstvector.X(); + } + // gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); + gp_Dir2d N ( adirection*Nx, adirection*Ny); + Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); + Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC); + Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); + BisAna->Init(BisL); + UFirst = BisAna->ParameterOfStartPoint(); + ULast = BisAna->ParameterOfEndPoint(); + Bis = BisAna; } else { -// Modified by Sergey KHROMOV - Wed Mar 6 17:01:08 2002 End - UFirst = BisPC->Parameter(apoint); - ULast = BisPC->LastParameter(); - if(UFirst >= ULast) - { - //Standard_Real t = .9; - //UFirst = (1. - t) * BisPC->FirstParameter() + t * ULast; - //Extrapolate by line - //gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); - gp_Vec2d V( BisPC->Value(BisPC->FirstParameter()), BisPC->Value(ULast) ); - gp_Dir2d N( V ); - Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); - Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC); - Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); - BisAna->Init(BisL); - UFirst = BisAna->ParameterOfStartPoint(); - ULast = BisAna->ParameterOfEndPoint(); - Bis = BisAna; - } - else - Bis = BisPC; + // Modified by Sergey KHROMOV - Wed Mar 6 17:01:08 2002 End + UFirst = BisPC->Parameter(apoint); + ULast = BisPC->LastParameter(); + if(UFirst >= ULast) + { + //Standard_Real t = .9; + //UFirst = (1. - t) * BisPC->FirstParameter() + t * ULast; + //Extrapolate by line + //gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); + gp_Vec2d V( BisPC->Value(BisPC->FirstParameter()), BisPC->Value(ULast) ); + gp_Dir2d N( V ); + Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); + Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC); + Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); + BisAna->Init(BisL); + UFirst = BisAna->ParameterOfStartPoint(); + ULast = BisAna->ParameterOfEndPoint(); + Bis = BisAna; + } + else + Bis = BisPC; } } } + if(UFirst < Bis->FirstParameter()) + UFirst = Bis->FirstParameter(); + if(ULast > Bis->LastParameter()) + ULast = Bis->LastParameter(); thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast); -/* +#ifdef DRAW + if(Affich) + { sprintf( name, "c1_%d", ++nbb ); DrawTrSurf::Set( name, afirstcurve ); sprintf( name, "c2_%d", nbb ); - DrawTrSurf::Set( name, SecondPnt ); + DrawTrSurf::Set( name, asecondpoint->Pnt2d() ); sprintf( name, "p%d", nbb ); DrawTrSurf::Set( name, apoint ); sprintf( name, "b%d", nbb ); DrawTrSurf::Set( name, thebisector ); -*/ + } +#endif } //=========================================================================== @@ -344,13 +427,13 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve , //=========================================================================== void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint , - const Handle(Geom2d_Curve)& asecondcurve , - const gp_Pnt2d& apoint , - const gp_Vec2d& afirstvector , - const gp_Vec2d& asecondvector, - const Standard_Real adirection , - const Standard_Real tolerance , - const Standard_Boolean oncurve ) + const Handle(Geom2d_Curve)& asecondcurve , + const gp_Pnt2d& apoint , + const gp_Vec2d& afirstvector , + const gp_Vec2d& asecondvector, + const Standard_Real adirection , + const Standard_Real tolerance , + const Standard_Boolean oncurve ) { //gp_Pnt2d FirstPnt = afirstpoint->Pnt2d(); @@ -358,38 +441,38 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint , Handle(Bisector_Curve) Bis; Handle(Standard_Type) Type1 = asecondcurve ->DynamicType(); Standard_Real UFirst,ULast; - + if (Type1 == STANDARD_TYPE(Geom2d_TrimmedCurve)) { Type1 = Handle(Geom2d_TrimmedCurve)::DownCast(asecondcurve) - ->BasisCurve()->DynamicType(); + ->BasisCurve()->DynamicType(); } - + if ( Type1 == STANDARD_TYPE(Geom2d_Circle) || Type1 == STANDARD_TYPE(Geom2d_Line)) { //------------------------------------------------------------------ // Analytic Bissectrice. //------------------------------------------------------------------ Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna(); BisAna -> Perform (afirstpoint , - asecondcurve , - apoint , - afirstvector , - asecondvector , - adirection , - tolerance , - oncurve ); + asecondcurve , + apoint , + afirstvector , + asecondvector , + adirection , + tolerance , + oncurve ); UFirst = BisAna->ParameterOfStartPoint(); ULast = BisAna->ParameterOfEndPoint(); Bis = BisAna; } else { -// Standard_Real UPoint = 0.; + // Standard_Real UPoint = 0.; Standard_Boolean IsLine = Standard_False; Standard_Real RC = Precision::Infinite(); - + if (oncurve) { if (Bisector::IsConvex(asecondcurve, adirection) || - IsMaxRC(asecondcurve,asecondcurve->FirstParameter(),RC)) { - IsLine = Standard_True; + IsMaxRC(asecondcurve,asecondcurve->FirstParameter(),RC)) { + IsLine = Standard_True; } } if (IsLine) { @@ -411,62 +494,69 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint , //------------------------------------------------------------------- Handle(Bisector_BisecPC) BisPC = new Bisector_BisecPC(); BisPC -> Perform(asecondcurve , - afirstpoint->Pnt2d(), - adirection ); -// Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin + afirstpoint->Pnt2d(), + adirection ); + // Modified by Sergey KHROMOV - Thu Feb 21 16:49:54 2002 Begin if (BisPC -> IsEmpty()) { - gp_Dir2d dir1(afirstvector), dir2(asecondvector); - Standard_Real - Nx = - dir1.X() - dir2.X(), - Ny = - dir1.Y() - dir2.Y(); - if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) { - Nx = - afirstvector.Y(); - Ny = afirstvector.X(); - } -// gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); - gp_Dir2d N ( adirection*Nx, adirection*Ny); - Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); - Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC); - Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); - BisAna->Init(BisL); - UFirst = BisAna->ParameterOfStartPoint(); - ULast = BisAna->ParameterOfEndPoint(); - Bis = BisAna; + gp_Dir2d dir1(afirstvector), dir2(asecondvector); + Standard_Real + Nx = - dir1.X() - dir2.X(), + Ny = - dir1.Y() - dir2.Y(); + if (Abs(Nx) <= gp::Resolution() && Abs(Ny) <= gp::Resolution()) { + Nx = - afirstvector.Y(); + Ny = afirstvector.X(); + } + // gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); + gp_Dir2d N ( adirection*Nx, adirection*Ny); + Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); + Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve(L,0,RC); + Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); + BisAna->Init(BisL); + UFirst = BisAna->ParameterOfStartPoint(); + ULast = BisAna->ParameterOfEndPoint(); + Bis = BisAna; } else { -// Modified by Sergey KHROMOV - Thu Feb 21 16:49:58 2002 End - UFirst = BisPC->Parameter(apoint); - ULast = BisPC->LastParameter(); - if(UFirst >= ULast) - { - //Extrapolate by line - //gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); - gp_Vec2d V( BisPC->Value(BisPC->FirstParameter()), BisPC->Value(ULast) ); - gp_Dir2d N( V ); - Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); - Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC); - Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); - BisAna->Init(BisL); - UFirst = BisAna->ParameterOfStartPoint(); - ULast = BisAna->ParameterOfEndPoint(); - Bis = BisAna; - } - else - Bis = BisPC; + // Modified by Sergey KHROMOV - Thu Feb 21 16:49:58 2002 End + UFirst = BisPC->Parameter(apoint); + ULast = BisPC->LastParameter(); + if(UFirst >= ULast) + { + //Extrapolate by line + //gp_Dir2d N ( -adirection*afirstvector.Y(), adirection*afirstvector.X()); + gp_Vec2d V( BisPC->Value(BisPC->FirstParameter()), BisPC->Value(ULast) ); + gp_Dir2d N( V ); + Handle (Geom2d_Line) L = new Geom2d_Line (apoint,N); + Handle (Geom2d_TrimmedCurve) BisL = new Geom2d_TrimmedCurve (L,0,RC); + Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna (); + BisAna->Init(BisL); + UFirst = BisAna->ParameterOfStartPoint(); + ULast = BisAna->ParameterOfEndPoint(); + Bis = BisAna; + } + else + Bis = BisPC; } } } + + UFirst = Max(UFirst, Bis->FirstParameter()); + ULast = Min(ULast, Bis->LastParameter()); thebisector = new Geom2d_TrimmedCurve(Bis,UFirst,ULast); -/* +#ifdef DRAW + if(Affich) + { sprintf( name, "c1_%d", ++nbb ); - DrawTrSurf::Set( name, FirstPnt ); + DrawTrSurf::Set( name, afirstpoint->Pnt2d() ); sprintf( name, "c2_%d", nbb ); DrawTrSurf::Set( name, asecondcurve ); sprintf( name, "p%d", nbb ); DrawTrSurf::Set( name, apoint ); sprintf( name, "b%d", nbb ); DrawTrSurf::Set( name, thebisector ); -*/ + } +#endif + } //=========================================================================== @@ -481,29 +571,31 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint , //=========================================================================== void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint , - const Handle(Geom2d_Point)& asecondpoint , - const gp_Pnt2d& apoint , - const gp_Vec2d& afirstvector , - const gp_Vec2d& asecondvector, - const Standard_Real adirection , - const Standard_Real tolerance , - const Standard_Boolean oncurve ) + const Handle(Geom2d_Point)& asecondpoint , + const gp_Pnt2d& apoint , + const gp_Vec2d& afirstvector , + const gp_Vec2d& asecondvector, + const Standard_Real adirection , + const Standard_Real tolerance , + const Standard_Boolean oncurve ) { Handle(Bisector_BisecAna) Bis = new Bisector_BisecAna(); Bis -> Perform (afirstpoint , - asecondpoint , - apoint , - afirstvector , - asecondvector , - adirection , - tolerance , - oncurve ); + asecondpoint , + apoint , + afirstvector , + asecondvector , + adirection , + tolerance , + oncurve ); thebisector = new Geom2d_TrimmedCurve(Bis, - Bis->ParameterOfStartPoint(), - Bis->ParameterOfEndPoint()); + Bis->ParameterOfStartPoint(), + Bis->ParameterOfEndPoint()); -/* +#ifdef DRAW + if(Affich) + { sprintf( name, "c1_%d", ++nbb ); DrawTrSurf::Set( name, afirstpoint->Pnt2d() ); sprintf( name, "c2_%d", nbb ); @@ -512,7 +604,8 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Point)& afirstpoint , DrawTrSurf::Set( name, apoint ); sprintf( name, "b%d", nbb ); DrawTrSurf::Set( name, thebisector ); -*/ + } +#endif } //============================================================================= @@ -539,8 +632,8 @@ const Handle(Geom2d_TrimmedCurve)& Bisector_Bisec::ChangeValue() // replaced by a half-straight. //============================================================================= static void ReplaceByLineIfIsToSmall (Handle(Geom2d_Curve)& Bis, - Standard_Real& UFirst, - Standard_Real& ULast ) + Standard_Real& UFirst, + Standard_Real& ULast ) { if (Abs(ULast - UFirst) > 2.*Precision::PConfusion()*10.) return; //patch @@ -568,8 +661,8 @@ static void ReplaceByLineIfIsToSmall (Handle(Geom2d_Curve)& Bis, //purpose : //============================================================================= static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C, - Standard_Real U, - Standard_Real& R) + Standard_Real U, + Standard_Real& R) { Standard_Real KF,KL; Standard_Real US = C->FirstParameter(); @@ -583,7 +676,7 @@ static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C, Norm2 = D1.SquareMagnitude();; if (Norm2 < gp::Resolution()) { KF = 0.0;} else { KF = Abs(D1^D2)/(Norm2*sqrt(Norm2));} - + C->D2(UL,P,D1,D2); Norm2 = D1.SquareMagnitude();; if (Norm2 < gp::Resolution()) { KL = 0.0;} diff --git a/src/Bisector/Bisector_BisecCC.cxx b/src/Bisector/Bisector_BisecCC.cxx index ce9c28b3fc..165d4c5dfb 100644 --- a/src/Bisector/Bisector_BisecCC.cxx +++ b/src/Bisector/Bisector_BisecCC.cxx @@ -46,24 +46,24 @@ static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P, - const Handle(Geom2d_Curve)& C, - Standard_Real& theParam); + const Handle(Geom2d_Curve)& C, + Standard_Real& theParam); static Standard_Real Curvature (const Handle(Geom2d_Curve)& C, - Standard_Real U, - Standard_Real Tol) ; + Standard_Real U, + Standard_Real Tol) ; static Standard_Boolean TestExtension (const Handle(Geom2d_Curve)& C1, - const Handle(Geom2d_Curve)& C2, - const Standard_Integer Start_End); + const Handle(Geom2d_Curve)& C2, + const Standard_Integer Start_End); static Standard_Boolean DiscretPar(const Standard_Real DU, - const Standard_Real EpsMin, - const Standard_Real EpsMax, - const Standard_Integer NbMin, - const Standard_Integer NbMax, - Standard_Real& Eps, - Standard_Integer& Nb); + const Standard_Real EpsMin, + const Standard_Real EpsMax, + const Standard_Integer NbMin, + const Standard_Integer NbMax, + Standard_Real& Eps, + Standard_Integer& Nb); //============================================================================= //function : @@ -80,11 +80,11 @@ Bisector_BisecCC::Bisector_BisecCC() //purpose : //============================================================================= Bisector_BisecCC::Bisector_BisecCC(const Handle(Geom2d_Curve)& Cu1, - const Handle(Geom2d_Curve)& Cu2, - const Standard_Real Side1, - const Standard_Real Side2, - const gp_Pnt2d& Origin, - const Standard_Real DistMax) + const Handle(Geom2d_Curve)& Cu2, + const Standard_Real Side1, + const Standard_Real Side2, + const gp_Pnt2d& Origin, + const Standard_Real DistMax) { Perform (Cu1,Cu2,Side1,Side2,Origin,DistMax); } @@ -94,11 +94,11 @@ Bisector_BisecCC::Bisector_BisecCC(const Handle(Geom2d_Curve)& Cu1, //purpose : //============================================================================= void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1, - const Handle(Geom2d_Curve)& Cu2, - const Standard_Real Side1, - const Standard_Real Side2, - const gp_Pnt2d& Origin, - const Standard_Real DistMax) + const Handle(Geom2d_Curve)& Cu2, + const Standard_Real Side1, + const Standard_Real Side2, + const gp_Pnt2d& Origin, + const Standard_Real DistMax) { isEmpty = Standard_False; distMax = DistMax; @@ -122,7 +122,6 @@ void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1, // Calculate first point of the polygon. //--------------------------------------------- Standard_Boolean isProjDone = ProjOnCurve (Origin,curve1, U); - P = ValueByInt (U,UC1,UC2,Dist); if(!isProjDone) { @@ -130,6 +129,20 @@ void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1, return; } + P = ValueByInt (U,UC1,UC2,Dist); + if(Dist < Precision::Confusion()) + { + gp_Pnt2d aP1 = curve1->Value(UC1); + gp_Pnt2d aP2 = curve2->Value(UC2); + Standard_Real dp = (aP1.Distance(P)+aP2.Distance(P)); + Standard_Real dorig = (aP1.Distance(Origin)+aP2.Distance(Origin)); + if(dp < dorig) + { + isEmpty = Standard_True; + return; + } + } + if (Dist < Precision::Infinite()) { //---------------------------------------------------- // the parameter of the origin point gives a point @@ -363,11 +376,11 @@ Handle(Geom2d_Geometry) Bisector_BisecCC::Copy() const Handle(Bisector_BisecCC) Bisector_BisecCC::ChangeGuide() const { Handle(Bisector_BisecCC) C = new Bisector_BisecCC(); - + C -> Curve (1, curve2) ; C -> Curve (2, curve1); C -> Sign (1, sign2 ) ; C -> Sign (2, sign1 ); C -> IsConvex (1, isConvex2); C -> IsConvex (2, isConvex1); - + //------------------------------------------------------------------------- // Construction of the new polygon from the initial one. // inversion of PointOnBis and Calculation of new parameters on the bissectrice. @@ -380,8 +393,8 @@ Handle(Bisector_BisecCC) Bisector_BisecCC::ChangeGuide() const for (Standard_Integer i = myPolygon.Length(); i >=1; i--) { Bisector_PointOnBis P = myPolygon.Value(i); Bisector_PointOnBis NewP (P.ParamOnC2(), P.ParamOnC1(), - P.ParamOnC2(), P.Distance (), - P.Point()); + P.ParamOnC2(), P.Distance (), + P.Point()); Poly.Append (NewP); } } @@ -389,15 +402,15 @@ Handle(Bisector_BisecCC) Bisector_BisecCC::ChangeGuide() const for (Standard_Integer i = 1; i <= myPolygon.Length(); i ++) { Bisector_PointOnBis P = myPolygon.Value(i); Bisector_PointOnBis NewP (P.ParamOnC2(), P.ParamOnC1(), - P.ParamOnC2(), P.Distance (), - P.Point()); + P.ParamOnC2(), P.Distance (), + P.Point()); Poly.Append (NewP); } } C -> Polygon (Poly); C -> FirstParameter (Poly.First().ParamOnBis()); C -> LastParameter (Poly.Last() .ParamOnBis()); - + return C; } @@ -429,7 +442,7 @@ Standard_Boolean Bisector_BisecCC::IsCN (const Standard_Integer N) const //============================================================================= Standard_Real Bisector_BisecCC::FirstParameter() const { - return startIntervals.First(); + return startIntervals.First(); } //============================================================================= @@ -438,7 +451,7 @@ Standard_Real Bisector_BisecCC::FirstParameter() const //============================================================================= Standard_Real Bisector_BisecCC::LastParameter() const { - return endIntervals.Last(); + return endIntervals.Last(); } //============================================================================= @@ -475,7 +488,7 @@ Standard_Real Bisector_BisecCC::IntervalFirst(const Standard_Integer Index) cons { return startIntervals.Value(Index); } - + //============================================================================= //function : IntervalLast //purpose : @@ -510,7 +523,7 @@ Standard_Boolean Bisector_BisecCC::IsClosed() const { if (curve1->IsClosed()) { if (startIntervals.First() == curve1->FirstParameter() && - endIntervals .Last () == curve1->LastParameter () ) + endIntervals .Last () == curve1->LastParameter () ) return Standard_True; } return Standard_False; @@ -531,8 +544,8 @@ Standard_Boolean Bisector_BisecCC::IsPeriodic() const //purpose : //============================================================================= static Standard_Real Curvature (const Handle(Geom2d_Curve)& C, - Standard_Real U, - Standard_Real Tol) + Standard_Real U, + Standard_Real Tol) { Standard_Real K1; gp_Vec2d D1,D2; @@ -569,9 +582,9 @@ static Standard_Real Curvature (const Handle(Geom2d_Curve)& C, // //============================================================================= gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U, - Standard_Real& U1, - Standard_Real& U2, - Standard_Real& Dist) const + Standard_Real& U1, + Standard_Real& U2, + Standard_Real& Dist) const { gp_Vec2d T; @@ -619,11 +632,11 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U, //--------------------------------------------------------------- gp_Pnt2d P1; gp_Vec2d T1; - Standard_Real EpsH = 1.E-8; - Standard_Real EpsH100 = 1.E-6; + Standard_Real EpsH = 1.E-9; + Standard_Real EpsH100 = 1.E-7; curve1->D1 (U1,P1,T1); gp_Vec2d N1(T1.Y(), - T1.X()); - + if ((VMax - VMin) < Precision::PConfusion()) { U2 = VInit; } @@ -637,14 +650,14 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U, else { math_BissecNewton SolNew (H,VMin - EpsH100,VMax + EpsH100,EpsH,10); if (SolNew.IsDone()) { - U2 = SolNew.Root(); + U2 = SolNew.Root(); } else { - math_FunctionRoot SolRoot (H,VInit,EpsH,VMin - EpsH100,VMax + EpsH100); - if (SolRoot.IsDone()) { - U2 = SolRoot.Root(); - } - else { Valid = Standard_False;} + math_FunctionRoot SolRoot (H,VInit,EpsH,VMin - EpsH100,VMax + EpsH100); + if (SolRoot.IsDone()) { + U2 = SolRoot.Root(); + } + else { Valid = Standard_False;} } } } @@ -667,8 +680,8 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U, Valid = Standard_False; } else { - PBis = P1.Translated(- (0.5*SquareP2P1/N1P2P1)*N1); - Dist = P1.SquareDistance(PBis); + PBis = P1.Translated(- (0.5*SquareP2P1/N1P2P1)*N1); + Dist = P1.SquareDistance(PBis); } } @@ -691,20 +704,20 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U, Geom2dAdaptor_Curve ANorLi(NorLi); //------------------------------------------------------------------------- Geom2dInt_GInter Intersect(ABisPC,ANorLi, - Precision::Confusion(),Precision::Confusion()); + Precision::Confusion(),Precision::Confusion()); //------------------------------------------------------------------------- if (Intersect.IsDone() && !Intersect.IsEmpty()) { for (Standard_Integer i = 1; i <= Intersect.NbPoints(); i++) { - if (Intersect.Point(i).ParamOnSecond()*sign1 < Precision::PConfusion()) { - P = Intersect.Point(i).Value(); - if (P.SquareDistance(P1) < DMin) { - DMin = P.SquareDistance(P1); - PBis = P; - U2 = BisPC->LinkBisCurve(Intersect.Point(i).ParamOnFirst()); - Dist = DMin; - } - } + if (Intersect.Point(i).ParamOnSecond()*sign1 < Precision::PConfusion()) { + P = Intersect.Point(i).Value(); + if (P.SquareDistance(P1) < DMin) { + DMin = P.SquareDistance(P1); + PBis = P; + U2 = BisPC->LinkBisCurve(Intersect.Point(i).ParamOnFirst()); + Dist = DMin; + } + } } } } @@ -725,9 +738,9 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U, // normal at this point. //============================================================================= gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, - Standard_Real& U1, - Standard_Real& U2, - Standard_Real& Dist) const + Standard_Real& U1, + Standard_Real& U2, + Standard_Real& Dist) const { //------------------------------------------------------------------ // Return point, tangent, normal on C1 at parameter U. @@ -738,7 +751,7 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, gp_Vec2d Tan1,Tan2; curve1->D1(U1,P1,Tan1); gp_Vec2d N1( Tan1.Y(), - Tan1.X()); - + //-------------------------------------------------------------------------- // test confusion of P1 with extremity of curve2. //-------------------------------------------------------------------------- @@ -777,7 +790,7 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, Standard_Integer NbSamples =20; Standard_Real UFirstOnC2 = curve2->FirstParameter(); Standard_Real ULastOnC2 = curve2->LastParameter(); - + if (!myPolygon.IsEmpty()){ if (sign1 == sign2) { ULastOnC2 = myPolygon.Last().ParamOnC2();} else { UFirstOnC2 = myPolygon.Last().ParamOnC2();} @@ -792,10 +805,10 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, Bisector_FunctionH H (curve2,P1,sign1*sign2*Tan1); math_FunctionRoots SolRoot (H, - UFirstOnC2, - ULastOnC2 , - NbSamples, - EpsX,EpsH,EpsH); + UFirstOnC2, + ULastOnC2 , + NbSamples, + EpsX,EpsH,EpsH); if (SolRoot.IsDone()) { for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) { USol = SolRoot.Value(j); @@ -806,60 +819,60 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, // Test if the solution is at the proper side of the curves. if (N1P2P1*sign1 > 0 ) { - P = P1.Translated(- (0.5*SquareP2P1/N1P2P1)*N1); - DistPP1 = P1.SquareDistance(P); - if (DistPP1 < DMin) { - DMin = DistPP1; - PSol = P; - U2 = USol; - YaSol = Standard_True; - } + P = P1.Translated(- (0.5*SquareP2P1/N1P2P1)*N1); + DistPP1 = P1.SquareDistance(P); + if (DistPP1 < DMin) { + DMin = DistPP1; + PSol = P; + U2 = USol; + YaSol = Standard_True; + } } } } -/* + /* if (!YaSol) { - //-------------------------------------------------------------------- - // Construction de la bisectrice point courbe et de la droite passant - // par P1 et portee par la normale. - //-------------------------------------------------------------------- - Handle(Bisector_BisecPC) BisPC - = new Bisector_BisecPC(curve2,P1,sign2,2*distMax); - //------------------------------- - // Test si la bissectrice existe. - //------------------------------- - if (BisPC->IsEmpty()) { - Dist = Precision::Infinite(); - PSol = P1; - return PSol; - } - - Handle(Geom2d_Line) NorLi = new Geom2d_Line (P1,N1); - Geom2dAdaptor_Curve NorLiAd; - if (sign1 < 0.) {NorLiAd.Load(NorLi,0. ,distMax);} - else {NorLiAd.Load(NorLi,- distMax,0. );} - - //------------------------------------------------------------------------- - Geom2dInt_GInter Intersect(BisPC,NorLiAd, - Precision::Confusion(),Precision::Confusion()); - //------------------------------------------------------------------------- - if (Intersect.IsDone() && !Intersect.IsEmpty()) { - for (Standard_Integer i = 1; i <= Intersect.NbPoints(); i++) { - if (Intersect.Point(i).ParamOnSecond()*sign1< Precision::PConfusion()) { - P = Intersect.Point(i).Value(); - DistPP1 = P.SquareDistance(P1); - if (DistPP1 < DMin) { - DMin = DistPP1; - PSol = P; - U2 = Intersect.Point(i).ParamOnFirst(); - YaSol = Standard_True; - } - } - } - } + //-------------------------------------------------------------------- + // Construction de la bisectrice point courbe et de la droite passant + // par P1 et portee par la normale. + //-------------------------------------------------------------------- + Handle(Bisector_BisecPC) BisPC + = new Bisector_BisecPC(curve2,P1,sign2,2*distMax); + //------------------------------- + // Test si la bissectrice existe. + //------------------------------- + if (BisPC->IsEmpty()) { + Dist = Precision::Infinite(); + PSol = P1; + return PSol; } -*/ + + Handle(Geom2d_Line) NorLi = new Geom2d_Line (P1,N1); + Geom2dAdaptor_Curve NorLiAd; + if (sign1 < 0.) {NorLiAd.Load(NorLi,0. ,distMax);} + else {NorLiAd.Load(NorLi,- distMax,0. );} + + //------------------------------------------------------------------------- + Geom2dInt_GInter Intersect(BisPC,NorLiAd, + Precision::Confusion(),Precision::Confusion()); + //------------------------------------------------------------------------- + if (Intersect.IsDone() && !Intersect.IsEmpty()) { + for (Standard_Integer i = 1; i <= Intersect.NbPoints(); i++) { + if (Intersect.Point(i).ParamOnSecond()*sign1< Precision::PConfusion()) { + P = Intersect.Point(i).Value(); + DistPP1 = P.SquareDistance(P1); + if (DistPP1 < DMin) { + DMin = DistPP1; + PSol = P; + U2 = Intersect.Point(i).ParamOnFirst(); + YaSol = Standard_True; + } + } + } + } + } + */ if (YaSol) { Dist = DMin; @@ -869,7 +882,7 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, P2 = curve2->Value(U2); gp_Vec2d PP1(P1.X() - PSol.X(),P1.Y() - PSol.Y()); gp_Vec2d PP2(P2.X() - PSol.X(),P2.Y() - PSol.Y()); - + //----------------------------------------------- // Dist = product of norms = distance at the square. //----------------------------------------------- @@ -878,18 +891,18 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, } else { if ( !isConvex1 ) { - Standard_Real K1 = Curvature(curve1,U1,Precision::Confusion()); - if (K1 != 0.) { - if (Dist > 1/(K1*K1)) YaSol = Standard_False; - } + Standard_Real K1 = Curvature(curve1,U1,Precision::Confusion()); + if (K1 != 0.) { + if (Dist > 1/(K1*K1)) YaSol = Standard_False; + } } if (YaSol) { - if ( !isConvex2 ) { - Standard_Real K2 = Curvature(curve2,U2,Precision::Confusion()); - if (K2 != 0.) { - if (Dist > 1/(K2*K2)) YaSol = Standard_False; - } - } + if ( !isConvex2 ) { + Standard_Real K2 = Curvature(curve2,U2,Precision::Confusion()); + if (K2 != 0.) { + if (Dist > 1/(K2*K2)) YaSol = Standard_False; + } + } } } } @@ -905,7 +918,7 @@ gp_Pnt2d Bisector_BisecCC::ValueByInt (const Standard_Real U, //purpose : //============================================================================= void Bisector_BisecCC::D0(const Standard_Real U, - gp_Pnt2d& P) const + gp_Pnt2d& P) const { Standard_Real U1,U2,Dist; @@ -917,8 +930,8 @@ void Bisector_BisecCC::D0(const Standard_Real U, //purpose : //============================================================================= void Bisector_BisecCC::D1(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V ) const + gp_Pnt2d& P, + gp_Vec2d& V ) const { V.SetCoord(0.,0.); gp_Vec2d V2,V3; @@ -930,9 +943,9 @@ void Bisector_BisecCC::D1(const Standard_Real U, //purpose : //============================================================================= void Bisector_BisecCC::D2(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2) const + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2) const { V1.SetCoord(0.,0.); V2.SetCoord(0.,0.); @@ -945,10 +958,10 @@ void Bisector_BisecCC::D2(const Standard_Real U, //purpose : //============================================================================= void Bisector_BisecCC::D3(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) const + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const { V1.SetCoord(0.,0.); V2.SetCoord(0.,0.); @@ -961,7 +974,7 @@ void Bisector_BisecCC::D3(const Standard_Real U, //purpose : //============================================================================= gp_Vec2d Bisector_BisecCC::DN(const Standard_Real U, - const Standard_Integer N) const + const Standard_Integer N) const { gp_Pnt2d P; gp_Vec2d V1(0.,0.); @@ -969,12 +982,12 @@ gp_Vec2d Bisector_BisecCC::DN(const Standard_Real U, gp_Vec2d V3(0.,0.); Values (U,N,P,V1,V2,V3); switch (N) { - case 1 : return V1; - case 2 : return V2; - case 3 : return V3; - default: { - Standard_NotImplemented::Raise(); - } + case 1 : return V1; + case 2 : return V2; + case 3 : return V3; + default: { + Standard_NotImplemented::Raise(); + } } return V1; } @@ -1000,11 +1013,11 @@ gp_Vec2d Bisector_BisecCC::DN(const Standard_Real U, // //============================================================================= void Bisector_BisecCC::Values (const Standard_Real U, - const Standard_Integer N, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) const + const Standard_Integer N, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const { V1 = gp_Vec2d(0.,0.); V2 = gp_Vec2d(0.,0.); @@ -1014,7 +1027,7 @@ void Bisector_BisecCC::Values (const Standard_Real U, // curve. //------------------------------------------------------------------------- Standard_Real U0,V0,Dist; - + //----------------------------------------------- // is the polygon reduced to a point or empty? //----------------------------------------------- @@ -1066,16 +1079,16 @@ void Bisector_BisecCC::Values (const Standard_Real U, TvvPuPv = Tvv.Dot(PuPv) ; TvTvv = Tv.Dot(Tvv) ; Standard_Real dHdu = 2*(TuPuPv*(TuuPuPv - TuTu)*TvTv + - TvPuPv*TuTv*TuTu -TuTuu*TvPuPv*TvPuPv); + TvPuPv*TuTv*TuTu -TuTuu*TvPuPv*TvPuPv); Standard_Real dHdv = 2*(TuPuPv*TuTv*TvTv + TvTvv*TuPuPv*TuPuPv - - TvPuPv*(TvvPuPv + TvTv)*TuTu); + TvPuPv*(TvvPuPv + TvTv)*TuTu); //----------------------------- // Calculate dF/du and dF/dv. //----------------------------- Standard_Real NorPuPv,NuPuPv,NorTv; Standard_Real A,B,dAdu,dAdv,dBdu,dBdv,BB; - + NorPuPv = Nor.Dot(PuPv); NuPuPv = Nu .Dot(PuPv); NorTv = Nor.Dot(Tv) ; @@ -1087,7 +1100,7 @@ void Bisector_BisecCC::Values (const Standard_Real U, dBdu = - NuPuPv ; dAdv = TvPuPv; dBdv = - NorTv; - + //--------------------------------------- // F(u,v) = Pu - (A(u,v)/B(u,v))*Nor(u) //---------------------------------------- @@ -1098,7 +1111,7 @@ void Bisector_BisecCC::Values (const Standard_Real U, else { gp_Vec2d dFdu = Tu - (dAdu/B - dBdu*A/BB)*Nor - (A/B)*Nu; gp_Vec2d dFdv = ( - dAdv/B + dBdv*A/BB)*Nor ; - + if (Abs(dHdv) > gp::Resolution()) { V1 = dFdu + dFdv*( - dHdu / dHdv ); } @@ -1115,10 +1128,10 @@ void Bisector_BisecCC::Values (const Standard_Real U, // by tangence of the curve. //============================================================================ gp_Pnt2d Bisector_BisecCC::Extension (const Standard_Real U, - Standard_Real& U1, - Standard_Real& U2, - Standard_Real& Dist, - gp_Vec2d& T ) const + Standard_Real& U1, + Standard_Real& U2, + Standard_Real& Dist, + gp_Vec2d& T ) const { Bisector_PointOnBis PRef; gp_Pnt2d P,P1,P2,PBis; @@ -1189,7 +1202,7 @@ gp_Pnt2d Bisector_BisecCC::Extension (const Standard_Real U, } if (T1.Dot(Tang) < 0.) Tang = - Tang; } - + T = Tang.Normalized(); PBis.SetCoord(P.X() + dU*T.X(),P.Y() + dU*T.Y()); Dist = P1.Distance(PBis); @@ -1201,12 +1214,12 @@ gp_Pnt2d Bisector_BisecCC::Extension (const Standard_Real U, // purpose : //============================================================================= static Standard_Boolean PointByInt(const Handle(Geom2d_Curve)& CA, - const Handle(Geom2d_Curve)& CB, - const Standard_Real SignA, - const Standard_Real SignB, - const Standard_Real UOnA, - Standard_Real& UOnB, - Standard_Real& Dist) + const Handle(Geom2d_Curve)& CB, + const Standard_Real SignA, + const Standard_Real SignB, + const Standard_Real UOnA, + Standard_Real& UOnB, + Standard_Real& Dist) { //------------------------------------------------------------------ // Return point,tangent, normal on CA with parameter UOnA. @@ -1218,7 +1231,7 @@ static Standard_Boolean PointByInt(const Handle(Geom2d_Curve)& CA, CA->D1(UOnA,P1,Tan1); gp_Vec2d N1(Tan1.Y(), - Tan1.X()); - + //-------------------------------------------------------------------------- // test of confusion of P1 with extremity of curve2. //-------------------------------------------------------------------------- @@ -1250,7 +1263,7 @@ static Standard_Boolean PointByInt(const Handle(Geom2d_Curve)& CA, Standard_Real DMin = Precision::Infinite(); Standard_Real UPC; Standard_Boolean YaSol = Standard_False; - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- // Construction of the bisectrice point curve and of the straight line passing // through P1 and carried by the normal. //-------------------------------------------------------------------- @@ -1271,21 +1284,21 @@ static Standard_Boolean PointByInt(const Handle(Geom2d_Curve)& CA, Geom2dAdaptor_Curve ANorLi(NorLi); //------------------------------------------------------------------------- Geom2dInt_GInter Intersect(ABisPC,ANorLi, - Precision::Confusion(),Precision::Confusion()); + Precision::Confusion(),Precision::Confusion()); //------------------------------------------------------------------------- if (Intersect.IsDone() && !Intersect.IsEmpty()) { for (Standard_Integer i = 1; i <= Intersect.NbPoints(); i++) { if (Intersect.Point(i).ParamOnSecond()*SignA < Precision::PConfusion()) { - P = Intersect.Point(i).Value(); - if (P.SquareDistance(P1) < DMin) { - DMin = P.SquareDistance(P1); - PSol = P; - UPC = Intersect.Point(i).ParamOnFirst(); - UOnB = BisPC->LinkBisCurve(UPC); - Dist = DMin; - YaSol = Standard_True; - } + P = Intersect.Point(i).Value(); + if (P.SquareDistance(P1) < DMin) { + DMin = P.SquareDistance(P1); + PSol = P; + UPC = Intersect.Point(i).ParamOnFirst(); + UOnB = BisPC->LinkBisCurve(UPC); + Dist = DMin; + YaSol = Standard_True; + } } } } @@ -1294,27 +1307,38 @@ static Standard_Boolean PointByInt(const Handle(Geom2d_Curve)& CA, // Point found => Test distance curvature + Angular test //--------------------------------------------------------------- P2 = CB->Value(UOnB); + if(P1.SquareDistance(PSol) < 1.e-32) + { + YaSol = Standard_False; + return YaSol; + } + if(P2.SquareDistance(PSol) < 1.e-32) + { + YaSol = Standard_False; + return YaSol; + } + gp_Dir2d PP1Unit(P1.X() - PSol.X(),P1.Y() - PSol.Y()); gp_Dir2d PP2Unit(P2.X() - PSol.X(),P2.Y() - PSol.Y()); - + if (PP1Unit*PP2Unit > 1. - Precision::Angular()) { YaSol = Standard_False; } else { Dist = sqrt(Dist); if ( !IsConvexA ) { - Standard_Real K1 = Curvature(CA,UOnA,Precision::Confusion()); - if (K1 != 0.) { - if (Dist > Abs(1/K1)) YaSol = Standard_False; - } + Standard_Real K1 = Curvature(CA,UOnA,Precision::Confusion()); + if (K1 != 0.) { + if (Dist > Abs(1/K1)) YaSol = Standard_False; + } } if (YaSol) { - if ( !IsConvexB ) { - Standard_Real K2 = Curvature(CB,UOnB,Precision::Confusion()); - if (K2 != 0.) { - if (Dist > Abs(1/K2)) YaSol = Standard_False; - } - } + if ( !IsConvexB ) { + Standard_Real K2 = Curvature(CB,UOnB,Precision::Confusion()); + if (K2 != 0.) { + if (Dist > Abs(1/K2)) YaSol = Standard_False; + } + } } } } @@ -1426,20 +1450,20 @@ Standard_Real Bisector_BisecCC::Parameter(const gp_Pnt2d& P) const //============================================================================= //void Bisector_BisecCC::Dump(const Standard_Integer Deep, void Bisector_BisecCC::Dump(const Standard_Integer , - const Standard_Integer Offset) const + const Standard_Integer Offset) const { Indent (Offset); cout <<"Bisector_BisecCC :"< TolPar || - ((Dist1 < Precision::Infinite() && - Dist2 < Precision::Infinite() && - !PBis.IsEqual(PBisPrec,TolPnt)))) { - PBisPrec = PBis; - UMid = 0.5*( U22 + U11); - PBis = ValueByInt(UMid,UC1,UC2,DistMid); - if ((Dist1 < Precision::Infinite()) == (DistMid < Precision::Infinite())) { - U11 = UMid; - Dist1 = DistMid; - } - else { - U22 = UMid; - Dist2 = DistMid; - } + ((Dist1 < Precision::Infinite() && + Dist2 < Precision::Infinite() && + !PBis.IsEqual(PBisPrec,TolPnt)))) { + PBisPrec = PBis; + UMid = 0.5*( U22 + U11); + PBis = ValueByInt(UMid,UC1,UC2,DistMid); + if ((Dist1 < Precision::Infinite()) == (DistMid < Precision::Infinite())) { + U11 = UMid; + Dist1 = DistMid; + } + else { + U22 = UMid; + Dist2 = DistMid; + } } PBis = ValueByInt(U11,UC1,UC2,Dist1); if (Dist1 < Precision::Infinite()) { @@ -1628,8 +1652,8 @@ Standard_Real Bisector_BisecCC::SearchBound (const Standard_Real U1, // purpose : //============================================================================= static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P, - const Handle(Geom2d_Curve)& C, - Standard_Real& theParam) + const Handle(Geom2d_Curve)& C, + Standard_Real& theParam) { //Standard_Real UOnCurve =0.; theParam = 0.0; @@ -1644,16 +1668,16 @@ static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P, theParam = C->FirstParameter(); return Standard_True; } - + if (P.IsEqual(PL ,Precision::Confusion())) { theParam = C->LastParameter(); return Standard_True; } - + gp_Vec2d PPF(PF.X() - P.X(), PF.Y() - P.Y()); TF.Normalize(); - + if ( Abs (PPF.Dot(TF)) < Precision::Confusion()) { theParam = C->FirstParameter(); @@ -1667,8 +1691,8 @@ static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P, return Standard_True; } Geom2dAPI_ProjectPointOnCurve Proj(P,C, - C->FirstParameter(), - C->LastParameter()); + C->FirstParameter(), + C->LastParameter()); if (Proj.NbPoints() > 0) { theParam = Proj.LowerDistanceParameter(); } @@ -1684,8 +1708,8 @@ static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P, // purpose : //============================================================================= static Standard_Boolean TestExtension (const Handle(Geom2d_Curve)& C1, - const Handle(Geom2d_Curve)& C2, - const Standard_Integer Start_End) + const Handle(Geom2d_Curve)& C2, + const Standard_Integer Start_End) { gp_Pnt2d P1,P2; gp_Vec2d T1,T2; @@ -1708,7 +1732,7 @@ static Standard_Boolean TestExtension (const Handle(Geom2d_Curve)& C1, if (P1.IsEqual(P2,Precision::Confusion())) { T2.Normalize(); if (T1.Dot(T2) > 1.0 - Precision::Confusion()) { - Test = Standard_True; + Test = Standard_True; } } } @@ -1753,12 +1777,12 @@ void Bisector_BisecCC::ComputePointEnd () // purpose : //============================================================================= static Standard_Boolean DiscretPar(const Standard_Real DU, - const Standard_Real EpsMin, - const Standard_Real EpsMax, - const Standard_Integer NbMin, - const Standard_Integer NbMax, - Standard_Real& Eps, - Standard_Integer& Nb) + const Standard_Real EpsMin, + const Standard_Real EpsMax, + const Standard_Integer NbMin, + const Standard_Integer NbMax, + Standard_Real& Eps, + Standard_Integer& Nb) { if (DU <= NbMin*EpsMin) { Eps = DU/(NbMin + 1) ; diff --git a/src/Bisector/Bisector_Inter.cxx b/src/Bisector/Bisector_Inter.cxx index 43600594e7..ab19c88af5 100644 --- a/src/Bisector/Bisector_Inter.cxx +++ b/src/Bisector/Bisector_Inter.cxx @@ -33,12 +33,14 @@ #include #include #include - +#ifdef OCCT_DEBUG +//#define DRAW #ifdef DRAW -#include -#include -#include +#include +static char name[100]; static Standard_Boolean Affich = Standard_False; +static Standard_Integer nbint = 0; +#endif #endif //=================================================================================== @@ -172,14 +174,14 @@ void Bisector_Inter::Perform(const Bisector_Bisec& C1, PMax,UMax,D2.LastTolerance()); if ((IB2 == 1 && Bis2->IsExtendAtStart()) || - (IB2 == Bis1->NbIntervals() && Bis2->IsExtendAtEnd()) ){ - //-------------------------------------------------------- - // Part corresponding to an extension is a segment. - //-------------------------------------------------------- - SBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax); + (IB2 == Bis1->NbIntervals() && Bis2->IsExtendAtEnd()) ){ + //-------------------------------------------------------- + // Part corresponding to an extension is a segment. + //-------------------------------------------------------- + SBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax); } else { - SBis2 [IB2] = Bis2; + SBis2 [IB2] = Bis2; } NB2++; } @@ -269,11 +271,11 @@ void Bisector_Inter::SinglePerform(const Handle(Geom2d_Curve)& CBis1, if (Type1 == STANDARD_TYPE(Geom2d_Line) && Type2 != STANDARD_TYPE(Geom2d_Line)) { TestBound(Handle(Geom2d_Line)::DownCast(Bis1), - D1,Bis2,D2,TolConf,Standard_False); + D1,Bis2,D2,TolConf,Standard_False); } else if (Type2 == STANDARD_TYPE(Geom2d_Line)&& Type1 != STANDARD_TYPE(Geom2d_Line)) { TestBound(Handle(Geom2d_Line)::DownCast(Bis2), - D2,Bis1,D1,TolConf,Standard_True); + D2,Bis1,D1,TolConf,Standard_True); } Geom2dInt_GInter Intersect; Geom2dAdaptor_Curve ABis1(Bis1); @@ -285,21 +287,17 @@ void Bisector_Inter::SinglePerform(const Handle(Geom2d_Curve)& CBis1, #ifdef DRAW if (Affich) { - Handle(DrawTrSurf_Curve2d) dr; - Draw_Color Couleur = Draw_bleu; - - dr = new DrawTrSurf_Curve2d(Bis1,Couleur,100); - dout << dr; - dr = new DrawTrSurf_Curve2d(Bis2,Couleur,100); - dout << dr; - if (IsDone() && !IsEmpty()) { + sprintf( name, "i1_%d", ++nbint); + DrawTrSurf::Set(name, Bis1); + sprintf( name, "i2_%d", nbint); + DrawTrSurf::Set(name, Bis2); + if (IsDone() && !IsEmpty()) { for (Standard_Integer k = 1; k <= NbPoints(); k++) { - gp_Pnt2d P = Point(k).Value(); - Handle(Draw_Marker2D) drp = new Draw_Marker2D(P,Draw_Plus,Draw_vert); - dout << drp; + gp_Pnt2d P = Point(k).Value(); + sprintf( name, "ip_%d_%d", nbint, k); + DrawTrSurf::Set(name, P); } } - dout.Flush(); } #endif } diff --git a/src/ChFi3d/ChFi3d_Builder_0.cxx b/src/ChFi3d/ChFi3d_Builder_0.cxx index 27aee9e957..a57c2e3e35 100644 --- a/src/ChFi3d/ChFi3d_Builder_0.cxx +++ b/src/ChFi3d/ChFi3d_Builder_0.cxx @@ -180,9 +180,9 @@ extern void ChFi3d_ResultChron(OSD_Chronometer & ch,Standard_Real& time); //purpose : //======================================================================= Standard_Real ChFi3d_InPeriod(const Standard_Real U, - const Standard_Real UFirst, - const Standard_Real ULast, - const Standard_Real Eps) + const Standard_Real UFirst, + const Standard_Real ULast, + const Standard_Real Eps) { const Standard_Real period = ULast - UFirst; Standard_Real u = U; @@ -196,8 +196,8 @@ Standard_Real ChFi3d_InPeriod(const Standard_Real U, //purpose : Calculation of min/max uv of the fillet to intersect. //======================================================================= void ChFi3d_Boite(const gp_Pnt2d& p1,const gp_Pnt2d& p2, - Standard_Real& mu,Standard_Real& Mu, - Standard_Real& mv,Standard_Real& Mv) + Standard_Real& mu,Standard_Real& Mu, + Standard_Real& mv,Standard_Real& Mv) { mu = Min(p1.X(),p2.X()); Mu = Max(p1.X(),p2.X()); mv = Min(p1.Y(),p2.Y()); Mv = Max(p1.Y(),p2.Y()); @@ -207,10 +207,10 @@ void ChFi3d_Boite(const gp_Pnt2d& p1,const gp_Pnt2d& p2, //purpose : Calculation of min/max uv of the fillet to intersect. //======================================================================= void ChFi3d_Boite(const gp_Pnt2d& p1,const gp_Pnt2d& p2, - const gp_Pnt2d& p3,const gp_Pnt2d& p4, - Standard_Real& Du,Standard_Real& Dv, - Standard_Real& mu,Standard_Real& Mu, - Standard_Real& mv,Standard_Real& Mv) + const gp_Pnt2d& p3,const gp_Pnt2d& p4, + Standard_Real& Du,Standard_Real& Dv, + Standard_Real& mu,Standard_Real& Mu, + Standard_Real& mv,Standard_Real& Mv) { Standard_Real a,b; a = Min(p1.X(),p2.X()); b = Min(p3.X(),p4.X()); mu = Min(a,b); @@ -225,7 +225,7 @@ void ChFi3d_Boite(const gp_Pnt2d& p1,const gp_Pnt2d& p2, //purpose : //======================================================================= static Handle(Adaptor3d_HSurface) Geometry(TopOpeBRepDS_DataStructure& DStr, - const Standard_Integer ind) + const Standard_Integer ind) { if(ind == 0) return Handle(Adaptor3d_HSurface)(); if(ind > 0) { @@ -246,8 +246,8 @@ static Handle(Adaptor3d_HSurface) Geometry(TopOpeBRepDS_DataStructure& DStr, //purpose : //======================================================================= void ChFi3d_SetPointTolerance(TopOpeBRepDS_DataStructure& DStr, - const Bnd_Box& box, - const Standard_Integer IP) + const Bnd_Box& box, + const Standard_Integer IP) { Standard_Real a,b,c,d,e,f,vtol; box.Get(a,b,c,d,e,f); @@ -261,10 +261,10 @@ void ChFi3d_SetPointTolerance(TopOpeBRepDS_DataStructure& DStr, //purpose : //======================================================================= void ChFi3d_EnlargeBox(const Handle(Geom_Curve)& C, - const Standard_Real wd, - const Standard_Real wf, - Bnd_Box& box1, - Bnd_Box& box2) + const Standard_Real wd, + const Standard_Real wf, + Bnd_Box& box1, + Bnd_Box& box2) { box1.Add(C->Value(wd)); box2.Add(C->Value(wf)); @@ -274,11 +274,11 @@ void ChFi3d_EnlargeBox(const Handle(Geom_Curve)& C, //purpose : //======================================================================= void ChFi3d_EnlargeBox(const Handle(Adaptor3d_HSurface)& S, - const Handle(Geom2d_Curve)& PC, - const Standard_Real wd, - const Standard_Real wf, - Bnd_Box& box1, - Bnd_Box& box2) + const Handle(Geom2d_Curve)& PC, + const Standard_Real wd, + const Standard_Real wf, + Bnd_Box& box1, + Bnd_Box& box2) { Standard_Real u,v; PC->Value(wd).Coord(u,v); @@ -291,9 +291,9 @@ void ChFi3d_EnlargeBox(const Handle(Adaptor3d_HSurface)& S, //purpose : //======================================================================= void ChFi3d_EnlargeBox(const TopoDS_Edge& E, - const TopTools_ListOfShape& LF, - const Standard_Real w, - Bnd_Box& box) + const TopTools_ListOfShape& LF, + const Standard_Real w, + Bnd_Box& box) { BRepAdaptor_Curve BC(E); @@ -312,11 +312,11 @@ void ChFi3d_EnlargeBox(const TopoDS_Edge& E, //purpose : //======================================================================= void ChFi3d_EnlargeBox(TopOpeBRepDS_DataStructure& DStr, - const Handle(ChFiDS_Stripe)& st, - const Handle(ChFiDS_SurfData)& sd, - Bnd_Box& b1, - Bnd_Box& b2, - const Standard_Boolean isfirst) + const Handle(ChFiDS_Stripe)& st, + const Handle(ChFiDS_SurfData)& sd, + Bnd_Box& b1, + Bnd_Box& b2, + const Standard_Boolean isfirst) { Standard_Real u,v; const ChFiDS_CommonPoint& cp1 = sd->Vertex(isfirst,1); @@ -380,9 +380,9 @@ void ChFi3d_EnlargeBox(TopOpeBRepDS_DataStructure& DStr, //purpose : //======================================================================= void ChFi3d_conexfaces(const TopoDS_Edge& E, - TopoDS_Face& F1, - TopoDS_Face& F2, - const ChFiDS_Map& EFMap) + TopoDS_Face& F1, + TopoDS_Face& F2, + const ChFiDS_Map& EFMap) { TopTools_ListIteratorOfListOfShape It; F1.Nullify(); @@ -394,7 +394,7 @@ void ChFi3d_conexfaces(const TopoDS_Edge& E, else { F2 = TopoDS::Face(It.Value()); if(!F2.IsSame(F1) || BRep_Tool::IsClosed(E,F1)) { - break; + break; } else F2.Nullify(); } @@ -405,7 +405,7 @@ void ChFi3d_conexfaces(const TopoDS_Edge& E, //purpose : check concavities for the tops with 3 edges. //======================================================================= ChFiDS_State ChFi3d_EdgeState(TopoDS_Edge* E, - const ChFiDS_Map& EFMap) + const ChFiDS_Map& EFMap) { ChFiDS_State sst; Standard_Integer i,j; @@ -436,9 +436,9 @@ ChFiDS_State ChFi3d_EdgeState(TopoDS_Edge* E, else F[2] = F3; if(F5.IsSame(F[2])) F[1] = F6; else F[1] = F5; - + } - + if(F[0].IsNull() || F[1].IsNull() || F[2].IsNull()) sst = ChFiDS_FreeBoundary; else{ TopAbs_Orientation o01,o02,o11,o12,o21,o22; @@ -457,8 +457,8 @@ ChFiDS_State ChFi3d_EdgeState(TopoDS_Edge* E, // refine the processing. //======================================================================= GeomAbs_Shape ChFi3d_evalconti(const TopoDS_Edge& /*E*/, - const TopoDS_Face& F1, - const TopoDS_Face& F2) + const TopoDS_Face& F1, + const TopoDS_Face& F2) { GeomAbs_Shape cont = GeomAbs_G1; if(!F1.IsSame(F2)) return cont; @@ -467,8 +467,8 @@ GeomAbs_Shape ChFi3d_evalconti(const TopoDS_Edge& /*E*/, BRepAdaptor_Surface S(F,Standard_False); GeomAbs_SurfaceType typ = S.GetType(); if(typ != GeomAbs_Cone && - typ != GeomAbs_Sphere && - typ != GeomAbs_Torus) return cont; + typ != GeomAbs_Sphere && + typ != GeomAbs_Torus) return cont; return GeomAbs_CN; } //modified by NIZNHY-PKV Wed Dec 15 11:22:35 2010f @@ -477,9 +477,9 @@ GeomAbs_Shape ChFi3d_evalconti(const TopoDS_Edge& /*E*/, //purpose : //======================================================================= Standard_Boolean ChFi3d_KParticular (const Handle(ChFiDS_Spine)& Spine, - const Standard_Integer IE, - const BRepAdaptor_Surface& S1, - const BRepAdaptor_Surface& S2) + const Standard_Integer IE, + const BRepAdaptor_Surface& S1, + const BRepAdaptor_Surface& S2) { Standard_Boolean bRet; // @@ -552,11 +552,11 @@ Standard_Boolean ChFi3d_KParticular (const Handle(ChFiDS_Spine)& Spine, // Useful for intersections with known extremities. //======================================================================= void ChFi3d_BoundFac(BRepAdaptor_Surface& S, - const Standard_Real uumin, - const Standard_Real uumax, - const Standard_Real vvmin, - const Standard_Real vvmax, - const Standard_Boolean checknaturalbounds) + const Standard_Real uumin, + const Standard_Real uumax, + const Standard_Real vvmin, + const Standard_Real vvmax, + const Standard_Boolean checknaturalbounds) { ChFi3d_BoundSrf(S.ChangeSurface(), uumin,uumax,vvmin,vvmax,checknaturalbounds); } @@ -566,11 +566,11 @@ void ChFi3d_BoundFac(BRepAdaptor_Surface& S, // Useful for intersections with known extremities. //======================================================================= void ChFi3d_BoundSrf(GeomAdaptor_Surface& S, - const Standard_Real uumin, - const Standard_Real uumax, - const Standard_Real vvmin, - const Standard_Real vvmax, - const Standard_Boolean checknaturalbounds) + const Standard_Real uumin, + const Standard_Real uumax, + const Standard_Real vvmin, + const Standard_Real vvmax, + const Standard_Boolean checknaturalbounds) { Standard_Real umin = uumin, umax = uumax, vmin = vvmin, vmax = vvmax; Handle(Geom_Surface) surface = S.Surface(); @@ -596,7 +596,7 @@ void ChFi3d_BoundSrf(GeomAdaptor_Surface& S, Standard_Real step3du = Stepu/scalu; Standard_Real step3dv = Stepv/scalv; - + if(step3du > step3dv) Stepv = step3du*scalv; if(step3dv > step3du) Stepu = step3dv*scalu; @@ -618,36 +618,36 @@ void ChFi3d_BoundSrf(GeomAdaptor_Surface& S, //purpose : //======================================================================= Standard_Boolean ChFi3d_InterPlaneEdge (Handle(Adaptor3d_HSurface)& Plan, - Handle(Adaptor3d_HCurve)& C, - Standard_Real& W, - const Standard_Boolean Sens, - const Standard_Real tolc) + Handle(Adaptor3d_HCurve)& C, + Standard_Real& W, + const Standard_Boolean Sens, + const Standard_Real tolc) { IntCurveSurface_HInter Intersection; Standard_Integer isol = 0, nbp ,iip; Standard_Real uf = C->FirstParameter(),ul = C->LastParameter(); Standard_Real CW; - + Intersection.Perform(C,Plan); - + if(Intersection.IsDone()) { nbp = Intersection.NbPoints(); for (iip = 1; iip <= nbp; iip++) { CW = Intersection.Point(iip).W(); if(C->IsPeriodic()) - CW = ElCLib::InPeriod(CW,uf-tolc,uf-tolc+C->Period()); + CW = ElCLib::InPeriod(CW,uf-tolc,uf-tolc+C->Period()); if(uf - tolc <= CW && ul + tolc >= CW) { - if (isol == 0) { - isol = iip; W = CW; - } - else { - if ( Sens && CW < W) { - W = CW; isol = iip; - } - else if (!Sens && CW > W) { - W = CW; isol = iip; - } - } + if (isol == 0) { + isol = iip; W = CW; + } + else { + if ( Sens && CW < W) { + W = CW; isol = iip; + } + else if (!Sens && CW > W) { + W = CW; isol = iip; + } + } } } } @@ -659,14 +659,14 @@ Standard_Boolean ChFi3d_InterPlaneEdge (Handle(Adaptor3d_HSurface)& Plan, //purpose : //======================================================================= void ChFi3d_ExtrSpineCarac(const TopOpeBRepDS_DataStructure& DStr, - const Handle(ChFiDS_Stripe)& cd, - const Standard_Integer i, - const Standard_Real p, - const Standard_Integer jf, - const Standard_Integer sens, - gp_Pnt& P, - gp_Vec& V, - Standard_Real& R) //check if it is necessary to add D1,D2 and DR + const Handle(ChFiDS_Stripe)& cd, + const Standard_Integer i, + const Standard_Real p, + const Standard_Integer jf, + const Standard_Integer sens, + gp_Pnt& P, + gp_Vec& V, + Standard_Real& R) //check if it is necessary to add D1,D2 and DR { // Attention for approximated surfaces it is assumed that e // the parameters of the pcurve are the same as of @@ -695,15 +695,15 @@ void ChFi3d_ExtrSpineCarac(const TopOpeBRepDS_DataStructure& DStr, break; default: { Standard_Integer nbelspine; - const Handle(ChFiDS_Spine)& sp = cd->Spine(); - Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(sp); - nbelspine=sp->NbEdges(); - Handle(ChFiDS_HElSpine) hels; - if (nbelspine==1) hels = sp->ElSpine(1); - else hels = sp->ElSpine(p); - if(fsp->IsConstant()) { R = fsp->Radius(); } - else { R = fsp->Law(hels)->Value(p); } - hels->D1(p,Pbid,V); + const Handle(ChFiDS_Spine)& sp = cd->Spine(); + Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(sp); + nbelspine=sp->NbEdges(); + Handle(ChFiDS_HElSpine) hels; + if (nbelspine==1) hels = sp->ElSpine(1); + else hels = sp->ElSpine(p); + if(fsp->IsConstant()) { R = fsp->Radius(); } + else { R = fsp->Law(hels)->Value(p); } + hels->D1(p,Pbid,V); } break; } @@ -717,17 +717,17 @@ void ChFi3d_ExtrSpineCarac(const TopOpeBRepDS_DataStructure& DStr, // of guidelines of start and end fillets. //======================================================================= Handle(Geom_Circle) ChFi3d_CircularSpine(Standard_Real& WFirst, - Standard_Real& WLast, - const gp_Pnt& Pdeb, - const gp_Vec& Vdeb, - const gp_Pnt& Pfin, - const gp_Vec& Vfin, - const Standard_Real rad) + Standard_Real& WLast, + const gp_Pnt& Pdeb, + const gp_Vec& Vdeb, + const gp_Pnt& Pfin, + const gp_Vec& Vfin, + const Standard_Real rad) { gp_Circ ccc; gp_Pln Pl1(Pdeb,gp_Dir(Vdeb)),Pl2(Pfin,gp_Dir(Vfin)); IntAna_QuadQuadGeo LInt (Pl1,Pl2,Precision::Angular(), - Precision::Confusion()); + Precision::Confusion()); gp_Lin li; if (LInt.IsDone()) { li = LInt.Line(1); @@ -757,10 +757,10 @@ Handle(Geom_Circle) ChFi3d_CircularSpine(Standard_Real& WFirst, // guidelines of start and end fillets. //======================================================================= Handle(Geom_BezierCurve) ChFi3d_Spine(const gp_Pnt& pd, - gp_Vec& vd, - const gp_Pnt& pf, - gp_Vec& vf, - const Standard_Real R) + gp_Vec& vd, + const gp_Pnt& pf, + gp_Vec& vf, + const Standard_Real R) { TColgp_Array1OfPnt pol(1,4); const Standard_Real fac = 0.5 * tan((M_PI-vd.Angle(vf)) * 0.5); @@ -777,22 +777,22 @@ Handle(Geom_BezierCurve) ChFi3d_Spine(const gp_Pnt& pd, //purpose : Checks if surfdata i1 and i2 are face to face //======================================================================= Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr, - const Handle(ChFiDS_Stripe)& cd1, - const Handle(ChFiDS_Stripe)& cd2, - const Standard_Integer i1, - const Standard_Integer i2, - const Standard_Integer sens1, - const Standard_Integer sens2, - Standard_Real& p1, - Standard_Real& p2, - TopoDS_Face& face, - Standard_Boolean& sameside, - Standard_Integer& jf1, - Standard_Integer& jf2, - Standard_Boolean& visavis, - const TopoDS_Vertex& Vtx, - const Standard_Boolean Check2dDistance, - const Standard_Boolean enlarge) + const Handle(ChFiDS_Stripe)& cd1, + const Handle(ChFiDS_Stripe)& cd2, + const Standard_Integer i1, + const Standard_Integer i2, + const Standard_Integer sens1, + const Standard_Integer sens2, + Standard_Real& p1, + Standard_Real& p2, + TopoDS_Face& face, + Standard_Boolean& sameside, + Standard_Integer& jf1, + Standard_Integer& jf2, + Standard_Boolean& visavis, + const TopoDS_Vertex& Vtx, + const Standard_Boolean Check2dDistance, + const Standard_Boolean enlarge) { Standard_Boolean isf1 = (sens1 == 1), isf2 = (sens2 == 1); const Handle(ChFiDS_SurfData)& fd1 = cd1->SetOfSurfData()->Value(i1); @@ -843,14 +843,14 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr, P2d = BRep_Tool::Parameters( Vtx, face ); if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) { Standard_Boolean restore = - ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) || - (j2 == jf2 && sens2*(p2 - u2) > 0.)); + ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) || + (j2 == jf2 && sens2*(p2 - u2) > 0.)); ok = 1; if(restore) { - p1 = u1; p2 = u2; sameside = ss; jf1 = j1; jf2 = j2; face = ff; + p1 = u1; p2 = u2; sameside = ss; jf1 = j1; jf2 = j2; face = ff; } else { - u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face; + u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face; } } //the re-initialization is added in case p1,... take wrong values @@ -876,14 +876,14 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr, P2d = BRep_Tool::Parameters( Vtx, face ); if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) { Standard_Boolean restore = - ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) || - (j2 == jf2 && sens2*(p2 - u2) > 0.)); + ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) || + (j2 == jf2 && sens2*(p2 - u2) > 0.)); ok = 1; if(restore) { - p1 = u1; p2 = u2; sameside = ss; jf1 = j1; jf2 = j2; face = ff; + p1 = u1; p2 = u2; sameside = ss; jf1 = j1; jf2 = j2; face = ff; } else { - u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face; + u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face; } } //the re-initialization is added in case p1,... take wrong values @@ -909,14 +909,14 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr, P2d = BRep_Tool::Parameters( Vtx, face ); if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) { Standard_Boolean restore = - ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) || - (j2 == jf2 && sens2*(p2 - u2) > 0.)); + ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) || + (j2 == jf2 && sens2*(p2 - u2) > 0.)); ok = 1; if(restore) { - p1 = u1; p2 = u2; sameside = ss; jf1 = j1; jf2 = j2; face = ff; + p1 = u1; p2 = u2; sameside = ss; jf1 = j1; jf2 = j2; face = ff; } else { - u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face; + u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face; } } //the re-initialization is added in case p1,... take wrong values @@ -931,10 +931,10 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr, //purpose : //======================================================================= static Standard_Real recadre(const Standard_Real p, - const Standard_Real ref, - const Standard_Integer sens, - const Standard_Real first, - const Standard_Real last) + const Standard_Real ref, + const Standard_Integer sens, + const Standard_Real first, + const Standard_Real last) { const Standard_Real pp = p + (sens > 0 ? (first - last) : (last - first)); return ((Abs(pp - ref) < Abs(p - ref))? pp : p); @@ -944,18 +944,18 @@ static Standard_Real recadre(const Standard_Real p, //purpose : //======================================================================= Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, - const Standard_Real pref1, - Standard_Real& p1, - const Standard_Integer jf1, - const Standard_Integer sens1, - const Handle(ChFiDS_SurfData)& fd2, - const Standard_Real pref2, - Standard_Real& p2, - const Standard_Integer jf2, - const Standard_Integer sens2, - const gp_Pnt2d& RefP2d, - const Standard_Boolean Check2dDistance, - const Standard_Boolean enlarge) + const Standard_Real pref1, + Standard_Real& p1, + const Standard_Integer jf1, + const Standard_Integer sens1, + const Handle(ChFiDS_SurfData)& fd2, + const Standard_Real pref2, + Standard_Real& p2, + const Standard_Integer jf2, + const Standard_Integer sens2, + const gp_Pnt2d& RefP2d, + const Standard_Boolean Check2dDistance, + const Standard_Boolean enlarge) { Geom2dAdaptor_Curve C1; Geom2dAdaptor_Curve C2; @@ -979,7 +979,7 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, } else C1.Load(pcf1,first-delta,last+delta); Standard_Real first1 = pcf1->FirstParameter(), last1 = pcf1->LastParameter(); - + first = fd2->Interference(jf2).FirstParameter(); last = fd2->Interference(jf2).LastParameter(); if ((last-first) < Precision::PConfusion()) @@ -995,20 +995,20 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, } else C2.Load(fd2->Interference(jf2).PCurveOnFace(),first-delta,last+delta); Standard_Real first2 = pcf2->FirstParameter(), last2 = pcf2->LastParameter(); - + IntRes2d_IntersectionPoint int2d; Geom2dInt_GInter Intersection; Standard_Integer nbpt,nbseg; gp_Pnt2d p2d; if(fd1->Interference(jf1).PCurveOnFace() == fd2->Interference(jf2).PCurveOnFace()) { Intersection.Perform(C1, - Precision::PIntersection(), - Precision::PIntersection()); + Precision::PIntersection(), + Precision::PIntersection()); } else{ Intersection.Perform(C1,C2, - Precision::PIntersection(), - Precision::PIntersection()); + Precision::PIntersection(), + Precision::PIntersection()); } if (Intersection.IsDone()) { if (!Intersection.IsEmpty()) { @@ -1017,84 +1017,84 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, } nbpt = Intersection.NbPoints(); if ( nbpt >= 1 ) { - // The criteria sets to filter the found points in a strict way + // The criteria sets to filter the found points in a strict way // are missing. Two different criterions chosen somewhat randomly // are used : - // - periodic curves : closest to the border. - // - non-periodic curves : the closest to the left of 2 curves - // modulo sens1 and sens2 - int2d = Intersection.Point(1); - p2d = int2d.Value(); - p1 = int2d.ParamOnFirst(); - p2 = int2d.ParamOnSecond(); - if(isper1) p1 = recadre(p1,pref1,sens1,first1,last1); - if(isper2) p2 = recadre(p2,pref2,sens2,first2,last2); - for(Standard_Integer i = 2; i<=nbpt; i++) { - int2d = Intersection.Point(i); - if(isper1) { - Standard_Real pp1 = int2d.ParamOnFirst(); - pp1 = recadre(pp1,pref1,sens1,first1,last1); - if((Abs(pp1 - pref1) < Abs(p1 - pref1))) { - p1 = pp1; - p2 = int2d.ParamOnSecond(); - p2d = int2d.Value(); - } - // Modified by skv - Mon Jun 16 15:51:21 2003 OCC615 Begin - else if (Check2dDistance && - RefP2d.Distance(int2d.Value()) < RefP2d.Distance(p2d)) { - Standard_Real pp2 = int2d.ParamOnSecond(); + // - periodic curves : closest to the border. + // - non-periodic curves : the closest to the left of 2 curves + // modulo sens1 and sens2 + int2d = Intersection.Point(1); + p2d = int2d.Value(); + p1 = int2d.ParamOnFirst(); + p2 = int2d.ParamOnSecond(); + if(isper1) p1 = recadre(p1,pref1,sens1,first1,last1); + if(isper2) p2 = recadre(p2,pref2,sens2,first2,last2); + for(Standard_Integer i = 2; i<=nbpt; i++) { + int2d = Intersection.Point(i); + if(isper1) { + Standard_Real pp1 = int2d.ParamOnFirst(); + pp1 = recadre(pp1,pref1,sens1,first1,last1); + if((Abs(pp1 - pref1) < Abs(p1 - pref1))) { + p1 = pp1; + p2 = int2d.ParamOnSecond(); + p2d = int2d.Value(); + } + // Modified by skv - Mon Jun 16 15:51:21 2003 OCC615 Begin + else if (Check2dDistance && + RefP2d.Distance(int2d.Value()) < RefP2d.Distance(p2d)) { + Standard_Real pp2 = int2d.ParamOnSecond(); - if(isper2) - pp2 = recadre(pp2,pref2,sens2,first2,last2); + if(isper2) + pp2 = recadre(pp2,pref2,sens2,first2,last2); - p1 = pp1; - p2 = pp2; - p2d = int2d.Value(); - } - // Modified by skv - Mon Jun 16 15:51:22 2003 OCC615 End - } - else if(isper2) { - Standard_Real pp2 = int2d.ParamOnSecond(); - pp2 = recadre(pp2,pref2,sens2,first2,last2); - if((Abs(pp2 - pref2) < Abs(p2 - pref2))) { - p2 = pp2; - p1 = int2d.ParamOnFirst(); - p2d = int2d.Value(); - } - // Modified by skv - Mon Jun 16 15:51:21 2003 OCC615 Begin - else if (Check2dDistance && - RefP2d.Distance(int2d.Value()) < RefP2d.Distance(p2d)) { - Standard_Real pp1 = int2d.ParamOnFirst(); + p1 = pp1; + p2 = pp2; + p2d = int2d.Value(); + } + // Modified by skv - Mon Jun 16 15:51:22 2003 OCC615 End + } + else if(isper2) { + Standard_Real pp2 = int2d.ParamOnSecond(); + pp2 = recadre(pp2,pref2,sens2,first2,last2); + if((Abs(pp2 - pref2) < Abs(p2 - pref2))) { + p2 = pp2; + p1 = int2d.ParamOnFirst(); + p2d = int2d.Value(); + } + // Modified by skv - Mon Jun 16 15:51:21 2003 OCC615 Begin + else if (Check2dDistance && + RefP2d.Distance(int2d.Value()) < RefP2d.Distance(p2d)) { + Standard_Real pp1 = int2d.ParamOnFirst(); - if(isper1) - pp1 = recadre(pp1,pref1,sens1,first1,last1); + if(isper1) + pp1 = recadre(pp1,pref1,sens1,first1,last1); - p1 = pp1; - p2 = pp2; - p2d = int2d.Value(); - } - // Modified by skv - Mon Jun 16 15:51:22 2003 OCC615 End - } - else if(((int2d.ParamOnFirst() - p1)*sens1 < 0.) && - ((int2d.ParamOnSecond() - p2)*sens2 < 0.)) { - p1 = int2d.ParamOnFirst(); - p2 = int2d.ParamOnSecond(); - p2d = int2d.Value(); - } - else if((Abs(int2d.ParamOnFirst() - pref1) < Abs(p1 - pref1)) && - (Abs(int2d.ParamOnSecond() - pref2) < Abs(p2 - pref2))) { - p1 = int2d.ParamOnFirst(); - p2 = int2d.ParamOnSecond(); - p2d = int2d.Value(); - } - else if (Check2dDistance && RefP2d.Distance(int2d.Value()) < RefP2d.Distance(p2d)) - { - p1 = int2d.ParamOnFirst(); - p2 = int2d.ParamOnSecond(); - p2d = int2d.Value(); - } - } - return Standard_True; + p1 = pp1; + p2 = pp2; + p2d = int2d.Value(); + } + // Modified by skv - Mon Jun 16 15:51:22 2003 OCC615 End + } + else if(((int2d.ParamOnFirst() - p1)*sens1 < 0.) && + ((int2d.ParamOnSecond() - p2)*sens2 < 0.)) { + p1 = int2d.ParamOnFirst(); + p2 = int2d.ParamOnSecond(); + p2d = int2d.Value(); + } + else if((Abs(int2d.ParamOnFirst() - pref1) < Abs(p1 - pref1)) && + (Abs(int2d.ParamOnSecond() - pref2) < Abs(p2 - pref2))) { + p1 = int2d.ParamOnFirst(); + p2 = int2d.ParamOnSecond(); + p2d = int2d.Value(); + } + else if (Check2dDistance && RefP2d.Distance(int2d.Value()) < RefP2d.Distance(p2d)) + { + p1 = int2d.ParamOnFirst(); + p2 = int2d.ParamOnSecond(); + p2d = int2d.Value(); + } + } + return Standard_True; } return Standard_False; } @@ -1107,10 +1107,10 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, //purpose : //======================================================================= void ChFi3d_Coefficient(const gp_Vec& V3d, - const gp_Vec& D1u, - const gp_Vec& D1v, - Standard_Real& DU, - Standard_Real& DV) + const gp_Vec& D1u, + const gp_Vec& D1v, + Standard_Real& DU, + Standard_Real& DV) { const Standard_Real AA = D1u.SquareMagnitude(); const Standard_Real BB = D1u.Dot(D1v); @@ -1127,8 +1127,8 @@ void ChFi3d_Coefficient(const gp_Vec& V3d, // ses parametres et on la reparametre eventuellement. //======================================================================= void ChFi3d_ReparamPcurv(const Standard_Real Uf, - const Standard_Real Ul, - Handle(Geom2d_Curve)& Pcurv) + const Standard_Real Ul, + Handle(Geom2d_Curve)& Pcurv) { if(Pcurv.IsNull()) return; Standard_Real upcf = Pcurv->FirstParameter(); @@ -1139,20 +1139,20 @@ void ChFi3d_ReparamPcurv(const Standard_Real Uf, Handle(Geom2d_BSplineCurve) pc = Handle(Geom2d_BSplineCurve)::DownCast(basis); if(pc.IsNull()) return; if(Abs(upcf - pc->FirstParameter()) > Precision::PConfusion() || - Abs(upcl - pc->LastParameter()) > Precision::PConfusion()) { - pc->Segment(upcf,upcl); + Abs(upcl - pc->LastParameter()) > Precision::PConfusion()) { + pc->Segment(upcf,upcl); } if(Abs(Uf - pc->FirstParameter()) > Precision::PConfusion() || - Abs(Ul - pc->LastParameter()) > Precision::PConfusion()) { - TColgp_Array1OfPnt2d pol(1,pc->NbPoles()); - pc->Poles(pol); - TColStd_Array1OfReal kn(1,pc->NbKnots()); - pc->Knots(kn); - TColStd_Array1OfInteger mu(1,pc->NbKnots()); - pc->Multiplicities(mu); - Standard_Integer deg = pc->Degree(); - BSplCLib::Reparametrize(Uf,Ul,kn); - pc = new Geom2d_BSplineCurve(pol,kn,mu,deg); + Abs(Ul - pc->LastParameter()) > Precision::PConfusion()) { + TColgp_Array1OfPnt2d pol(1,pc->NbPoles()); + pc->Poles(pol); + TColStd_Array1OfReal kn(1,pc->NbKnots()); + pc->Knots(kn); + TColStd_Array1OfInteger mu(1,pc->NbKnots()); + pc->Multiplicities(mu); + Standard_Integer deg = pc->Degree(); + BSplCLib::Reparametrize(Uf,Ul,kn); + pc = new Geom2d_BSplineCurve(pol,kn,mu,deg); } Pcurv = pc; } @@ -1162,55 +1162,55 @@ void ChFi3d_ReparamPcurv(const Standard_Real Uf, // 3d. Should be called only in analytic cases. //======================================================================= void ChFi3d_ProjectPCurv(const Handle(Adaptor3d_HCurve)& HCg, - const Handle(Adaptor3d_HSurface)& HSg, - Handle(Geom2d_Curve)& Pcurv, - const Standard_Real tol, - Standard_Real& tolreached) + const Handle(Adaptor3d_HSurface)& HSg, + Handle(Geom2d_Curve)& Pcurv, + const Standard_Real tol, + Standard_Real& tolreached) { if (HSg->GetType() != GeomAbs_BezierSurface && - HSg->GetType() != GeomAbs_BSplineSurface) { - - ProjLib_ProjectedCurve Projc (HSg,HCg,tol); - tolreached = Projc.GetTolerance(); - switch (Projc.GetType()) { - case GeomAbs_Line : - { - Pcurv = new Geom2d_Line(Projc.Line()); + HSg->GetType() != GeomAbs_BSplineSurface) { + + ProjLib_ProjectedCurve Projc (HSg,HCg,tol); + tolreached = Projc.GetTolerance(); + switch (Projc.GetType()) { + case GeomAbs_Line : + { + Pcurv = new Geom2d_Line(Projc.Line()); + } + break; + case GeomAbs_Circle : + { + Pcurv = new Geom2d_Circle(Projc.Circle()); + } + break; + case GeomAbs_Ellipse : + { + Pcurv = new Geom2d_Ellipse(Projc.Ellipse()); + } + break; + case GeomAbs_Hyperbola : + { + Pcurv = new Geom2d_Hyperbola(Projc.Hyperbola()); + } + break; + case GeomAbs_Parabola : + { + Pcurv = new Geom2d_Parabola(Projc.Parabola()); + } + break; + case GeomAbs_BezierCurve : + { + Pcurv = Projc.Bezier(); + } + break; + case GeomAbs_BSplineCurve : + { + Pcurv = Projc.BSpline(); + } + break; + default: + Standard_NotImplemented::Raise("echec approximation de la pcurve "); } - break; - case GeomAbs_Circle : - { - Pcurv = new Geom2d_Circle(Projc.Circle()); - } - break; - case GeomAbs_Ellipse : - { - Pcurv = new Geom2d_Ellipse(Projc.Ellipse()); - } - break; - case GeomAbs_Hyperbola : - { - Pcurv = new Geom2d_Hyperbola(Projc.Hyperbola()); - } - break; - case GeomAbs_Parabola : - { - Pcurv = new Geom2d_Parabola(Projc.Parabola()); - } - break; - case GeomAbs_BezierCurve : - { - Pcurv = Projc.Bezier(); - } - break; - case GeomAbs_BSplineCurve : - { - Pcurv = Projc.BSpline(); - } - break; - default: - Standard_NotImplemented::Raise("echec approximation de la pcurve "); - } } } //======================================================================= @@ -1218,10 +1218,10 @@ void ChFi3d_ProjectPCurv(const Handle(Adaptor3d_HCurve)& HCg, //purpose : Controls a posteriori that sameparameter worked well //======================================================================= Standard_Boolean ChFi3d_CheckSameParameter (const Handle(Adaptor3d_HCurve)& C3d, - Handle(Geom2d_Curve)& Pcurv, - const Handle(Adaptor3d_HSurface)& S, - const Standard_Real tol3d, - Standard_Real& tolreached) + Handle(Geom2d_Curve)& Pcurv, + const Handle(Adaptor3d_HSurface)& S, + const Standard_Real tol3d, + Standard_Real& tolreached) { tolreached = 0.; Standard_Real f = C3d->FirstParameter(); @@ -1252,10 +1252,10 @@ Standard_Boolean ChFi3d_CheckSameParameter (const Handle(Adaptor3d_HCurve)& C3 //purpose : Encapsulation of Sameparameter //======================================================================= Standard_Boolean ChFi3d_SameParameter(const Handle(Adaptor3d_HCurve)& C3d, - Handle(Geom2d_Curve)& Pcurv, - const Handle(Adaptor3d_HSurface)& S, - const Standard_Real tol3d, - Standard_Real& tolreached) + Handle(Geom2d_Curve)& Pcurv, + const Handle(Adaptor3d_HSurface)& S, + const Standard_Real tol3d, + Standard_Real& tolreached) { if(ChFi3d_CheckSameParameter(C3d,Pcurv,S,tol3d,tolreached)) return Standard_True; Approx_SameParameter sp(C3d,Pcurv,S,tol3d); @@ -1271,12 +1271,12 @@ Standard_Boolean ChFi3d_SameParameter(const Handle(Adaptor3d_HCurve)& C3d, //purpose : Encapsulation de Sameparameter //======================================================================= Standard_Boolean ChFi3d_SameParameter(const Handle(Geom_Curve)& C3d, - Handle(Geom2d_Curve)& Pcurv, - const Handle(Geom_Surface)& S, - const Standard_Real Pardeb, - const Standard_Real Parfin, - const Standard_Real tol3d, - Standard_Real& tolreached) + Handle(Geom2d_Curve)& Pcurv, + const Handle(Geom_Surface)& S, + const Standard_Real Pardeb, + const Standard_Real Parfin, + const Standard_Real tol3d, + Standard_Real& tolreached) { /*szv:static*/ Handle(GeomAdaptor_HSurface) hs(new GeomAdaptor_HSurface(S)); /*szv:static*/ Handle(GeomAdaptor_HCurve) hc(new GeomAdaptor_HCurve(C3d,Pardeb,Parfin)); @@ -1289,15 +1289,15 @@ Standard_Boolean ChFi3d_SameParameter(const Handle(Geom_Curve)& C3d, // reference 3D curve. //======================================================================= void ChFi3d_ComputePCurv(const Handle(Adaptor3d_HCurve)& C3d, - const gp_Pnt2d& UV1, - const gp_Pnt2d& UV2, - Handle(Geom2d_Curve)& Pcurv, - const Handle(Adaptor3d_HSurface)& S, - const Standard_Real Pardeb, - const Standard_Real Parfin, - const Standard_Real tol3d, - Standard_Real& tolreached, - const Standard_Boolean reverse) + const gp_Pnt2d& UV1, + const gp_Pnt2d& UV2, + Handle(Geom2d_Curve)& Pcurv, + const Handle(Adaptor3d_HSurface)& S, + const Standard_Real Pardeb, + const Standard_Real Parfin, + const Standard_Real tol3d, + Standard_Real& tolreached, + const Standard_Boolean reverse) { ChFi3d_ComputePCurv(UV1,UV2,Pcurv,Pardeb,Parfin,reverse); ChFi3d_SameParameter(C3d,Pcurv,S,tol3d,tolreached); @@ -1309,15 +1309,15 @@ void ChFi3d_ComputePCurv(const Handle(Adaptor3d_HCurve)& C3d, // reference 3D curve. //======================================================================= void ChFi3d_ComputePCurv(const Handle(Geom_Curve)& C3d, - const gp_Pnt2d& UV1, - const gp_Pnt2d& UV2, - Handle(Geom2d_Curve)& Pcurv, - const Handle(Geom_Surface)& S, - const Standard_Real Pardeb, - const Standard_Real Parfin, - const Standard_Real tol3d, - Standard_Real& tolreached, - const Standard_Boolean reverse) + const gp_Pnt2d& UV1, + const gp_Pnt2d& UV2, + Handle(Geom2d_Curve)& Pcurv, + const Handle(Geom_Surface)& S, + const Standard_Real Pardeb, + const Standard_Real Parfin, + const Standard_Real tol3d, + Standard_Real& tolreached, + const Standard_Boolean reverse) { /*szv:static*/ Handle(GeomAdaptor_HSurface) hs(new GeomAdaptor_HSurface(S)); /*szv:static*/ Handle(GeomAdaptor_HCurve) hc(new GeomAdaptor_HCurve(C3d,Pardeb,Parfin)); @@ -1329,11 +1329,11 @@ void ChFi3d_ComputePCurv(const Handle(Geom_Curve)& C3d, // to guarantee the same range. //======================================================================= void ChFi3d_ComputePCurv(const gp_Pnt2d& UV1, - const gp_Pnt2d& UV2, - Handle(Geom2d_Curve)& Pcurv, - const Standard_Real Pardeb, - const Standard_Real Parfin, - const Standard_Boolean reverse) + const gp_Pnt2d& UV2, + Handle(Geom2d_Curve)& Pcurv, + const Standard_Real Pardeb, + const Standard_Real Parfin, + const Standard_Boolean reverse) { const Standard_Real tol = Precision::PConfusion(); gp_Pnt2d p1,p2; @@ -1345,26 +1345,26 @@ void ChFi3d_ComputePCurv(const gp_Pnt2d& UV1, p1 = UV2; p2 = UV1; } - + if (Abs(p1.X()-p2.X()) <= tol && - Abs((p2.Y()-p1.Y())-(Parfin-Pardeb)) <= tol) { - gp_Pnt2d ppp(p1.X(),p1.Y()-Pardeb); - Pcurv = new Geom2d_Line(ppp,gp::DY2d()); + Abs((p2.Y()-p1.Y())-(Parfin-Pardeb)) <= tol) { + gp_Pnt2d ppp(p1.X(),p1.Y()-Pardeb); + Pcurv = new Geom2d_Line(ppp,gp::DY2d()); } else if (Abs(p1.X()-p2.X()) <= tol && - Abs((p1.Y()-p2.Y())-(Parfin-Pardeb)) <= tol) { - gp_Pnt2d ppp(p1.X(),p1.Y()+Pardeb); - Pcurv = new Geom2d_Line(ppp,gp::DY2d().Reversed()); + Abs((p1.Y()-p2.Y())-(Parfin-Pardeb)) <= tol) { + gp_Pnt2d ppp(p1.X(),p1.Y()+Pardeb); + Pcurv = new Geom2d_Line(ppp,gp::DY2d().Reversed()); } else if (Abs(p1.Y()-p2.Y()) <= tol && - Abs((p2.X()-p1.X())-(Parfin-Pardeb)) <= tol) { - gp_Pnt2d ppp(p1.X()-Pardeb,p1.Y()); - Pcurv = new Geom2d_Line(ppp,gp::DX2d()); + Abs((p2.X()-p1.X())-(Parfin-Pardeb)) <= tol) { + gp_Pnt2d ppp(p1.X()-Pardeb,p1.Y()); + Pcurv = new Geom2d_Line(ppp,gp::DX2d()); } else if (Abs(p1.Y()-p2.Y()) <= tol && - Abs((p1.X()-p2.X())-(Parfin-Pardeb)) <= tol) { - gp_Pnt2d ppp(p1.X()+Pardeb,p1.Y()); - Pcurv = new Geom2d_Line(ppp,gp::DX2d().Reversed()); + Abs((p1.X()-p2.X())-(Parfin-Pardeb)) <= tol) { + gp_Pnt2d ppp(p1.X()+Pardeb,p1.Y()); + Pcurv = new Geom2d_Line(ppp,gp::DX2d().Reversed()); } else{ TColgp_Array1OfPnt2d p(1,2); @@ -1384,15 +1384,15 @@ void ChFi3d_ComputePCurv(const gp_Pnt2d& UV1, //purpose : //======================================================================= Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& Fac, - Handle(Geom2d_Curve)& curv, - const Standard_Integer sens1, - const gp_Pnt2d& pfac1, - const gp_Vec2d& vfac1, - const Standard_Integer sens2, - const gp_Pnt2d& pfac2, - const gp_Vec2d& vfac2, - const Standard_Real t3d, - const Standard_Real ta) + Handle(Geom2d_Curve)& curv, + const Standard_Integer sens1, + const gp_Pnt2d& pfac1, + const gp_Vec2d& vfac1, + const Standard_Integer sens2, + const gp_Pnt2d& pfac2, + const gp_Vec2d& vfac2, + const Standard_Real t3d, + const Standard_Real ta) { gp_Dir2d v1(vfac1); if(sens1 == 1) v1.Reverse(); @@ -1406,15 +1406,15 @@ Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& Fac, //purpose : //======================================================================= Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& Surf, - Handle(Geom2d_Curve)& curv, - const Standard_Integer sens1, - const gp_Pnt2d& p1, - gp_Vec& v1, - const Standard_Integer sens2, - const gp_Pnt2d& p2, - gp_Vec& v2, - const Standard_Real t3d, - const Standard_Real ta) + Handle(Geom2d_Curve)& curv, + const Standard_Integer sens1, + const gp_Pnt2d& p1, + gp_Vec& v1, + const Standard_Integer sens2, + const gp_Pnt2d& p2, + gp_Vec& v2, + const Standard_Real t3d, + const Standard_Real ta) { if(sens1 == 1) v1.Reverse(); if(sens2 == 1) v2.Reverse(); @@ -1426,11 +1426,11 @@ Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& Surf, //purpose : //======================================================================= Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Geom_Surface)& s, - const gp_Pnt2d& p1, - const gp_Pnt2d& p2, - const Standard_Real t3d, - const Standard_Real ta, - const Standard_Boolean isfreeboundary) + const gp_Pnt2d& p1, + const gp_Pnt2d& p2, + const Standard_Real t3d, + const Standard_Real ta, + const Standard_Boolean isfreeboundary) { Handle(GeomAdaptor_HSurface) HS = new GeomAdaptor_HSurface(s); return ChFi3d_mkbound(HS,p1,p2,t3d,ta,isfreeboundary); @@ -1440,11 +1440,11 @@ Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Geom_Surface)& s, //purpose : //======================================================================= Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& HS, - const gp_Pnt2d& p1, - const gp_Pnt2d& p2, - const Standard_Real t3d, - const Standard_Real ta, - const Standard_Boolean isfreeboundary) + const gp_Pnt2d& p1, + const gp_Pnt2d& p2, + const Standard_Real t3d, + const Standard_Real ta, + const Standard_Boolean isfreeboundary) { TColgp_Array1OfPnt2d pol(1,2); pol(1)=p1; @@ -1457,10 +1457,10 @@ Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& HS, //purpose : //======================================================================= Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& HS, - const Handle(Geom2d_Curve)& curv, - const Standard_Real t3d, - const Standard_Real ta, - const Standard_Boolean isfreeboundary) + const Handle(Geom2d_Curve)& curv, + const Standard_Real t3d, + const Standard_Real ta, + const Standard_Boolean isfreeboundary) { Handle(Geom2dAdaptor_HCurve) HC = new Geom2dAdaptor_HCurve(curv); Adaptor3d_CurveOnSurface COnS(HC,HS); @@ -1475,12 +1475,12 @@ Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& HS, //purpose : //======================================================================= Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& Fac, - Handle(Geom2d_Curve)& curv, - const gp_Pnt2d& p1, - const gp_Pnt2d& p2, - const Standard_Real t3d, - const Standard_Real ta, - const Standard_Boolean isfreeboundary) + Handle(Geom2d_Curve)& curv, + const gp_Pnt2d& p1, + const gp_Pnt2d& p2, + const Standard_Real t3d, + const Standard_Real ta, + const Standard_Boolean isfreeboundary) { TColgp_Array1OfPnt2d pol(1,2); pol(1)=p1; @@ -1493,10 +1493,10 @@ Handle(GeomFill_Boundary) ChFi3d_mkbound(const Handle(Adaptor3d_HSurface)& Fac, //purpose : //======================================================================= Handle(Geom2d_Curve) ChFi3d_BuildPCurve(const gp_Pnt2d& p1, - gp_Dir2d& d1, - const gp_Pnt2d& p2, - gp_Dir2d& d2, - const Standard_Boolean redresse) + gp_Dir2d& d1, + const gp_Pnt2d& p2, + gp_Dir2d& d2, + const Standard_Boolean redresse) { gp_Vec2d vref(p1,p2); gp_Dir2d dref(vref); @@ -1522,11 +1522,11 @@ Handle(Geom2d_Curve) ChFi3d_BuildPCurve(const gp_Pnt2d& p1, //purpose : //======================================================================= Handle(Geom2d_Curve) ChFi3d_BuildPCurve(const Handle(Adaptor3d_HSurface)& Surf, - const gp_Pnt2d& p1, - const gp_Vec2d& v1, - const gp_Pnt2d& p2, - const gp_Vec2d& v2, - const Standard_Boolean redresse) + const gp_Pnt2d& p1, + const gp_Vec2d& v1, + const gp_Pnt2d& p2, + const gp_Vec2d& v2, + const Standard_Boolean redresse) { gp_Pnt2d pp1 = p1, pp2 = p2; gp_Vec2d vv1 = v1, vv2 = v2; @@ -1554,11 +1554,11 @@ Handle(Geom2d_Curve) ChFi3d_BuildPCurve(const Handle(Adaptor3d_HSurface)& Surf, //purpose : //======================================================================= Handle(Geom2d_Curve) ChFi3d_BuildPCurve(const Handle(Adaptor3d_HSurface)& Surf, - const gp_Pnt2d& p1, - const gp_Vec& v1, - const gp_Pnt2d& p2, - const gp_Vec& v2, - const Standard_Boolean redresse) + const gp_Pnt2d& p1, + const gp_Vec& v1, + const gp_Pnt2d& p2, + const gp_Vec& v2, + const Standard_Boolean redresse) { gp_Vec D1u,D1v; gp_Pnt PP1,PP2; @@ -1593,20 +1593,20 @@ Handle(Geom2d_Curve) ChFi3d_BuildPCurve(const Handle(Adaptor3d_HSurface)& Surf, // //======================================================================= void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, - const gp_Pnt2d& UV1, - const ChFiDS_CommonPoint& P2, - const gp_Pnt2d& UV2, - const Handle(Geom_Surface)& Surf, - Handle(Geom_Curve)& C3d, - Handle(Geom2d_Curve)& Pcurv, - Standard_Real& Pardeb, - Standard_Real& Parfin, - const Standard_Real tol3d, - const Standard_Real tol2d, - Standard_Real& tolreached, - const Standard_Integer IFlag) - // IFlag=0 pcurve et courbe 3d - // IFlag>0 pcurve (parametrage impose si IFlag=2) + const gp_Pnt2d& UV1, + const ChFiDS_CommonPoint& P2, + const gp_Pnt2d& UV2, + const Handle(Geom_Surface)& Surf, + Handle(Geom_Curve)& C3d, + Handle(Geom2d_Curve)& Pcurv, + Standard_Real& Pardeb, + Standard_Real& Parfin, + const Standard_Real tol3d, + const Standard_Real tol2d, + Standard_Real& tolreached, + const Standard_Integer IFlag) + // IFlag=0 pcurve et courbe 3d + // IFlag>0 pcurve (parametrage impose si IFlag=2) { /*szv:static*/ Handle(GeomAdaptor_HSurface) hs(new GeomAdaptor_HSurface()); /*szv:static*/ Handle(GeomAdaptor_HCurve) hc(new GeomAdaptor_HCurve()); @@ -1619,17 +1619,17 @@ void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, Parfin = UV2.Y(); C3d = Surf->UIso(UV1.X()); if(Pardeb > Parfin) { - Pardeb = C3d->ReversedParameter(Pardeb); - Parfin = C3d->ReversedParameter(Parfin); - C3d->Reverse(); + Pardeb = C3d->ReversedParameter(Pardeb); + Parfin = C3d->ReversedParameter(Parfin); + C3d->Reverse(); } Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C3d); if(!tc.IsNull()) { - C3d = tc->BasisCurve(); - if (C3d->IsPeriodic()) { - ElCLib::AdjustPeriodic(C3d->FirstParameter(),C3d->LastParameter(), - tol2d,Pardeb,Parfin); - } + C3d = tc->BasisCurve(); + if (C3d->IsPeriodic()) { + ElCLib::AdjustPeriodic(C3d->FirstParameter(),C3d->LastParameter(), + tol2d,Pardeb,Parfin); + } } } if(IFlag != 1) { @@ -1648,17 +1648,17 @@ void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, Parfin = UV2.X(); C3d = Surf->VIso(UV1.Y()); if(Pardeb > Parfin) { - Pardeb = C3d->ReversedParameter(Pardeb); - Parfin = C3d->ReversedParameter(Parfin); - C3d->Reverse(); + Pardeb = C3d->ReversedParameter(Pardeb); + Parfin = C3d->ReversedParameter(Parfin); + C3d->Reverse(); } Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C3d); if(!tc.IsNull()) { - C3d = tc->BasisCurve(); - if (C3d->IsPeriodic()) { - ElCLib::AdjustPeriodic(C3d->FirstParameter(),C3d->LastParameter(), - tol2d,Pardeb,Parfin); - } + C3d = tc->BasisCurve(); + if (C3d->IsPeriodic()) { + ElCLib::AdjustPeriodic(C3d->FirstParameter(),C3d->LastParameter(), + tol2d,Pardeb,Parfin); + } } } if(IFlag != 1) { @@ -1673,8 +1673,8 @@ void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, else if (IFlag == 0) { if (P1.IsVertex() || P2.IsVertex() || !P1.IsOnArc() || !P2.IsOnArc()) { - // A straight line is constructed to avoid - // arc and tangent. + // A straight line is constructed to avoid + // arc and tangent. TColgp_Array1OfPnt2d qoles(1,2); qoles(1)=UV1; qoles(2)=UV2; @@ -1702,12 +1702,12 @@ void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, Standard_Boolean aIN = Standard_True; for(Standard_Integer ii = 1; ii <= 4 && aIN; ii++) { if(bs.IsOut((*((Handle(Geom2d_BezierCurve)*) &Pcurv))->Pole(ii))) { - aIN = Standard_False; - TColgp_Array1OfPnt2d qoles(1,2); - qoles(1)=UV1; - qoles(2)=UV2; - Pcurv = new Geom2d_BezierCurve(qoles); - } + aIN = Standard_False; + TColgp_Array1OfPnt2d qoles(1,2); + qoles(1)=UV1; + qoles(2)=UV2; + Pcurv = new Geom2d_BezierCurve(qoles); + } } } Geom2dAdaptor_Curve AC(Pcurv); @@ -1738,16 +1738,16 @@ void ChFi3d_ComputeArete(const ChFiDS_CommonPoint& P1, //purpose : //======================================================================= Handle(TopOpeBRepDS_SurfaceCurveInterference) ChFi3d_FilCurveInDS -(const Standard_Integer Icurv, - const Standard_Integer Isurf, - const Handle(Geom2d_Curve)& Pcurv, - const TopAbs_Orientation Et) + (const Standard_Integer Icurv, + const Standard_Integer Isurf, + const Handle(Geom2d_Curve)& Pcurv, + const TopAbs_Orientation Et) { Handle(TopOpeBRepDS_SurfaceCurveInterference) SC1; SC1 = new TopOpeBRepDS_SurfaceCurveInterference(TopOpeBRepDS_Transition(Et), - TopOpeBRepDS_SURFACE, - Isurf,TopOpeBRepDS_CURVE,Icurv, - Pcurv); + TopOpeBRepDS_SURFACE, + Isurf,TopOpeBRepDS_CURVE,Icurv, + Pcurv); return SC1; } //======================================================================= @@ -1758,10 +1758,10 @@ Handle(TopOpeBRepDS_SurfaceCurveInterference) ChFi3d_FilCurveInDS TopAbs_Orientation ChFi3d_TrsfTrans(const IntSurf_TypeTrans T1) { switch (T1) { - case IntSurf_In: return TopAbs_FORWARD; - case IntSurf_Out: return TopAbs_REVERSED; - default: - break; + case IntSurf_In: return TopAbs_FORWARD; + case IntSurf_Out: return TopAbs_REVERSED; + default: + break; } return TopAbs_INTERNAL; } @@ -1771,12 +1771,12 @@ TopAbs_Orientation ChFi3d_TrsfTrans(const IntSurf_TypeTrans T1) // management of the case when it happens on already existing vertex. //======================================================================= Standard_EXPORT void ChFi3d_FilCommonPoint(const BRepBlend_Extremity& SP, - const IntSurf_TypeTrans TransLine, - const Standard_Boolean Start, - ChFiDS_CommonPoint& CP, - const Standard_Real Tol) + const IntSurf_TypeTrans TransLine, + const Standard_Boolean Start, + ChFiDS_CommonPoint& CP, + const Standard_Real Tol) { -// BRep_Tool Outil; + // BRep_Tool Outil; Standard_Real Dist, maxtol = Max(Tol,CP.Tolerance()); CP.SetPoint(SP.Value()); // One starts with the point and the vector @@ -1788,14 +1788,14 @@ Standard_EXPORT void ChFi3d_FilCommonPoint(const BRepBlend_Extremity& SP, CP.SetVector(SP.Tangent()); } } - + CP.SetParameter(SP.ParameterOnGuide()); // and the parameter of the spine if (SP.IsVertex()) { // the Vertex is loaded if required - // (inside of a face) + // (inside of a face) TopoDS_Vertex V = Handle(BRepTopAdaptor_HVertex)::DownCast(SP.Vertex())->Vertex(); - + CP.SetVertex(V); Dist = (SP.Value()).Distance(BRep_Tool::Pnt(V)); //// modified by jgv, 18.09.02 for OCC571 //// @@ -1803,11 +1803,11 @@ Standard_EXPORT void ChFi3d_FilCommonPoint(const BRepBlend_Extremity& SP, maxtol = Max( Dist, maxtol ); ////////////////////////////////////////////// CP.SetPoint(BRep_Tool::Pnt(V)); - + //the sequence of arcs the information is known by thee vertex (ancestor) //in this case the transitions are not computed, it is done by this program } - + if (SP.NbPointOnRst() != 0) { // An arc, and/or a vertex is loaded const BRepBlend_PointOnRst& PR = SP.PointOnRst(1); @@ -1825,35 +1825,35 @@ Standard_EXPORT void ChFi3d_FilCommonPoint(const BRepBlend_Extremity& SP, DistF = (SP.Value()).Distance(BRep_Tool::Pnt(V[0])); DistL = (SP.Value()).Distance(BRep_Tool::Pnt(V[1])); if (DistFNbEdges() == 0) Standard_Failure::Raise("SolidIndex : Spine incomplete"); @@ -1884,7 +1884,7 @@ Standard_Integer ChFi3d_SolidIndex(const Handle(ChFiDS_Spine)& sp, //purpose : //======================================================================= Standard_Integer ChFi3d_IndexPointInDS(const ChFiDS_CommonPoint& P1, - TopOpeBRepDS_DataStructure& DStr) + TopOpeBRepDS_DataStructure& DStr) { if (P1.IsVertex()) { // ---------------------------------> !*!*!* @@ -1901,21 +1901,21 @@ Standard_Integer ChFi3d_IndexPointInDS(const ChFiDS_CommonPoint& P1, //purpose : //======================================================================= Handle(TopOpeBRepDS_CurvePointInterference) - ChFi3d_FilPointInDS(const TopAbs_Orientation Et, - const Standard_Integer Ic, - const Standard_Integer Ip, - const Standard_Real Par, - const Standard_Boolean IsVertex) + ChFi3d_FilPointInDS(const TopAbs_Orientation Et, + const Standard_Integer Ic, + const Standard_Integer Ip, + const Standard_Real Par, + const Standard_Boolean IsVertex) { Handle(TopOpeBRepDS_CurvePointInterference) CP1; if (IsVertex) CP1 = new TopOpeBRepDS_CurvePointInterference (TopOpeBRepDS_Transition(Et), - TopOpeBRepDS_CURVE,Ic, - TopOpeBRepDS_VERTEX,Ip,Par); + TopOpeBRepDS_CURVE,Ic, + TopOpeBRepDS_VERTEX,Ip,Par); else CP1 = new TopOpeBRepDS_CurvePointInterference (TopOpeBRepDS_Transition(Et), - TopOpeBRepDS_CURVE,Ic, - TopOpeBRepDS_POINT,Ip,Par); + TopOpeBRepDS_CURVE,Ic, + TopOpeBRepDS_POINT,Ip,Par); return CP1; } //======================================================================= @@ -1923,16 +1923,16 @@ Handle(TopOpeBRepDS_CurvePointInterference) //purpose : //======================================================================= Handle(TopOpeBRepDS_CurvePointInterference) - ChFi3d_FilVertexInDS(const TopAbs_Orientation Et, - const Standard_Integer Ic, - const Standard_Integer Ip, - const Standard_Real Par) + ChFi3d_FilVertexInDS(const TopAbs_Orientation Et, + const Standard_Integer Ic, + const Standard_Integer Ip, + const Standard_Real Par) { - + Handle(TopOpeBRepDS_CurvePointInterference) CP1 = new TopOpeBRepDS_CurvePointInterference (TopOpeBRepDS_Transition(Et), - TopOpeBRepDS_CURVE,Ic, - TopOpeBRepDS_VERTEX,Ip,Par); + TopOpeBRepDS_CURVE,Ic, + TopOpeBRepDS_VERTEX,Ip,Par); return CP1; } //======================================================================= @@ -1943,11 +1943,11 @@ Handle(TopOpeBRepDS_CurvePointInterference) static Standard_Boolean ChFi3d_Orientation(const TopOpeBRepDS_ListOfInterference& LI, - const Standard_Integer igros, - const Standard_Integer ipetit, - TopAbs_Orientation& Or, - const Standard_Boolean isvertex = Standard_False, - const Standard_Boolean aprendre = Standard_False) + const Standard_Integer igros, + const Standard_Integer ipetit, + TopAbs_Orientation& Or, + const Standard_Boolean isvertex = Standard_False, + const Standard_Boolean aprendre = Standard_False) { //In case, when it is necessary to insert a point/vertex, it should be //known if this is a point or a vertex, because their index can be the same. @@ -1966,14 +1966,14 @@ static Standard_Boolean cur->GKGSKS(GK,G,SK,S); if (aprendre) { if ( S == igros && G == ipetit && GK == typepetit) { - Or = cur->Transition().Orientation(TopAbs_IN); - return Standard_True; + Or = cur->Transition().Orientation(TopAbs_IN); + return Standard_True; } } else { if ( S == igros && G == ipetit) { - Or = cur->Transition().Orientation(TopAbs_IN); - return Standard_True; + Or = cur->Transition().Orientation(TopAbs_IN); + return Standard_True; } } } @@ -1986,11 +1986,11 @@ static Standard_Boolean //==================================================================== static Standard_Boolean ChFi3d_Contains -(const TopOpeBRepDS_ListOfInterference& LI, - const Standard_Integer igros, - const Standard_Integer ipetit, - const Standard_Boolean isvertex = Standard_False, - const Standard_Boolean aprendre = Standard_False) + (const TopOpeBRepDS_ListOfInterference& LI, + const Standard_Integer igros, + const Standard_Integer ipetit, + const Standard_Boolean isvertex = Standard_False, + const Standard_Boolean aprendre = Standard_False) { TopAbs_Orientation bidOr; return ChFi3d_Orientation(LI,igros,ipetit,bidOr,isvertex,aprendre); @@ -2000,10 +2000,10 @@ static Standard_Boolean ChFi3d_Contains //purpose : //======================================================================= static void QueryAddVertexInEdge(TopOpeBRepDS_ListOfInterference& LI, - const Standard_Integer IC, - const Standard_Integer IV, - const Standard_Real par, - const TopAbs_Orientation Or) + const Standard_Integer IC, + const Standard_Integer IV, + const Standard_Real par, + const TopAbs_Orientation Or) { TopOpeBRepDS_ListIteratorOfListOfInterference it(LI); for (; it.More(); it.Next() ) { @@ -2016,8 +2016,8 @@ static void QueryAddVertexInEdge(TopOpeBRepDS_ListOfInterference& LI, TopAbs_Orientation newOr = cpi->Transition().Orientation(TopAbs_IN); Standard_Real newpar = cpi->Parameter(); if(IV == newIV && kv == TopOpeBRepDS_VERTEX && - Or == newOr && Abs(par - newpar) < 1.e-10) { - return; + Or == newOr && Abs(par - newpar) < 1.e-10) { + return; } } } @@ -2031,10 +2031,10 @@ static void QueryAddVertexInEdge(TopOpeBRepDS_ListOfInterference& LI, //purpose : //======================================================================= static void CutEdge(const TopoDS_Vertex& V, - const Handle(ChFiDS_SurfData)& SD, - TopOpeBRepDS_DataStructure& DStr, - const Standard_Boolean , - const Standard_Integer ons) + const Handle(ChFiDS_SurfData)& SD, + TopOpeBRepDS_DataStructure& DStr, + const Standard_Boolean , + const Standard_Integer ons) { if(!SD->IsOnCurve(ons)) return; Standard_Integer IC = SD->IndexOfC(ons); @@ -2061,15 +2061,15 @@ static void CutEdge(const TopoDS_Vertex& V, //======================================================================= static Standard_Boolean findIndexPoint(const TopOpeBRepDS_DataStructure& DStr, - const Handle(ChFiDS_SurfData)& Fd, - const Standard_Integer OnS, - Standard_Integer& ipoin) + const Handle(ChFiDS_SurfData)& Fd, + const Standard_Integer OnS, + Standard_Integer& ipoin) { ipoin = 0; gp_Pnt P = Fd->Vertex(Standard_False,OnS).Point(); TopOpeBRepDS_ListIteratorOfListOfInterference SCIIt, CPIIt; - + SCIIt.Initialize (DStr.SurfaceInterferences(Fd->Surf())); for (; SCIIt.More(); SCIIt.Next()) { Handle(TopOpeBRepDS_SurfaceCurveInterference) SCI = @@ -2078,13 +2078,13 @@ static Standard_Boolean CPIIt.Initialize (DStr.CurveInterferences(SCI->Geometry())); for (; CPIIt.More(); CPIIt.Next()) { Handle(TopOpeBRepDS_CurvePointInterference) CPI = - Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(CPIIt.Value()); + Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(CPIIt.Value()); if (CPI.IsNull()) continue; Standard_Integer iPoint = CPI->Geometry(); TopOpeBRepDS_Point tp = DStr.Point(iPoint); if (P.IsEqual(tp.Point(), tp.Tolerance())) { - ipoin = iPoint; - return Standard_True; + ipoin = iPoint; + return Standard_True; } } } @@ -2095,13 +2095,13 @@ static Standard_Boolean //purpose : //======================================================================= void ChFi3d_FilDS(const Standard_Integer SolidIndex, - const Handle(ChFiDS_Stripe)& CorDat, - TopOpeBRepDS_DataStructure& DStr, - ChFiDS_Regularities& reglist, - const Standard_Real tol3d, - const Standard_Real tol2d) + const Handle(ChFiDS_Stripe)& CorDat, + TopOpeBRepDS_DataStructure& DStr, + ChFiDS_Regularities& reglist, + const Standard_Real tol3d, + const Standard_Real tol2d) { -// BRep_Tool Outil; + // BRep_Tool Outil; TopExp_Explorer ex; Handle(ChFiDS_Spine) spine = CorDat->Spine(); Standard_Boolean Closed = Standard_False; @@ -2146,25 +2146,25 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, Handle(ChFiDS_SurfData) Fd = SeqFil(j); Standard_Integer onS; for (onS=1; onS<=2; onS++) { - const ChFiDS_FaceInterference& Fi = Fd->Interference(onS); - IcFil1 = Fi.LineIndex(); - if (!IcFil1) continue; - Standard_Real FiLen = Abs(Fi.FirstParameter()-Fi.LastParameter()); - if (FiLen > Precision::PConfusion()) continue; - TopOpeBRepDS_Curve& cc = DStr.ChangeCurve(IcFil1); - cc.ChangeCurve().Nullify(); + const ChFiDS_FaceInterference& Fi = Fd->Interference(onS); + IcFil1 = Fi.LineIndex(); + if (!IcFil1) continue; + Standard_Real FiLen = Abs(Fi.FirstParameter()-Fi.LastParameter()); + if (FiLen > Precision::PConfusion()) continue; + TopOpeBRepDS_Curve& cc = DStr.ChangeCurve(IcFil1); + cc.ChangeCurve().Nullify(); - // care of CommonPoint, eap occ354 - if (j!=1 && j!=SeqFil.Length()) continue; - Standard_Boolean isfirst = (j==1); - Standard_Integer i = isfirst ? j+1 : j-1; - ChFiDS_CommonPoint& CP1 = SeqFil(i)->ChangeVertex(isfirst,onS); - if (Fd->Vertex(isfirst,onS).IsOnArc() && CP1.IsOnArc()) { - ChFiDS_CommonPoint& CP2 = Fd->ChangeVertex(!isfirst,onS); - CP1.Reset(); - CP1.SetPoint(CP2.Point()); - CP2.Reset(); - CP2.SetPoint(CP1.Point()); + // care of CommonPoint, eap occ354 + if (j!=1 && j!=SeqFil.Length()) continue; + Standard_Boolean isfirst = (j==1); + Standard_Integer i = isfirst ? j+1 : j-1; + ChFiDS_CommonPoint& CP1 = SeqFil(i)->ChangeVertex(isfirst,onS); + if (Fd->Vertex(isfirst,onS).IsOnArc() && CP1.IsOnArc()) { + ChFiDS_CommonPoint& CP2 = Fd->ChangeVertex(!isfirst,onS); + CP1.Reset(); + CP1.SetPoint(CP2.Point()); + CP2.Reset(); + CP2.SetPoint(CP1.Point()); } } } @@ -2189,19 +2189,19 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, isInDS2 = Standard_True; isInDS1 = isInDS1 || SeqFil.Length()-j+1 < CorDat->IsInDS(Standard_False); } - + // creation of SolidSurfaceInterference - + Handle(TopOpeBRepDS_SolidSurfaceInterference) SSI = new TopOpeBRepDS_SolidSurfaceInterference - (TopOpeBRepDS_Transition(Fd->Orientation()), - TopOpeBRepDS_SOLID, - SolidIndex, - TopOpeBRepDS_SURFACE, - Isurf); - + (TopOpeBRepDS_Transition(Fd->Orientation()), + TopOpeBRepDS_SOLID, + SolidIndex, + TopOpeBRepDS_SURFACE, + Isurf); + SolidInterfs.Append(SSI); - + const ChFiDS_FaceInterference& Fi1 = Fd->InterferenceOnS1(); const ChFiDS_FaceInterference& Fi2 = Fd->InterferenceOnS2(); const ChFiDS_CommonPoint& V1 = Fd->VertexFirstOnS1(); @@ -2210,34 +2210,34 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, // Processing to manage double interferences if (j>1) { if (V1.IsOnArc() && V3.IsOnArc() && V1.Arc().IsSame(V3.Arc())) { - //Iarc1 is initialized - //Iarc1 = DStr.AddShape(V1.Arc()); - if (ChFi3d_Contains(DStr.ShapeInterferences(Iarc1),Iarc1,Ipoin1) && - (V1.TransitionOnArc() != V3.TransitionOnArc()) ) { - Interfp1= ChFi3d_FilPointInDS(V1.TransitionOnArc(),Iarc1,Ipoin1, - V1.ParameterOnArc()); - DStr.ChangeShapeInterferences(V1.Arc()).Append(Interfp1); - } + //Iarc1 is initialized + //Iarc1 = DStr.AddShape(V1.Arc()); + if (ChFi3d_Contains(DStr.ShapeInterferences(Iarc1),Iarc1,Ipoin1) && + (V1.TransitionOnArc() != V3.TransitionOnArc()) ) { + Interfp1= ChFi3d_FilPointInDS(V1.TransitionOnArc(),Iarc1,Ipoin1, + V1.ParameterOnArc()); + DStr.ChangeShapeInterferences(V1.Arc()).Append(Interfp1); + } } if (V2.IsOnArc() && V4.IsOnArc() && V2.Arc().IsSame(V4.Arc())) { - //Iarc2 is initialized - //Iarc2 = DStr.AddShape(V2.Arc()); - if ( ChFi3d_Contains(DStr.ShapeInterferences(Iarc2),Iarc2,Ipoin2) && - (V2.TransitionOnArc() != V4.TransitionOnArc()) ) { - Interfp2= ChFi3d_FilPointInDS(V2.TransitionOnArc(),Iarc2,Ipoin2, - V2.ParameterOnArc()); - DStr.ChangeShapeInterferences(V2.Arc()).Append(Interfp2); - } + //Iarc2 is initialized + //Iarc2 = DStr.AddShape(V2.Arc()); + if ( ChFi3d_Contains(DStr.ShapeInterferences(Iarc2),Iarc2,Ipoin2) && + (V2.TransitionOnArc() != V4.TransitionOnArc()) ) { + Interfp2= ChFi3d_FilPointInDS(V2.TransitionOnArc(),Iarc2,Ipoin2, + V2.ParameterOnArc()); + DStr.ChangeShapeInterferences(V2.Arc()).Append(Interfp2); + } } } V3 = Fd->VertexLastOnS1(); V4 = Fd->VertexLastOnS2(); - + if(Ishape1 != 0) { if(Ishape1 > 0) { - trafil1 = DStr.Shape(Ishape1).Orientation(); + trafil1 = DStr.Shape(Ishape1).Orientation(); } else{ ChFi3d_Orientation(SolidInterfs,SolidIndex,-Ishape1,trafil1); @@ -2248,7 +2248,7 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, } else{ if(Ishape2 > 0) { - trafil2 = DStr.Shape(Ishape2).Orientation(); + trafil2 = DStr.Shape(Ishape2).Orientation(); } else{ ChFi3d_Orientation(SolidInterfs,SolidIndex,-Ishape2,trafil2); @@ -2257,9 +2257,9 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, trafil2 = TopAbs::Compose(TopAbs::Reverse(Fi2.Transition()),trafil2); trafil1 = TopAbs::Reverse(trafil2); } - + ET1 = TopAbs::Reverse(trafil1); - + // A small paragraph to process contacts of edges, which touch // a vertex of the obstacle. if(V1.IsVertex() && Fd->IsOnCurve1()) { @@ -2278,103 +2278,103 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, const TopoDS_Vertex& vv4 = V4.Vertex(); CutEdge(vv4,Fd,DStr,0,2); } - + if (j == 1) { isVertex1 = V1.IsVertex(); isVertex2 = V2.IsVertex(); Singulier_en_Bout = (V1.Point().IsEqual(V2.Point(), 0)); - + if (Singulier_en_Bout) { - // Queue de Billard - if ((!V1.IsVertex()) || (!V2.IsVertex())) { + // Queue de Billard + if ((!V1.IsVertex()) || (!V2.IsVertex())) { - } - else { - isVertex1 = isVertex2 = Standard_True; //caution... - // The edge is removed from spine starting on this vertex. - TopoDS_Edge Arcspine = spine->Edges(1); - BoutdeVtx = V1.Vertex(); - Standard_Integer IArcspine = DStr.AddShape(Arcspine); - Standard_Integer IVtx = CorDat->IndexFirstPointOnS1(); + } + else { + isVertex1 = isVertex2 = Standard_True; //caution... + // The edge is removed from spine starting on this vertex. + TopoDS_Edge Arcspine = spine->Edges(1); + BoutdeVtx = V1.Vertex(); + Standard_Integer IArcspine = DStr.AddShape(Arcspine); + Standard_Integer IVtx = CorDat->IndexFirstPointOnS1(); - TopAbs_Orientation OVtx = TopAbs_FORWARD;; + TopAbs_Orientation OVtx = TopAbs_FORWARD;; - for(ex.Init(Arcspine.Oriented(TopAbs_FORWARD),TopAbs_VERTEX); - ex.More(); ex.Next()) { - if(BoutdeVtx.IsSame(ex.Current())) { - OVtx = ex.Current().Orientation(); - break; - } - } - OVtx = TopAbs::Reverse(OVtx); - Standard_Real parVtx = BRep_Tool::Parameter(BoutdeVtx,Arcspine); - Handle(TopOpeBRepDS_CurvePointInterference) - interfv = ChFi3d_FilVertexInDS(OVtx,IArcspine,IVtx,parVtx); - DStr.ChangeShapeInterferences(IArcspine).Append(interfv); - } - } + for(ex.Init(Arcspine.Oriented(TopAbs_FORWARD),TopAbs_VERTEX); + ex.More(); ex.Next()) { + if(BoutdeVtx.IsSame(ex.Current())) { + OVtx = ex.Current().Orientation(); + break; + } + } + OVtx = TopAbs::Reverse(OVtx); + Standard_Real parVtx = BRep_Tool::Parameter(BoutdeVtx,Arcspine); + Handle(TopOpeBRepDS_CurvePointInterference) + interfv = ChFi3d_FilVertexInDS(OVtx,IArcspine,IVtx,parVtx); + DStr.ChangeShapeInterferences(IArcspine).Append(interfv); + } + } else { - if (V1.IsOnArc()) { - Iarc1 = DStr.AddShape(V1.Arc()); - if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc1),Iarc1,Ipoin1) ) { - Interfp1= ChFi3d_FilPointInDS(V1.TransitionOnArc(),Iarc1,Ipoin1, - V1.ParameterOnArc(), isVertex1); - DStr.ChangeShapeInterferences(V1.Arc()).Append(Interfp1); - } - } + if (V1.IsOnArc()) { + Iarc1 = DStr.AddShape(V1.Arc()); + if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc1),Iarc1,Ipoin1) ) { + Interfp1= ChFi3d_FilPointInDS(V1.TransitionOnArc(),Iarc1,Ipoin1, + V1.ParameterOnArc(), isVertex1); + DStr.ChangeShapeInterferences(V1.Arc()).Append(Interfp1); + } + } - if (V2.IsOnArc()) { - Iarc2 = DStr.AddShape(V2.Arc()); - if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc2),Iarc2,Ipoin2) ) { - Interfp2= ChFi3d_FilPointInDS(V2.TransitionOnArc(),Iarc2,Ipoin2, - V2.ParameterOnArc(),isVertex2); - DStr.ChangeShapeInterferences(V2.Arc()).Append(Interfp2); - } - } + if (V2.IsOnArc()) { + Iarc2 = DStr.AddShape(V2.Arc()); + if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc2),Iarc2,Ipoin2) ) { + Interfp2= ChFi3d_FilPointInDS(V2.TransitionOnArc(),Iarc2,Ipoin2, + V2.ParameterOnArc(),isVertex2); + DStr.ChangeShapeInterferences(V2.Arc()).Append(Interfp2); + } + } } if (!isInDS1) { - ET1 = TopAbs::Compose(ET1,CorDat->FirstPCurveOrientation()); - Icurv = CorDat->FirstCurve(); - if(Closed && !Singulier_en_Bout) { - regcout.SetCurve(Icurv); - regcout.SetS1(Isurf,Standard_False); - } - PCurv = CorDat->FirstPCurve(); - CorDat->FirstParameters(Pardeb,Parfin); - - TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(Icurv); - if (Li.IsEmpty()) { - if(CorDat->FirstPCurveOrientation()==TopAbs_REVERSED) { - Interfp1=ChFi3d_FilPointInDS - (TopAbs_REVERSED,Icurv,Ipoin1,Parfin,isVertex1); - Interfp2=ChFi3d_FilPointInDS - (TopAbs_FORWARD,Icurv,Ipoin2,Pardeb,isVertex2); - } - else{ - Interfp1=ChFi3d_FilPointInDS - (TopAbs_FORWARD,Icurv,Ipoin1,Pardeb,isVertex1); - Interfp2=ChFi3d_FilPointInDS - (TopAbs_REVERSED,Icurv,Ipoin2,Parfin,isVertex2); - } - Li.Append(Interfp1); - Li.Append(Interfp2); - } - Interfc1= ChFi3d_FilCurveInDS (Icurv,Isurf,PCurv,ET1); - DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc1); + ET1 = TopAbs::Compose(ET1,CorDat->FirstPCurveOrientation()); + Icurv = CorDat->FirstCurve(); + if(Closed && !Singulier_en_Bout) { + regcout.SetCurve(Icurv); + regcout.SetS1(Isurf,Standard_False); + } + PCurv = CorDat->FirstPCurve(); + CorDat->FirstParameters(Pardeb,Parfin); + + TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(Icurv); + if (Li.IsEmpty()) { + if(CorDat->FirstPCurveOrientation()==TopAbs_REVERSED) { + Interfp1=ChFi3d_FilPointInDS + (TopAbs_REVERSED,Icurv,Ipoin1,Parfin,isVertex1); + Interfp2=ChFi3d_FilPointInDS + (TopAbs_FORWARD,Icurv,Ipoin2,Pardeb,isVertex2); + } + else{ + Interfp1=ChFi3d_FilPointInDS + (TopAbs_FORWARD,Icurv,Ipoin1,Pardeb,isVertex1); + Interfp2=ChFi3d_FilPointInDS + (TopAbs_REVERSED,Icurv,Ipoin2,Parfin,isVertex2); + } + Li.Append(Interfp1); + Li.Append(Interfp2); + } + Interfc1= ChFi3d_FilCurveInDS (Icurv,Isurf,PCurv,ET1); + DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc1); if (Ipoin1 == Ipoin2) { - TopOpeBRepDS_Curve& TCurv = DStr.ChangeCurve(Icurv); - TCurv.ChangeCurve().Nullify(); - Handle(TopOpeBRepDS_Interference) bidinterf; - TCurv.SetSCI(Interfc1,bidinterf); - } + TopOpeBRepDS_Curve& TCurv = DStr.ChangeCurve(Icurv); + TCurv.ChangeCurve().Nullify(); + Handle(TopOpeBRepDS_Interference) bidinterf; + TCurv.SetSCI(Interfc1,bidinterf); + } } } // End of the Initial Processing (j==1) else { // ---- Interference between Fillets ------ - + if (!isInDS1) {// eap, Apr 29 2002, occ 293 - + if (Degene && isVertex1) { // The edge is removed from the spine starting on this vertex. NumEdge++; // The previous edge of the vertex has already been found. @@ -2383,11 +2383,11 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, Standard_Integer IVtx = DStr.AddShape(BoutdeVtx); TopAbs_Orientation OVtx = TopAbs_FORWARD; for(ex.Init(Arcspine.Oriented(TopAbs_FORWARD),TopAbs_VERTEX); - ex.More(); ex.Next()) { - if(BoutdeVtx.IsSame(ex.Current())) { - OVtx = ex.Current().Orientation(); - break; - } + ex.More(); ex.Next()) { + if(BoutdeVtx.IsSame(ex.Current())) { + OVtx = ex.Current().Orientation(); + break; + } } OVtx = TopAbs::Reverse(OVtx); Standard_Real parVtx = BRep_Tool::Parameter(BoutdeVtx,Arcspine); @@ -2415,242 +2415,242 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, reglist.Append(regfilfil); Standard_Real tolreached; ChFi3d_ComputePCurv(TCurv.ChangeCurve(),UV1,UV2,PCurv, - DStr.Surface(Fd->Surf()).Surface(), - Pardeb,Parfin,tol3d,tolreached); + DStr.Surface(Fd->Surf()).Surface(), + Pardeb,Parfin,tol3d,tolreached); TCurv.Tolerance(Max(TCurv.Tolerance(),tolreached)); Interfc1= ChFi3d_FilCurveInDS (Icurv,Isurf,PCurv,ET1); DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc1); } } } // End of Interference between fillets - + // ---- Interference Fillets / Faces IcFil1 = Fi1.LineIndex(); - + if (IcFil1!=0 ) { Interfc3= ChFi3d_FilCurveInDS (IcFil1,Isurf, - Fi1.PCurveOnSurf(),trafil1); + Fi1.PCurveOnSurf(),trafil1); DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc3); Ishape1 = Fd->IndexOfS1(); // Case of degenerated edge : pcurve is associated via SCI // to TopOpeBRepDSCurve. TopOpeBRepDS_Curve& cc = DStr.ChangeCurve(IcFil1); if(cc.Curve().IsNull()) { - Handle(TopOpeBRepDS_Interference) bidinterf; - cc.SetSCI(Interfc3,bidinterf); + Handle(TopOpeBRepDS_Interference) bidinterf; + cc.SetSCI(Interfc3,bidinterf); } else{ - ChFiDS_Regul regon1; - regon1.SetCurve(IcFil1); - regon1.SetS1(Isurf,Standard_False); - if ( Ishape1 < 0 ) { - Ishape1 = -Ishape1; - regon1.SetS2(Ishape1,Standard_False); - Interfc1=ChFi3d_FilCurveInDS(IcFil1,Ishape1,Fi1.PCurveOnFace(), - Fi1.Transition()); - DStr.ChangeSurfaceInterferences(Ishape1).Append(Interfc1); - } - else if ( Ishape1 > 0 ) { - regon1.SetS2(Ishape1,Standard_True); - Interfc1=ChFi3d_FilCurveInDS(IcFil1,Ishape1,Fi1.PCurveOnFace(), - Fi1.Transition()); - DStr.ChangeShapeInterferences(Ishape1).Append(Interfc1); - } - reglist.Append(regon1); + ChFiDS_Regul regon1; + regon1.SetCurve(IcFil1); + regon1.SetS1(Isurf,Standard_False); + if ( Ishape1 < 0 ) { + Ishape1 = -Ishape1; + regon1.SetS2(Ishape1,Standard_False); + Interfc1=ChFi3d_FilCurveInDS(IcFil1,Ishape1,Fi1.PCurveOnFace(), + Fi1.Transition()); + DStr.ChangeSurfaceInterferences(Ishape1).Append(Interfc1); + } + else if ( Ishape1 > 0 ) { + regon1.SetS2(Ishape1,Standard_True); + Interfc1=ChFi3d_FilCurveInDS(IcFil1,Ishape1,Fi1.PCurveOnFace(), + Fi1.Transition()); + DStr.ChangeShapeInterferences(Ishape1).Append(Interfc1); + } + reglist.Append(regon1); } // Indice and type of the point at End Standard_Integer ipoin; Standard_Boolean isVertex = Fd->VertexLastOnS1().IsVertex(); if (j == SeqFil.Length()) ipoin = CorDat->IndexLastPointOnS1(); else if ( j == (SeqFil.Length()-1) && /*Closed &&*/ - (DStr.Curve(SeqFil.Last()->InterferenceOnS1(). - LineIndex()).Curve().IsNull())) { - if (Closed) { - ipoin = CorDat->IndexFirstPointOnS1(); - isVertex = SeqFil(1)->VertexFirstOnS1().IsVertex(); - } else { - ipoin = CorDat->IndexLastPointOnS1(); - isVertex = SeqFil.Last()->VertexLastOnS1().IsVertex(); - } + (DStr.Curve(SeqFil.Last()->InterferenceOnS1(). + LineIndex()).Curve().IsNull())) { + if (Closed) { + ipoin = CorDat->IndexFirstPointOnS1(); + isVertex = SeqFil(1)->VertexFirstOnS1().IsVertex(); + } else { + ipoin = CorDat->IndexLastPointOnS1(); + isVertex = SeqFil.Last()->VertexLastOnS1().IsVertex(); + } } else if(DStr.Curve(IcFil1).Curve().IsNull()) {// Rotation !! - ipoin = Ipoin1; - isVertex = isVertex1; + ipoin = Ipoin1; + isVertex = isVertex1; } else if ( ((j==1) || (j== SeqFil.Length()-1)) && - ( (Fd->VertexLastOnS1().Point().IsEqual( - SeqFil(1)->VertexFirstOnS1().Point(), 1.e-7)) || - (Fd->VertexLastOnS1().Point().IsEqual( - SeqFil(SeqFil.Length())->VertexLastOnS1().Point(), 1.e-7))) ) - // Case of SurfData cut in "Triangular" way. - ipoin=CorDat->IndexLastPointOnS1(); + ( (Fd->VertexLastOnS1().Point().IsEqual( + SeqFil(1)->VertexFirstOnS1().Point(), 1.e-7)) || + (Fd->VertexLastOnS1().Point().IsEqual( + SeqFil(SeqFil.Length())->VertexLastOnS1().Point(), 1.e-7))) ) + // Case of SurfData cut in "Triangular" way. + ipoin=CorDat->IndexLastPointOnS1(); // eap, Apr 29 2002, occ 293 else if (isInDS2 && findIndexPoint(DStr, Fd, 1, ipoin)) { } else ipoin = ChFi3d_IndexPointInDS(Fd->VertexLastOnS1(),DStr); - + TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(IcFil1); if (!ChFi3d_Contains(Li,IcFil1,Ipoin1)) { - - Interfp1 = ChFi3d_FilPointInDS(TopAbs_FORWARD,IcFil1,Ipoin1, - Fi1.FirstParameter(),isVertex1); - DStr.ChangeCurveInterferences(IcFil1).Append(Interfp1); + + Interfp1 = ChFi3d_FilPointInDS(TopAbs_FORWARD,IcFil1,Ipoin1, + Fi1.FirstParameter(),isVertex1); + DStr.ChangeCurveInterferences(IcFil1).Append(Interfp1); } if (ipoin == Ipoin1 || !ChFi3d_Contains(Li,IcFil1,ipoin)) { - Interfp3 = ChFi3d_FilPointInDS(TopAbs_REVERSED,IcFil1,ipoin, - Fi1.LastParameter(), isVertex); - DStr.ChangeCurveInterferences(IcFil1).Append(Interfp3); + Interfp3 = ChFi3d_FilPointInDS(TopAbs_REVERSED,IcFil1,ipoin, + Fi1.LastParameter(), isVertex); + DStr.ChangeCurveInterferences(IcFil1).Append(Interfp3); } Ipoin1 = ipoin; isVertex1 = isVertex; } - + IcFil2 = Fi2.LineIndex(); if (IcFil2!=0) { Interfc4=ChFi3d_FilCurveInDS(IcFil2,Isurf, - Fi2.PCurveOnSurf(),trafil2); + Fi2.PCurveOnSurf(),trafil2); DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc4); Ishape2 = Fd->IndexOfS2(); // Case of degenerated edge : pcurve is associated via SCI // to TopOpeBRepDSCurve. TopOpeBRepDS_Curve& cc = DStr.ChangeCurve(IcFil2); if(cc.Curve().IsNull()) { - Handle(TopOpeBRepDS_Interference) bidinterf; - cc.SetSCI(Interfc4,bidinterf); + Handle(TopOpeBRepDS_Interference) bidinterf; + cc.SetSCI(Interfc4,bidinterf); } else{ - ChFiDS_Regul regon2; - regon2.SetCurve(IcFil2); - regon2.SetS1(Isurf,Standard_False); - if ( Ishape2 < 0 ) { - Ishape2 = -Ishape2; - regon2.SetS2(Ishape2,Standard_False); - Interfc2=ChFi3d_FilCurveInDS(IcFil2,Ishape2,Fi2.PCurveOnFace(), - Fi2.Transition()); - DStr.ChangeSurfaceInterferences(Ishape2).Append(Interfc2); - } - else if ( Ishape2 > 0 ) { - regon2.SetS2(Ishape2,Standard_True); - Interfc2=ChFi3d_FilCurveInDS(IcFil2,Ishape2,Fi2.PCurveOnFace(), - Fi2.Transition()); - DStr.ChangeShapeInterferences(Ishape2).Append(Interfc2); - } - reglist.Append(regon2); + ChFiDS_Regul regon2; + regon2.SetCurve(IcFil2); + regon2.SetS1(Isurf,Standard_False); + if ( Ishape2 < 0 ) { + Ishape2 = -Ishape2; + regon2.SetS2(Ishape2,Standard_False); + Interfc2=ChFi3d_FilCurveInDS(IcFil2,Ishape2,Fi2.PCurveOnFace(), + Fi2.Transition()); + DStr.ChangeSurfaceInterferences(Ishape2).Append(Interfc2); + } + else if ( Ishape2 > 0 ) { + regon2.SetS2(Ishape2,Standard_True); + Interfc2=ChFi3d_FilCurveInDS(IcFil2,Ishape2,Fi2.PCurveOnFace(), + Fi2.Transition()); + DStr.ChangeShapeInterferences(Ishape2).Append(Interfc2); + } + reglist.Append(regon2); } // Indice and type of the point in End Standard_Integer ipoin; Standard_Boolean isVertex = Fd->VertexLastOnS2().IsVertex(); if (j == SeqFil.Length() ) ipoin = CorDat->IndexLastPointOnS2(); else if ( j == (SeqFil.Length()-1) && /*Closed &&*/ - (DStr.Curve(SeqFil.Last()->InterferenceOnS2(). - LineIndex()).Curve().IsNull())) { - if (Closed) { - ipoin = CorDat->IndexFirstPointOnS2(); - isVertex = SeqFil(1)->VertexFirstOnS2().IsVertex(); - } else { - ipoin = CorDat->IndexLastPointOnS2(); - isVertex = SeqFil.Last()->VertexLastOnS2().IsVertex(); - } + (DStr.Curve(SeqFil.Last()->InterferenceOnS2(). + LineIndex()).Curve().IsNull())) { + if (Closed) { + ipoin = CorDat->IndexFirstPointOnS2(); + isVertex = SeqFil(1)->VertexFirstOnS2().IsVertex(); + } else { + ipoin = CorDat->IndexLastPointOnS2(); + isVertex = SeqFil.Last()->VertexLastOnS2().IsVertex(); + } } else if(DStr.Curve(IcFil2).Curve().IsNull()) { // Rotation !! - ipoin = Ipoin2; - isVertex = isVertex2; + ipoin = Ipoin2; + isVertex = isVertex2; } else if(Fd->VertexLastOnS2().Point().IsEqual( - Fd->VertexLastOnS1().Point(), 0) ) { //Pinch !! - ipoin = Ipoin1; - isVertex = isVertex1; + Fd->VertexLastOnS1().Point(), 0) ) { //Pinch !! + ipoin = Ipoin1; + isVertex = isVertex1; } else if ( ((j==1) || (j==SeqFil.Length()-1)) && - ( (Fd->VertexLastOnS2().Point().IsEqual( - SeqFil(1)->VertexFirstOnS2().Point(), 1.e-7)) || - (Fd->VertexLastOnS2().Point().IsEqual( - SeqFil(SeqFil.Length())->VertexLastOnS2().Point(), 1.e-7))) ) - // Case of SurfData cut in "Triangular" way. - ipoin=CorDat->IndexLastPointOnS2(); + ( (Fd->VertexLastOnS2().Point().IsEqual( + SeqFil(1)->VertexFirstOnS2().Point(), 1.e-7)) || + (Fd->VertexLastOnS2().Point().IsEqual( + SeqFil(SeqFil.Length())->VertexLastOnS2().Point(), 1.e-7))) ) + // Case of SurfData cut in "Triangular" way. + ipoin=CorDat->IndexLastPointOnS2(); // eap, Apr 29 2002, occ 293 else if (isInDS2 && findIndexPoint(DStr, Fd, 2, ipoin)) { } else ipoin = ChFi3d_IndexPointInDS(Fd->VertexLastOnS2(),DStr); - + TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(IcFil2); if (!ChFi3d_Contains(Li,IcFil2,Ipoin2)) { - Interfp2 = ChFi3d_FilPointInDS(TopAbs_FORWARD,IcFil2,Ipoin2, - Fi2.FirstParameter(), isVertex2); - DStr.ChangeCurveInterferences(IcFil2).Append(Interfp2); + Interfp2 = ChFi3d_FilPointInDS(TopAbs_FORWARD,IcFil2,Ipoin2, + Fi2.FirstParameter(), isVertex2); + DStr.ChangeCurveInterferences(IcFil2).Append(Interfp2); } if (ipoin == Ipoin2 || !ChFi3d_Contains(Li,IcFil2,ipoin)) { - Interfp4= ChFi3d_FilPointInDS(TopAbs_REVERSED,IcFil2,ipoin, - Fi2.LastParameter(), isVertex ); - DStr.ChangeCurveInterferences(IcFil2).Append(Interfp4); + Interfp4= ChFi3d_FilPointInDS(TopAbs_REVERSED,IcFil2,ipoin, + Fi2.LastParameter(), isVertex ); + DStr.ChangeCurveInterferences(IcFil2).Append(Interfp4); } Ipoin2 = ipoin; isVertex2 = isVertex; } - + ET1 = trafil1; if (j == SeqFil.Length()) { if (!isInDS2) { - Icurv = CorDat->LastCurve(); - if(Closed && !Singulier_en_Bout && (Ipoin1!=Ipoin2)) { - regcout.SetS2(Isurf,Standard_False); - reglist.Append(regcout); - } - PCurv = CorDat->LastPCurve(); - ET1 = TopAbs::Compose(ET1,CorDat->LastPCurveOrientation()); - CorDat->LastParameters(Pardeb,Parfin); - TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(Icurv); - if (Li.IsEmpty()) { - if(CorDat->LastPCurveOrientation()==TopAbs_REVERSED) { - Interfp5=ChFi3d_FilPointInDS - (TopAbs_REVERSED,Icurv,Ipoin1,Parfin, isVertex1); - Interfp6=ChFi3d_FilPointInDS - (TopAbs_FORWARD,Icurv,Ipoin2,Pardeb, isVertex2); - } - else{ - Interfp5=ChFi3d_FilPointInDS - (TopAbs_FORWARD,Icurv,Ipoin1,Pardeb, isVertex1); - Interfp6=ChFi3d_FilPointInDS - (TopAbs_REVERSED,Icurv,Ipoin2,Parfin, isVertex2); - } - Li.Append(Interfp5); - Li.Append(Interfp6); - } - Interfc1= ChFi3d_FilCurveInDS(Icurv,Isurf,PCurv,ET1); - DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc1); + Icurv = CorDat->LastCurve(); + if(Closed && !Singulier_en_Bout && (Ipoin1!=Ipoin2)) { + regcout.SetS2(Isurf,Standard_False); + reglist.Append(regcout); + } + PCurv = CorDat->LastPCurve(); + ET1 = TopAbs::Compose(ET1,CorDat->LastPCurveOrientation()); + CorDat->LastParameters(Pardeb,Parfin); + TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(Icurv); + if (Li.IsEmpty()) { + if(CorDat->LastPCurveOrientation()==TopAbs_REVERSED) { + Interfp5=ChFi3d_FilPointInDS + (TopAbs_REVERSED,Icurv,Ipoin1,Parfin, isVertex1); + Interfp6=ChFi3d_FilPointInDS + (TopAbs_FORWARD,Icurv,Ipoin2,Pardeb, isVertex2); + } + else{ + Interfp5=ChFi3d_FilPointInDS + (TopAbs_FORWARD,Icurv,Ipoin1,Pardeb, isVertex1); + Interfp6=ChFi3d_FilPointInDS + (TopAbs_REVERSED,Icurv,Ipoin2,Parfin, isVertex2); + } + Li.Append(Interfp5); + Li.Append(Interfp6); + } + Interfc1= ChFi3d_FilCurveInDS(Icurv,Isurf,PCurv,ET1); + DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc1); if (Ipoin1 == Ipoin2) { - TopOpeBRepDS_Curve& TCurv = DStr.ChangeCurve(Icurv); - TCurv.ChangeCurve().Nullify(); - Handle(TopOpeBRepDS_Interference) bidinterf; - TCurv.SetSCI( Interfc1, bidinterf); -// bidinterf = TCurv.GetSCI1(); -// TCurv.SetSCI(bidinterf, Interfc1); - } + TopOpeBRepDS_Curve& TCurv = DStr.ChangeCurve(Icurv); + TCurv.ChangeCurve().Nullify(); + Handle(TopOpeBRepDS_Interference) bidinterf; + TCurv.SetSCI( Interfc1, bidinterf); + // bidinterf = TCurv.GetSCI1(); + // TCurv.SetSCI(bidinterf, Interfc1); + } } } else { -// Degene = (Fd->VertexLastOnS1().Point().IsEqual( -// Fd->VertexLastOnS2().Point(), 0) ); - + // Degene = (Fd->VertexLastOnS1().Point().IsEqual( + // Fd->VertexLastOnS2().Point(), 0) ); + // eap, Apr 29 2002, occ 293 if (!isInDS2) { - + Handle(Geom_Curve) C3d; Standard_Real tolreached; ChFi3d_ComputeArete(Fd->VertexLastOnS1(), - Fd->InterferenceOnS1().PCurveOnSurf()-> - Value(Fd->InterferenceOnS1().LastParameter()), - Fd->VertexLastOnS2(), - Fd->InterferenceOnS2().PCurveOnSurf()-> - Value(Fd->InterferenceOnS2().LastParameter()), - DStr.Surface(Fd->Surf()).Surface(),C3d,PCurv, - Pardeb,Parfin,tol3d,tol2d,tolreached,0); + Fd->InterferenceOnS1().PCurveOnSurf()-> + Value(Fd->InterferenceOnS1().LastParameter()), + Fd->VertexLastOnS2(), + Fd->InterferenceOnS2().PCurveOnSurf()-> + Value(Fd->InterferenceOnS2().LastParameter()), + DStr.Surface(Fd->Surf()).Surface(),C3d,PCurv, + Pardeb,Parfin,tol3d,tol2d,tolreached,0); Crv = TopOpeBRepDS_Curve(C3d,tolreached); Icurv = DStr.AddCurve(Crv); regfilfil.SetCurve(Icurv); @@ -2663,7 +2663,7 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, DStr.ChangeSurfaceInterferences(Isurf).Append(Interfc1); } } - + Degene = V3.Point().IsEqual(V4.Point(), 0); // Processing of degenerated case @@ -2674,62 +2674,62 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, } else { - // The edge of the spine starting on this vertex is removed. - Standard_Boolean Trouve = Standard_False; - TopoDS_Edge Arcspine; - TopAbs_Orientation OVtx = TopAbs_FORWARD; - BoutdeVtx = V3.Vertex(); - - while (NumEdge<= spine->NbEdges() && !Trouve) { - Arcspine = spine->Edges(NumEdge); - for(ex.Init(Arcspine.Oriented(TopAbs_FORWARD),TopAbs_VERTEX); - ex.More() && (!Trouve); ex.Next()) { - if(BoutdeVtx.IsSame(ex.Current())) { - OVtx = ex.Current().Orientation(); - if (Closed && (NumEdge == 1)) - Trouve = (spine->NbEdges() == 1); - else Trouve = Standard_True; - } - } - if (!Trouve) NumEdge++; // Go to the next edge - } - Standard_Integer IArcspine = DStr.AddShape(Arcspine); - Standard_Integer IVtx; - if (j == SeqFil.Length()) { - IVtx = CorDat->IndexLastPointOnS1(); - } - else { IVtx = DStr.AddShape(BoutdeVtx); } - OVtx = TopAbs::Reverse(OVtx); - Standard_Real parVtx = BRep_Tool::Parameter(BoutdeVtx,Arcspine); - Handle(TopOpeBRepDS_CurvePointInterference) - interfv = ChFi3d_FilVertexInDS(OVtx,IArcspine,IVtx,parVtx); - DStr.ChangeShapeInterferences(IArcspine).Append(interfv); + // The edge of the spine starting on this vertex is removed. + Standard_Boolean Trouve = Standard_False; + TopoDS_Edge Arcspine; + TopAbs_Orientation OVtx = TopAbs_FORWARD; + BoutdeVtx = V3.Vertex(); + + while (NumEdge<= spine->NbEdges() && !Trouve) { + Arcspine = spine->Edges(NumEdge); + for(ex.Init(Arcspine.Oriented(TopAbs_FORWARD),TopAbs_VERTEX); + ex.More() && (!Trouve); ex.Next()) { + if(BoutdeVtx.IsSame(ex.Current())) { + OVtx = ex.Current().Orientation(); + if (Closed && (NumEdge == 1)) + Trouve = (spine->NbEdges() == 1); + else Trouve = Standard_True; + } + } + if (!Trouve) NumEdge++; // Go to the next edge + } + Standard_Integer IArcspine = DStr.AddShape(Arcspine); + Standard_Integer IVtx; + if (j == SeqFil.Length()) { + IVtx = CorDat->IndexLastPointOnS1(); + } + else { IVtx = DStr.AddShape(BoutdeVtx); } + OVtx = TopAbs::Reverse(OVtx); + Standard_Real parVtx = BRep_Tool::Parameter(BoutdeVtx,Arcspine); + Handle(TopOpeBRepDS_CurvePointInterference) + interfv = ChFi3d_FilVertexInDS(OVtx,IArcspine,IVtx,parVtx); + DStr.ChangeShapeInterferences(IArcspine).Append(interfv); } } // end of degenerated case else if (!(Closed && j == SeqFil.Length())) { // Processing of interference Point / Edges if (V3.IsOnArc()) { - if(!(V3.IsVertex() && Fd->IsOnCurve1())) { - Iarc1 = DStr.AddShape(V3.Arc()); - if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc1),Iarc1,Ipoin1,V3.IsVertex(),Standard_True) ) { - Handle(TopOpeBRepDS_CurvePointInterference) Interfpp = - ChFi3d_FilPointInDS(V3.TransitionOnArc(), - Iarc1,Ipoin1,V3.ParameterOnArc(), V3.IsVertex()); - DStr.ChangeShapeInterferences(V3.Arc()).Append(Interfpp); - } - } + if(!(V3.IsVertex() && Fd->IsOnCurve1())) { + Iarc1 = DStr.AddShape(V3.Arc()); + if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc1),Iarc1,Ipoin1,V3.IsVertex(),Standard_True) ) { + Handle(TopOpeBRepDS_CurvePointInterference) Interfpp = + ChFi3d_FilPointInDS(V3.TransitionOnArc(), + Iarc1,Ipoin1,V3.ParameterOnArc(), V3.IsVertex()); + DStr.ChangeShapeInterferences(V3.Arc()).Append(Interfpp); + } + } } if (V4.IsOnArc()) { - if(!(V4.IsVertex() && Fd->IsOnCurve2())) { - Iarc2 = DStr.AddShape(V4.Arc()); - if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc2),Iarc2,Ipoin2,V4.IsVertex(),Standard_True) ) { - Handle(TopOpeBRepDS_CurvePointInterference) Intfpp= - ChFi3d_FilPointInDS(V4.TransitionOnArc(), - Iarc2,Ipoin2,V4.ParameterOnArc(), V4.IsVertex()); - DStr.ChangeShapeInterferences(V4.Arc()).Append(Intfpp); - } - } + if(!(V4.IsVertex() && Fd->IsOnCurve2())) { + Iarc2 = DStr.AddShape(V4.Arc()); + if ( !ChFi3d_Contains(DStr.ShapeInterferences(Iarc2),Iarc2,Ipoin2,V4.IsVertex(),Standard_True) ) { + Handle(TopOpeBRepDS_CurvePointInterference) Intfpp= + ChFi3d_FilPointInDS(V4.TransitionOnArc(), + Iarc2,Ipoin2,V4.ParameterOnArc(), V4.IsVertex()); + DStr.ChangeShapeInterferences(V4.Arc()).Append(Intfpp); + } + } } } } @@ -2744,18 +2744,18 @@ void ChFi3d_FilDS(const Standard_Integer SolidIndex, //author : akm, 06/02/02. Against bug OCC119. //======================================================================= void ChFi3d_StripeEdgeInter (const Handle(ChFiDS_Stripe)& theStripe1, - const Handle(ChFiDS_Stripe)& theStripe2, - TopOpeBRepDS_DataStructure& /*DStr*/, - const Standard_Real tol2d) + const Handle(ChFiDS_Stripe)& theStripe2, + TopOpeBRepDS_DataStructure& /*DStr*/, + const Standard_Real tol2d) { // Do not check the stripeshaving common corner points for (Standard_Integer iSur1=1; iSur1<=2; iSur1++) for (Standard_Integer iSur2=1; iSur2<=2; iSur2++) if (theStripe1->IndexPoint(0,iSur1)==theStripe2->IndexPoint(0,iSur2) || - theStripe1->IndexPoint(0,iSur1)==theStripe2->IndexPoint(1,iSur2) || - theStripe1->IndexPoint(1,iSur1)==theStripe2->IndexPoint(0,iSur2) || - theStripe1->IndexPoint(1,iSur1)==theStripe2->IndexPoint(1,iSur2)) - return; + theStripe1->IndexPoint(0,iSur1)==theStripe2->IndexPoint(1,iSur2) || + theStripe1->IndexPoint(1,iSur1)==theStripe2->IndexPoint(0,iSur2) || + theStripe1->IndexPoint(1,iSur1)==theStripe2->IndexPoint(1,iSur2)) + return; Handle(ChFiDS_HData) aSurDat1 = theStripe1->SetOfSurfData(); Handle(ChFiDS_HData) aSurDat2 = theStripe2->SetOfSurfData(); @@ -2780,50 +2780,50 @@ void ChFi3d_StripeEdgeInter (const Handle(ChFiDS_Stripe)& theStripe1, ChFiDS_FaceInterference aFI1, aFI2; if (Ishape11 == Ishape21) { - aFI1 = aDat1->InterferenceOnS1(); - aFI2 = aDat2->InterferenceOnS1(); + aFI1 = aDat1->InterferenceOnS1(); + aFI2 = aDat2->InterferenceOnS1(); } else if (Ishape11 == Ishape22) { - aFI1 = aDat1->InterferenceOnS1(); - aFI2 = aDat2->InterferenceOnS2(); + aFI1 = aDat1->InterferenceOnS1(); + aFI2 = aDat2->InterferenceOnS2(); } else if (Ishape12 == Ishape21) { - aFI1 = aDat1->InterferenceOnS2(); - aFI2 = aDat2->InterferenceOnS1(); + aFI1 = aDat1->InterferenceOnS2(); + aFI2 = aDat2->InterferenceOnS1(); } else if (Ishape12 == Ishape22) { - aFI1 = aDat1->InterferenceOnS2(); - aFI2 = aDat2->InterferenceOnS2(); + aFI1 = aDat1->InterferenceOnS2(); + aFI2 = aDat2->InterferenceOnS2(); } else { - // No common faces - continue; + // No common faces + continue; } if (IsEqual (aFI1.FirstParameter(),aFI1.LastParameter()) || - IsEqual (aFI2.FirstParameter(),aFI2.LastParameter()) || - aFI1.PCurveOnFace().IsNull() || - aFI2.PCurveOnFace().IsNull()) - // Do not waste time on degenerates - continue; + IsEqual (aFI2.FirstParameter(),aFI2.LastParameter()) || + aFI1.PCurveOnFace().IsNull() || + aFI2.PCurveOnFace().IsNull()) + // Do not waste time on degenerates + continue; // Examine for intersections Geom2dAdaptor_Curve aPCurve1 (aFI1.PCurveOnFace(), - aFI1.FirstParameter(), - aFI1.LastParameter()); + aFI1.FirstParameter(), + aFI1.LastParameter()); Geom2dAdaptor_Curve aPCurve2 (aFI2.PCurveOnFace(), - aFI2.FirstParameter(), - aFI2.LastParameter()); + aFI2.FirstParameter(), + aFI2.LastParameter()); anIntersector.Perform (aPCurve1, - aPCurve2, - tol2d, - Precision::PConfusion()); + aPCurve2, + tol2d, + Precision::PConfusion()); if (anIntersector.NbSegments() > 0 || - anIntersector.NbPoints() > 0) - StdFail_NotDone::Raise ("StripeEdgeInter : fillets have too big radiuses"); + anIntersector.NbPoints() > 0) + StdFail_NotDone::Raise ("StripeEdgeInter : fillets have too big radiuses"); } } } @@ -2833,8 +2833,8 @@ void ChFi3d_StripeEdgeInter (const Handle(ChFiDS_Stripe)& theStripe1, //purpose : //======================================================================= Standard_Integer ChFi3d_IndexOfSurfData(const TopoDS_Vertex& V1, - const Handle(ChFiDS_Stripe)& CD, - Standard_Integer& sens) + const Handle(ChFiDS_Stripe)& CD, + Standard_Integer& sens) { Handle(ChFiDS_Spine) spine = CD->Spine(); Standard_Integer Index = 0; @@ -2861,8 +2861,8 @@ Standard_Integer ChFi3d_IndexOfSurfData(const TopoDS_Vertex& V1, //======================================================================= TopoDS_Edge ChFi3d_EdgeFromV1(const TopoDS_Vertex& V1, - const Handle(ChFiDS_Stripe)& CD, - Standard_Integer& sens) + const Handle(ChFiDS_Stripe)& CD, + Standard_Integer& sens) { Handle(ChFiDS_Spine) spine = CD->Spine(); sens = 1; @@ -2872,14 +2872,14 @@ TopoDS_Edge ChFi3d_EdgeFromV1(const TopoDS_Vertex& V1, else Vref = TopExp::FirstVertex(E); if (Vref.IsSame(V1)) return E; else - { - const TopoDS_Edge& E1 = spine->Edges(spine->NbEdges()); - if (E1.Orientation() == TopAbs_REVERSED) Vref = TopExp::FirstVertex(E1); - else Vref = TopExp::LastVertex(E1); - sens = -1; - if (Vref.IsSame(V1)) return E1; - else Standard_ConstructionError::Raise(""); - } + { + const TopoDS_Edge& E1 = spine->Edges(spine->NbEdges()); + if (E1.Orientation() == TopAbs_REVERSED) Vref = TopExp::FirstVertex(E1); + else Vref = TopExp::LastVertex(E1); + sens = -1; + if (Vref.IsSame(V1)) return E1; + else Standard_ConstructionError::Raise(""); + } return E; } //======================================================================= @@ -2888,7 +2888,7 @@ TopoDS_Edge ChFi3d_EdgeFromV1(const TopoDS_Vertex& V1, //======================================================================= Standard_Real ChFi3d_ConvTol2dToTol3d(const Handle(Adaptor3d_HSurface)& S, - const Standard_Real tol2d) + const Standard_Real tol2d) { Standard_Real ures = S->UResolution(1.e-7); Standard_Real vres = S->VResolution(1.e-7); @@ -2903,10 +2903,10 @@ Standard_Real ChFi3d_ConvTol2dToTol3d(const Handle(Adaptor3d_HSurface)& S, //======================================================================= Standard_Real ChFi3d_EvalTolReached(const Handle(Adaptor3d_HSurface)& S1, - const Handle(Geom2d_Curve)& pc1, - const Handle(Adaptor3d_HSurface)& S2, - const Handle(Geom2d_Curve)& pc2, - const Handle(Geom_Curve)& C) + const Handle(Geom2d_Curve)& pc1, + const Handle(Adaptor3d_HSurface)& S2, + const Handle(Geom2d_Curve)& pc2, + const Handle(Geom_Curve)& C) { Standard_Real distmax = 0.; @@ -2940,7 +2940,7 @@ Standard_Real ChFi3d_EvalTolReached(const Handle(Adaptor3d_HSurface)& S1, //purpose : //======================================================================= Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS, - Handle(Adaptor3d_TopolTool)& /*dom*/) + Handle(Adaptor3d_TopolTool)& /*dom*/) { //Pour l utilisation des domaines voir avec BUBUCH!! Handle(Geom_Surface) res; @@ -2961,7 +2961,7 @@ Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS, Standard_Real U1 = HS->FirstUParameter(), U2 = HS->LastUParameter(); Standard_Real V1 = HS->FirstVParameter(), V2 = HS->LastVParameter(); if(!res.IsNull()) { - // Protection against Construction Errors + // Protection against Construction Errors Standard_Real u1, u2, v1, v2; res->Bounds( u1, u2, v1, v2); if (!res->IsUPeriodic()) { @@ -2974,8 +2974,8 @@ Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS, } res = new Geom_RectangularTrimmedSurface(res,U1,U2,V1,V2); } -// Handle(GeomAdaptor_HSurface) temp = new GeomAdaptor_HSurface(res,U1,U2,V1,V2); -// dom = new Adaptor3d_TopolTool(temp); + // Handle(GeomAdaptor_HSurface) temp = new GeomAdaptor_HSurface(res,U1,U2,V1,V2); + // dom = new Adaptor3d_TopolTool(temp); return res; } //======================================================================= @@ -2984,14 +2984,14 @@ Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS, // at a given tolerance //======================================================================= static void CurveCleaner(Handle(Geom_BSplineCurve)& BS, - const Standard_Real Tol, - const Standard_Integer MultMin) + const Standard_Real Tol, + const Standard_Integer MultMin) { Standard_Real tol = Tol; Standard_Integer Mult, ii; const Standard_Integer NbK=BS->NbKnots(); - + for (Mult = BS->Degree(); Mult > MultMin; Mult--) { tol *= 0.5; // Progressive reduction for (ii=NbK; ii>1; ii--) { @@ -3012,16 +3012,16 @@ static void CurveCleaner(Handle(Geom_BSplineCurve)& BS, // boundaries of input surfaces (eap 30 May occ354) //======================================================================= Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, - Handle(Adaptor3d_HSurface)& S2, - const TColStd_Array1OfReal& Pardeb, - const TColStd_Array1OfReal& Parfin, - Handle(Geom_Curve)& C3d, - Handle(Geom2d_Curve)& Pc1, - Handle(Geom2d_Curve)& Pc2, - const Standard_Real tol3d, - const Standard_Real tol2d, - Standard_Real& tolreached, - const Standard_Boolean wholeCurv) + Handle(Adaptor3d_HSurface)& S2, + const TColStd_Array1OfReal& Pardeb, + const TColStd_Array1OfReal& Parfin, + Handle(Geom_Curve)& C3d, + Handle(Geom2d_Curve)& Pc1, + Handle(Geom2d_Curve)& Pc2, + const Standard_Real tol3d, + const Standard_Real tol2d, + Standard_Real& tolreached, + const Standard_Boolean wholeCurv) { Standard_Real Step = 0.1; @@ -3053,103 +3053,103 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, Standard_Real tolr1,tolr2; tolr1 = tolr2 = tolreached = tol3d; if((S1->GetType() == GeomAbs_Cylinder && S2->GetType() == GeomAbs_Plane)|| - (S1->GetType() == GeomAbs_Plane && S2->GetType() == GeomAbs_Cylinder)) { - gp_Pln pl; - gp_Cylinder cyl; - if(S1->GetType() == GeomAbs_Plane) { - pl = S1->Plane(); - cyl = S2->Cylinder(); - } - else{ - pl = S2->Plane(); - cyl = S1->Cylinder(); - } - IntAna_QuadQuadGeo ImpKK(pl,cyl,Precision::Angular(),tol3d); - Standard_Boolean isIntDone = ImpKK.IsDone(); + (S1->GetType() == GeomAbs_Plane && S2->GetType() == GeomAbs_Cylinder)) { + gp_Pln pl; + gp_Cylinder cyl; + if(S1->GetType() == GeomAbs_Plane) { + pl = S1->Plane(); + cyl = S2->Cylinder(); + } + else{ + pl = S2->Plane(); + cyl = S1->Cylinder(); + } + IntAna_QuadQuadGeo ImpKK(pl,cyl,Precision::Angular(),tol3d); + Standard_Boolean isIntDone = ImpKK.IsDone(); - if(ImpKK.TypeInter() == IntAna_Ellipse) - { - const gp_Elips anEl = ImpKK.Ellipse(1); - const Standard_Real aMajorR = anEl.MajorRadius(); - const Standard_Real aMinorR = anEl.MinorRadius(); - isIntDone = (aMajorR < 100000.0 * aMinorR); - } + if(ImpKK.TypeInter() == IntAna_Ellipse) + { + const gp_Elips anEl = ImpKK.Ellipse(1); + const Standard_Real aMajorR = anEl.MajorRadius(); + const Standard_Real aMinorR = anEl.MinorRadius(); + isIntDone = (aMajorR < 100000.0 * aMinorR); + } - if (isIntDone) { - Standard_Boolean c1line = 0; - switch (ImpKK.TypeInter()) { - case IntAna_Line: - { - c1line = 1; - Standard_Integer nbsol = ImpKK.NbSolutions(); - gp_Lin C1; - for(Standard_Integer ilin = 1; ilin <= nbsol; ilin++) { - C1 = ImpKK.Line(ilin); - Udeb = ElCLib::Parameter(C1,pdeb); - gp_Pnt ptest = ElCLib::Value(Udeb,C1); - if(ptest.Distance(pdeb) < tol3d) break; - } - Ufin = ElCLib::Parameter(C1,pfin); - C3d = new Geom_Line(C1); - ElCLib::D1(Udeb,C1,Pbid,Vint); - } - break; - case IntAna_Circle: - { - gp_Circ C1 = ImpKK.Circle(1); - C3d = new Geom_Circle(C1); - Udeb = ElCLib::Parameter(C1,pdeb); - Ufin = ElCLib::Parameter(C1,pfin); - ElCLib::D1(Udeb,C1,Pbid,Vint); - } - break; - case IntAna_Ellipse: - { - gp_Elips C1 = ImpKK.Ellipse(1); - C3d = new Geom_Ellipse(C1); - Udeb = ElCLib::Parameter(C1,pdeb); - Ufin = ElCLib::Parameter(C1,pfin); - ElCLib::D1(Udeb,C1,Pbid,Vint); - } - break; - default: - break; + if (isIntDone) { + Standard_Boolean c1line = 0; + switch (ImpKK.TypeInter()) { + case IntAna_Line: + { + c1line = 1; + Standard_Integer nbsol = ImpKK.NbSolutions(); + gp_Lin C1; + for(Standard_Integer ilin = 1; ilin <= nbsol; ilin++) { + C1 = ImpKK.Line(ilin); + Udeb = ElCLib::Parameter(C1,pdeb); + gp_Pnt ptest = ElCLib::Value(Udeb,C1); + if(ptest.Distance(pdeb) < tol3d) break; + } + Ufin = ElCLib::Parameter(C1,pfin); + C3d = new Geom_Line(C1); + ElCLib::D1(Udeb,C1,Pbid,Vint); + } + break; + case IntAna_Circle: + { + gp_Circ C1 = ImpKK.Circle(1); + C3d = new Geom_Circle(C1); + Udeb = ElCLib::Parameter(C1,pdeb); + Ufin = ElCLib::Parameter(C1,pfin); + ElCLib::D1(Udeb,C1,Pbid,Vint); + } + break; + case IntAna_Ellipse: + { + gp_Elips C1 = ImpKK.Ellipse(1); + C3d = new Geom_Ellipse(C1); + Udeb = ElCLib::Parameter(C1,pdeb); + Ufin = ElCLib::Parameter(C1,pfin); + ElCLib::D1(Udeb,C1,Pbid,Vint); + } + break; + default: + break; + } + if (Vint.Dot(Vref)<0) { + C3d->Reverse(); + if(c1line) { + Udeb = -Udeb; + Ufin = -Ufin; + } + else{ + Udeb = 2*M_PI - Udeb; + Ufin = 2*M_PI - Ufin; + } + } + if(!c1line) ElCLib::AdjustPeriodic(0.,2*M_PI,Precision::Angular(),Udeb,Ufin); + Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve(); + HC->ChangeCurve().Load(C3d,Udeb,Ufin); + ChFi3d_ProjectPCurv(HC,S1,Pc1,tol3d,tolr1); + if(S1->GetType() == GeomAbs_Cylinder) { + Standard_Real x,y; + Pc1->Value(Udeb).Coord(x,y); + x = Pardeb(1) - x; + y = Pardeb(2) - y; + if(Abs(x) >= tol2d || Abs(y) >= tol2d) Pc1->Translate(gp_Vec2d(x,y)); + } + ChFi3d_ProjectPCurv(HC,S2,Pc2,tol3d,tolr2); + if(S2->GetType() == GeomAbs_Cylinder) { + Standard_Real x,y; + Pc2->Value(Udeb).Coord(x,y); + x = Pardeb(3) - x; + y = Pardeb(4) - y; + if(Abs(x) >= tol2d || Abs(y) >= tol2d) Pc2->Translate(gp_Vec2d(x,y)); + } + C3d = new Geom_TrimmedCurve(C3d,Udeb,Ufin); + tolreached = 1.5*Max(tolr1,tolr2); + tolreached = Min(tolreached,ChFi3d_EvalTolReached(S1,Pc1,S2,Pc2,C3d)); + return Standard_True; } - if (Vint.Dot(Vref)<0) { - C3d->Reverse(); - if(c1line) { - Udeb = -Udeb; - Ufin = -Ufin; - } - else{ - Udeb = 2*M_PI - Udeb; - Ufin = 2*M_PI - Ufin; - } - } - if(!c1line) ElCLib::AdjustPeriodic(0.,2*M_PI,Precision::Angular(),Udeb,Ufin); - Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve(); - HC->ChangeCurve().Load(C3d,Udeb,Ufin); - ChFi3d_ProjectPCurv(HC,S1,Pc1,tol3d,tolr1); - if(S1->GetType() == GeomAbs_Cylinder) { - Standard_Real x,y; - Pc1->Value(Udeb).Coord(x,y); - x = Pardeb(1) - x; - y = Pardeb(2) - y; - if(Abs(x) >= tol2d || Abs(y) >= tol2d) Pc1->Translate(gp_Vec2d(x,y)); - } - ChFi3d_ProjectPCurv(HC,S2,Pc2,tol3d,tolr2); - if(S2->GetType() == GeomAbs_Cylinder) { - Standard_Real x,y; - Pc2->Value(Udeb).Coord(x,y); - x = Pardeb(3) - x; - y = Pardeb(4) - y; - if(Abs(x) >= tol2d || Abs(y) >= tol2d) Pc2->Translate(gp_Vec2d(x,y)); - } - C3d = new Geom_TrimmedCurve(C3d,Udeb,Ufin); - tolreached = 1.5*Max(tolr1,tolr2); - tolreached = Min(tolreached,ChFi3d_EvalTolReached(S1,Pc1,S2,Pc2,C3d)); - return Standard_True; - } } else if(S1->GetType() == GeomAbs_Plane && S2->GetType() == GeomAbs_Plane) { IntAna_QuadQuadGeo LInt(S1->Plane(),S2->Plane(),Precision::Angular(),tol3d); @@ -3160,9 +3160,9 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, Ufin = ElCLib::Parameter(L,pfin); ElCLib::D1(Udeb,L,Pbid,Vint); if (Vint.Dot(Vref)<0) { - C3d->Reverse(); - Udeb = - Udeb; - Ufin = - Ufin; + C3d->Reverse(); + Udeb = - Udeb; + Ufin = - Ufin; } Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve(); HC->ChangeCurve().Load(C3d,Udeb,Ufin); @@ -3181,47 +3181,47 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, if(!gs1.IsNull() && !gs2.IsNull()) { GeomInt_IntSS inter; // Modified by skv - Fri Oct 24 14:24:47 2003 OCC4077 Begin -// Standard_Real tolap = 1.e-7;//car l approx de la wline est faite dans [0,1] + // Standard_Real tolap = 1.e-7;//car l approx de la wline est faite dans [0,1] // Set the lowest tolerance which is used in new boolean operations. Standard_Real tolap = 2.e-7; // Modified by skv - Fri Oct 24 14:24:48 2003 OCC4077 End inter.Perform(gs1,gs2,tolap,1,1,1); if(inter.IsDone()) { - nbl = inter.NbLines(); + nbl = inter.NbLines(); #if defined(IRIX) || defined(__sgi) if(nbl==0) { -// solution of adjustment for SGI -// if the intersection of gs1 with gs2 doesnot worke -// then the intersection of gs2 with gs1 is attempted. + // solution of adjustment for SGI + // if the intersection of gs1 with gs2 doesnot worke + // then the intersection of gs2 with gs1 is attempted. inter.Perform(gs2,gs1,tolap,1,1,1); -// inter.Perform(gs2,dom2,gs1,dom1,tolap,1,1,1); + // inter.Perform(gs2,dom2,gs1,dom1,tolap,1,1,1); if(!inter.IsDone()) return Standard_False; - nbl = inter.NbLines(); + nbl = inter.NbLines(); -// if GeomInt does not make the intersection the solution of adjustment -// is not attempted - if (nbl==0) return Standard_False; + // if GeomInt does not make the intersection the solution of adjustment + // is not attempted + if (nbl==0) return Standard_False; } #endif - GeomAPI_ProjectPointOnCurve proj; - for(Standard_Integer ilin = 1; ilin <= nbl; ilin++) { - if(inter.HasLineOnS1(ilin) && inter.HasLineOnS2(ilin)) { - C3d = inter.Line(ilin); - Pc1 = inter.LineOnS1(ilin); - Pc2 = inter.LineOnS2(ilin); - gp_Pnt ptestdeb, ptestfin; - Standard_Real Uf=0., Ul=0.; - if (wholeCurv) { - Uf = C3d->FirstParameter(); - Ul = C3d->LastParameter(); - ptestdeb = C3d->Value(Uf); - ptestfin = C3d->Value(Ul); - } - else { + GeomAPI_ProjectPointOnCurve proj; + for(Standard_Integer ilin = 1; ilin <= nbl; ilin++) { + if(inter.HasLineOnS1(ilin) && inter.HasLineOnS2(ilin)) { + C3d = inter.Line(ilin); + Pc1 = inter.LineOnS1(ilin); + Pc2 = inter.LineOnS2(ilin); + gp_Pnt ptestdeb, ptestfin; + Standard_Real Uf=0., Ul=0.; + if (wholeCurv) { + Uf = C3d->FirstParameter(); + Ul = C3d->LastParameter(); + ptestdeb = C3d->Value(Uf); + ptestfin = C3d->Value(Ul); + } + else { // find end parameters - Standard_Boolean failedF, failedL; + Standard_Boolean failedF, failedL; failedF = failedL = Standard_False; proj.Init( pdeb1, C3d); if (proj.NbPoints()==0 && distrefdeb > Precision::Confusion()) @@ -3267,47 +3267,47 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, } } } - C3d = new Geom_TrimmedCurve(C3d,Uf,Ul); - Pc1 = new Geom2d_TrimmedCurve(Pc1,Uf,Ul); - Pc2 = new Geom2d_TrimmedCurve(Pc2,Uf,Ul); - //is it necesary to invert ? - Standard_Real distdeb = ptestdeb.Distance(pdeb); - Standard_Real distfin = ptestfin.Distance(pfin); - if(distdeb > distref || distfin > distref) { - C3d->Reverse(); - Pc1->Reverse(); - Pc2->Reverse(); - ptestdeb = C3d->Value(C3d->FirstParameter()); - ptestfin = C3d->Value(C3d->LastParameter()); - distdeb = ptestdeb.Distance(pdeb); - distfin = ptestfin.Distance(pfin); - } - if(distdeb < distref && distfin < distref) { - Uf = C3d->FirstParameter(); - Ul = C3d->LastParameter(); - ChFi3d_ReparamPcurv(Uf,Ul,Pc1); - ChFi3d_ReparamPcurv(Uf,Ul,Pc2); - Standard_Real x,y; - Pc1->Value(Uf).Coord(x,y); - x = Pardeb(1) - x; - y = Pardeb(2) - y; - if(Abs(x) > tol2d || Abs(y) > tol2d) Pc1->Translate(gp_Vec2d(x,y)); - Pc2->Value(Uf).Coord(x,y); - x = Pardeb(3) - x; - y = Pardeb(4) - y; - if(Abs(x) > tol2d || Abs(y) > tol2d) Pc2->Translate(gp_Vec2d(x,y)); - tolreached = ChFi3d_EvalTolReached(S1,Pc1,S2,Pc2,C3d); - return Standard_True; - } - } - } + C3d = new Geom_TrimmedCurve(C3d,Uf,Ul); + Pc1 = new Geom2d_TrimmedCurve(Pc1,Uf,Ul); + Pc2 = new Geom2d_TrimmedCurve(Pc2,Uf,Ul); + //is it necesary to invert ? + Standard_Real distdeb = ptestdeb.Distance(pdeb); + Standard_Real distfin = ptestfin.Distance(pfin); + if(distdeb > distref || distfin > distref) { + C3d->Reverse(); + Pc1->Reverse(); + Pc2->Reverse(); + ptestdeb = C3d->Value(C3d->FirstParameter()); + ptestfin = C3d->Value(C3d->LastParameter()); + distdeb = ptestdeb.Distance(pdeb); + distfin = ptestfin.Distance(pfin); + } + if(distdeb < distref && distfin < distref) { + Uf = C3d->FirstParameter(); + Ul = C3d->LastParameter(); + ChFi3d_ReparamPcurv(Uf,Ul,Pc1); + ChFi3d_ReparamPcurv(Uf,Ul,Pc2); + Standard_Real x,y; + Pc1->Value(Uf).Coord(x,y); + x = Pardeb(1) - x; + y = Pardeb(2) - y; + if(Abs(x) > tol2d || Abs(y) > tol2d) Pc1->Translate(gp_Vec2d(x,y)); + Pc2->Value(Uf).Coord(x,y); + x = Pardeb(3) - x; + y = Pardeb(4) - y; + if(Abs(x) > tol2d || Abs(y) > tol2d) Pc2->Translate(gp_Vec2d(x,y)); + tolreached = ChFi3d_EvalTolReached(S1,Pc1,S2,Pc2,C3d); + return Standard_True; + } + } + } } } } - + // At this stage : // classic intersections have failed, the path is approached in vain. -// Standard_Real Step = 0.1; + // Standard_Real Step = 0.1; for(;;) { //Attention the parameters of arrow for the path and //the tolerance for the approximation can't be taken as those of the @@ -3316,7 +3316,7 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, Standard_Real tolap = 1.e-7; IntWalk_PWalking IntKK(S1,S2,tol3d,tol3d,fleche,Step); - + //The extremities of the intersection (Pardeb,Parfin) are known, //one tries to find the start point at the //middle to avoid obstacles on the path. @@ -3341,7 +3341,7 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, if (IntKK.NbPoints() <= 30) { Step *= 0.5; if (Step <= 0.0001) { - return Standard_False; + return Standard_False; } } else{ @@ -3350,34 +3350,34 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, // in fact there is a WLine and the approximation is launched. // Then the result is corrected to get proper start and end points. const Handle(IntSurf_LineOn2S)& L2S = IntKK.Line(); - + gp_Pnt codeb1 = S1->Value(Pardeb(1),Pardeb(2)); gp_Pnt codeb2 = S2->Value(Pardeb(3),Pardeb(4)); Standard_Real tol1 = Max(codeb1.Distance(codeb2),tol3d); Standard_Boolean bondeb = (tol1 == tol3d); gp_Pnt pntd(0.5*(codeb1.Coord() + codeb2.Coord())); - + gp_Pnt cofin1 = S1->Value(Parfin(1),Parfin(2)); gp_Pnt cofin2 = S2->Value(Parfin(3),Parfin(4)); Standard_Real tol2 = Max(cofin1.Distance(cofin2),tol3d); Standard_Boolean bonfin = (tol2 == tol3d); gp_Pnt pntf(0.5*(cofin1.Coord() + cofin2.Coord())); - + Standard_Integer nbp = L2S->NbPoints(), i; Standard_Real ddeb = Precision::Infinite(); Standard_Real dfin = Precision::Infinite(); Standard_Real dd; Standard_Integer indd = 0, indf = 0; for(i = 1; i <= nbp; i++) { - dd = L2S->Value(i).Value().Distance(pntd); - if(dd < ddeb) { ddeb = dd; indd = i;} - dd = L2S->Value(i).Value().Distance(pntf); - if(dd < dfin) { dfin = dd; indf = i;} + dd = L2S->Value(i).Value().Distance(pntd); + if(dd <= ddeb) { ddeb = dd; indd = i;} + dd = L2S->Value(i).Value().Distance(pntf); + if(dd < dfin) { dfin = dd; indf = i;} } if(indd > indf) { - L2S->Reverse(); - indd = nbp - indd + 1; - indf = nbp - indf + 1; + L2S->Reverse(); + indd = nbp - indd + 1; + indf = nbp - indf + 1; } for (i = 1; i < indd; i++) { L2S->RemovePoint(1); nbp--; indf--; } for (i = indf + 1; i <= nbp; i++) { L2S->RemovePoint(indf + 1); } @@ -3386,66 +3386,66 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, //The extremities are inserted in the line if the extremity points on it //are too far and if pardeb and parfin are good. if(ddeb >= tol3d && bondeb) { - IntSurf_PntOn2S p1 = L2S->Value(1); - IntSurf_PntOn2S p2 = L2S->Value(2); - - gp_Vec v1(pntd,p1.Value()); - gp_Vec v2(p1.Value(),p2.Value()); - gp_Vec v3(pntd,p2.Value()); - p1.SetValue(pntd,Pardeb(1),Pardeb(2),Pardeb(3),Pardeb(4)); - if(v1.Dot(v3) < 0) { - if(v3.Magnitude() < 0.2*v2.Magnitude()) { - L2S->RemovePoint(1); - nbp--; - } - L2S->Value(1,p1); - } - else if(v1.Magnitude() > 0.2*v2.Magnitude()) { - L2S->InsertBefore(1,p1); - nbp++; - } - else{ - L2S->Value(1,p1); - } - ddeb = 0.; + IntSurf_PntOn2S p1 = L2S->Value(1); + IntSurf_PntOn2S p2 = L2S->Value(2); + + gp_Vec v1(pntd,p1.Value()); + gp_Vec v2(p1.Value(),p2.Value()); + gp_Vec v3(pntd,p2.Value()); + p1.SetValue(pntd,Pardeb(1),Pardeb(2),Pardeb(3),Pardeb(4)); + if(v1.Dot(v3) < 0) { + if(v3.Magnitude() < 0.2*v2.Magnitude()) { + L2S->RemovePoint(1); + nbp--; + } + L2S->Value(1,p1); + } + else if(v1.Magnitude() > 0.2*v2.Magnitude()) { + L2S->InsertBefore(1,p1); + nbp++; + } + else{ + L2S->Value(1,p1); + } + ddeb = 0.; } if(dfin >= tol3d && bonfin) { - IntSurf_PntOn2S p1 = L2S->Value(nbp); - IntSurf_PntOn2S p2 = L2S->Value(nbp - 1); - gp_Vec v1(pntf,p1.Value()); - gp_Vec v2(p1.Value(),p2.Value()); - gp_Vec v3(pntf,p2.Value()); - p1.SetValue(pntf,Parfin(1),Parfin(2),Parfin(3),Parfin(4)); - if(v1.Dot(v3) < 0) { - if(v3.Magnitude() < 0.2*v2.Magnitude()) { - L2S->RemovePoint(nbp); - nbp--; - } - L2S->Value(nbp,p1); - } - else if(v1.Magnitude() > 0.2*v2.Magnitude()) { - L2S->Add(p1); - nbp++; - } - else{ - L2S->Value(nbp,p1); - } - dfin = 0.; + IntSurf_PntOn2S p1 = L2S->Value(nbp); + IntSurf_PntOn2S p2 = L2S->Value(nbp - 1); + gp_Vec v1(pntf,p1.Value()); + gp_Vec v2(p1.Value(),p2.Value()); + gp_Vec v3(pntf,p2.Value()); + p1.SetValue(pntf,Parfin(1),Parfin(2),Parfin(3),Parfin(4)); + if(v1.Dot(v3) < 0) { + if(v3.Magnitude() < 0.2*v2.Magnitude()) { + L2S->RemovePoint(nbp); + nbp--; + } + L2S->Value(nbp,p1); + } + else if(v1.Magnitude() > 0.2*v2.Magnitude()) { + L2S->Add(p1); + nbp++; + } + else{ + L2S->Value(nbp,p1); + } + dfin = 0.; } // Handle(IntPatch_WLine) WL = new IntPatch_WLine(L2S,Standard_False); - + GeomInt_WLApprox approx; approx.SetParameters(tolap,tol2d,4,8,0,1); // manage here the approximations that are not useful on planes! approx.Perform(S1,S2,WL, - Standard_True,Standard_True,Standard_True, - 1,nbp); + Standard_True,Standard_True,Standard_True, + 1,nbp); if(!approx.IsDone()) return Standard_False; -// tolreached = approx.TolReached3d(); -// Standard_Real tolr2d = approx.TolReached2d(); -// tolreached = Max(tolreached,ChFi3d_ConvTol2dToTol3d(S1,tolr2d)); -// tolreached = Max(tolreached,ChFi3d_ConvTol2dToTol3d(S2,tolr2d)); + // tolreached = approx.TolReached3d(); + // Standard_Real tolr2d = approx.TolReached2d(); + // tolreached = Max(tolreached,ChFi3d_ConvTol2dToTol3d(S1,tolr2d)); + // tolreached = Max(tolreached,ChFi3d_ConvTol2dToTol3d(S2,tolr2d)); const AppParCurves_MultiBSpCurve& mbs = approx.Value(1); Standard_Integer nbpol = mbs.NbPoles(); TColgp_Array1OfPnt pol3d(1,nbpol); @@ -3456,17 +3456,17 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, mbs.Curve(3,pol2d2); // The extremities of the intersection are reset on known points. if(ddeb >= tol1) { - pol3d(1) = pntd; - pol2d1(1).SetCoord(Pardeb(1),Pardeb(2)); - pol2d2(1).SetCoord(Pardeb(3),Pardeb(4)); -// tolreached = Max(tolreached,ddeb); + pol3d(1) = pntd; + pol2d1(1).SetCoord(Pardeb(1),Pardeb(2)); + pol2d2(1).SetCoord(Pardeb(3),Pardeb(4)); + // tolreached = Max(tolreached,ddeb); } - + if(dfin >= tol2) { - pol3d(nbpol) = pntf; - pol2d1(nbpol).SetCoord(Parfin(1),Parfin(2)); - pol2d2(nbpol).SetCoord(Parfin(3),Parfin(4)); -// tolreached = Max(tolreached,dfin); + pol3d(nbpol) = pntf; + pol2d1(nbpol).SetCoord(Parfin(1),Parfin(2)); + pol2d2(nbpol).SetCoord(Parfin(3),Parfin(4)); + // tolreached = Max(tolreached,dfin); } const TColStd_Array1OfReal& knots = mbs.Knots(); const TColStd_Array1OfInteger& mults = mbs.Multiplicities(); @@ -3475,6 +3475,8 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, Pc1 = new Geom2d_BSplineCurve(pol2d1,knots,mults,deg); Pc2 = new Geom2d_BSplineCurve(pol2d2,knots,mults,deg); tolreached = ChFi3d_EvalTolReached(S1,Pc1,S2,Pc2,C3d); + tolreached = Max(tolreached,ddeb); + tolreached = Max(tolreached,dfin); return Standard_True; } } @@ -3487,12 +3489,12 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, //======================================================================= Standard_Boolean ChFi3d_IntCS(Handle(Adaptor3d_HSurface)& S, - Handle(Adaptor3d_HCurve)& C, - gp_Pnt2d& p2dS, - Standard_Real& wc) + Handle(Adaptor3d_HCurve)& C, + gp_Pnt2d& p2dS, + Standard_Real& wc) { IntCurveSurface_HInter Intersection; - + Standard_Real uf = C->FirstParameter(), ul = C->LastParameter(); Standard_Real u1 = S->FirstUParameter(), u2 = S->LastUParameter(); Standard_Real v1 = S->FirstVParameter(), v2 = S->LastVParameter(); @@ -3512,20 +3514,20 @@ Standard_Boolean ChFi3d_IntCS(Handle(Adaptor3d_HSurface)& S, if(S->IsUPeriodic()) up = ChFi3d_InPeriod(up,u1,u1+S->UPeriod(),1.e-8); if(S->IsVPeriodic()) vp = ChFi3d_InPeriod(vp,v1,v1+S->VPeriod(),1.e-8); if(uf <= pint.W() && ul >= pint.W() && - u1 <= up && u2 >= up && - v1 <= vp && v2 >= vp) { - if(keepfirst && pint.W() < temp) { - temp = pint.W(); - isol = i; - } - else if(keeplast && pint.W() > temp) { - temp = pint.W(); - isol = i; - } - else if(Abs(pint.W() - wc) < dist) { - dist = Abs(pint.W() - wc); - isol = i; - } + u1 <= up && u2 >= up && + v1 <= vp && v2 >= vp) { + if(keepfirst && pint.W() < temp) { + temp = pint.W(); + isol = i; + } + else if(keeplast && pint.W() > temp) { + temp = pint.W(); + isol = i; + } + else if(Abs(pint.W() - wc) < dist) { + dist = Abs(pint.W() - wc); + isol = i; + } } } if(isol == 0) return Standard_False; @@ -3549,11 +3551,11 @@ Standard_Boolean ChFi3d_IntCS(Handle(Adaptor3d_HSurface)& S, //======================================================================= void ChFi3d_ComputesIntPC (const ChFiDS_FaceInterference& Fi1, - const ChFiDS_FaceInterference& Fi2, - const Handle(GeomAdaptor_HSurface)& HS1, - const Handle(GeomAdaptor_HSurface)& HS2, - Standard_Real& UInt1, - Standard_Real& UInt2) + const ChFiDS_FaceInterference& Fi2, + const Handle(GeomAdaptor_HSurface)& HS1, + const Handle(GeomAdaptor_HSurface)& HS2, + Standard_Real& UInt1, + Standard_Real& UInt2) { gp_Pnt bid; ChFi3d_ComputesIntPC(Fi1,Fi2,HS1,HS2,UInt1,UInt2,bid); @@ -3564,17 +3566,17 @@ void ChFi3d_ComputesIntPC (const ChFiDS_FaceInterference& Fi1, //purpose : //======================================================================= void ChFi3d_ComputesIntPC (const ChFiDS_FaceInterference& Fi1, - const ChFiDS_FaceInterference& Fi2, - const Handle(GeomAdaptor_HSurface)& HS1, - const Handle(GeomAdaptor_HSurface)& HS2, - Standard_Real& UInt1, - Standard_Real& UInt2, - gp_Pnt& P) + const ChFiDS_FaceInterference& Fi2, + const Handle(GeomAdaptor_HSurface)& HS1, + const Handle(GeomAdaptor_HSurface)& HS2, + Standard_Real& UInt1, + Standard_Real& UInt2, + gp_Pnt& P) { // Only one intersection to be carried out, however, the effort // is taken to check the extremities by an extrema c3d/c3d // created on pcurveonsurf of fillets. - + Standard_Real x,y,distref2; Fi1.PCurveOnSurf()->Value(UInt1).Coord(x,y); gp_Pnt p3d1 = HS1->Value(x,y); @@ -3615,28 +3617,28 @@ void ChFi3d_ComputesIntPC (const ChFiDS_FaceInterference& Fi1, //======================================================================= Handle(GeomAdaptor_HSurface) ChFi3d_BoundSurf(TopOpeBRepDS_DataStructure& DStr, - const Handle(ChFiDS_SurfData)& Fd1, - const Standard_Integer& IFaCo1, - const Standard_Integer& IFaArc1) + const Handle(ChFiDS_SurfData)& Fd1, + const Standard_Integer& IFaCo1, + const Standard_Integer& IFaArc1) { //rmq : as in fact 2 interferences of Fd1 serve only to set limits // indexes IFaCo1 and IFaArc1 are not useful. // They are preserver here as an option in case it will be necessary to set // more restrictive limits (with intersection points as additional argument). - + Handle(GeomAdaptor_HSurface) HS1 = new GeomAdaptor_HSurface(); GeomAdaptor_Surface& S1 = HS1->ChangeSurface(); S1.Load(DStr.Surface(Fd1->Surf()).Surface()); - + if ((IFaCo1 == 0)||(IFaArc1 == 0)) return HS1; - + const ChFiDS_FaceInterference& FiCo1 = Fd1->Interference(IFaCo1); const ChFiDS_FaceInterference& FiArc1 = Fd1->Interference(IFaArc1); - + Standard_Real Du,Dv,mu,Mu,mv,Mv; gp_Pnt2d UVf1,UVf2,UVl1,UVl2; - + UVf1 = FiCo1.PCurveOnSurf()->Value(FiCo1.FirstParameter()); UVl1 = FiCo1.PCurveOnSurf()->Value(FiCo1.LastParameter()); UVf2 = FiArc1.PCurveOnSurf()->Value(FiArc1.FirstParameter()); @@ -3647,21 +3649,21 @@ Handle(GeomAdaptor_HSurface) ChFi3d_BoundSurf(TopOpeBRepDS_DataStructure& DSt Dv = Max(0.5*Dv,4.*S1.Cylinder().Radius()); Du = 0.; S1.Load(DStr.Surface(Fd1->Surf()).Surface(), - mu,Mu,mv-Dv,Mv+Dv); + mu,Mu,mv-Dv,Mv+Dv); } //In the case of a torus or cone, it is not necessary that the bounds create a surface with period more than 2PI. else if (styp == GeomAbs_Torus || - styp == GeomAbs_Cone) { - Du = Min(M_PI-0.5*Du,0.1*Du); - Dv = 0.; - S1.Load(DStr.Surface(Fd1->Surf()).Surface(), - mu-Du,Mu+Du,mv,Mv); + styp == GeomAbs_Cone) { + Du = Min(M_PI-0.5*Du,0.1*Du); + Dv = 0.; + S1.Load(DStr.Surface(Fd1->Surf()).Surface(), + mu-Du,Mu+Du,mv,Mv); } else if (styp == GeomAbs_Plane) { Du = Max(0.5*Du,4.*Dv); Dv = 0.; S1.Load(DStr.Surface(Fd1->Surf()).Surface(), - mu-Du,Mu+Du,mv,Mv); + mu-Du,Mu+Du,mv,Mv); } return HS1; } @@ -3670,8 +3672,8 @@ Handle(GeomAdaptor_HSurface) ChFi3d_BoundSurf(TopOpeBRepDS_DataStructure& DSt //purpose : //======================================================================= Standard_Integer ChFi3d_SearchPivot(Standard_Integer* s, - Standard_Real u[3][3], - const Standard_Real t) + Standard_Real u[3][3], + const Standard_Real t) { // This function finds as pivot a cd the sections which of // do not cross on the opposite face. @@ -3681,7 +3683,7 @@ Standard_Integer ChFi3d_SearchPivot(Standard_Integer* s, // first one taken is not inevitably the best // it should be refined by comparing the parameters on // guide lines and (/or) radiuses. - + Standard_Boolean bondeb,bonfin; for(Standard_Integer i = 0; i <= 2; i++) { if(s[(i+1)%3] == 1) {bondeb = (u[(i+1)%3][i]-u[(i+1)%3][(i+2)%3] >= -t);} @@ -3700,20 +3702,20 @@ Standard_Integer ChFi3d_SearchPivot(Standard_Integer* s, //purpose : //======================================================================= Standard_Boolean ChFi3d_SearchFD(TopOpeBRepDS_DataStructure& DStr, - const Handle(ChFiDS_Stripe)& cd1, - const Handle(ChFiDS_Stripe)& cd2, - const Standard_Integer sens1, - const Standard_Integer sens2, - Standard_Integer& i1, - Standard_Integer& i2, - Standard_Real& p1, - Standard_Real& p2, - const Standard_Integer ind1, - const Standard_Integer ind2, - TopoDS_Face& face, - Standard_Boolean& sameside, - Standard_Integer& jf1, - Standard_Integer& jf2) + const Handle(ChFiDS_Stripe)& cd1, + const Handle(ChFiDS_Stripe)& cd2, + const Standard_Integer sens1, + const Standard_Integer sens2, + Standard_Integer& i1, + Standard_Integer& i2, + Standard_Real& p1, + Standard_Real& p2, + const Standard_Integer ind1, + const Standard_Integer ind2, + TopoDS_Face& face, + Standard_Boolean& sameside, + Standard_Integer& jf1, + Standard_Integer& jf2) { Standard_Boolean found = Standard_False; Standard_Integer id1 = ind1, id2 = ind2; @@ -3727,31 +3729,31 @@ Standard_Boolean ChFi3d_SearchFD(TopOpeBRepDS_DataStructure& DStr, while( !found ) { for(i = id1; (i*sens1) <= (if1*sens1) && !found && !fini2; i = i+sens1 ) { if(ChFi3d_IsInFront(DStr,cd1,cd2,i,if2,sens1,sens2,p1,p2,face,sameside,jf1,jf2,visavis,Vtx,Standard_False,0)) { - i1 = i; - i2 = if2; - found = Standard_True; + i1 = i; + i2 = if2; + found = Standard_True; } else if (visavis && !visavisok) { - visavisok = Standard_True; - i1 = i; - i2 = if2; + visavisok = Standard_True; + i1 = i; + i2 = if2; } } if(!fini1) { if1 = if1 + sens1; if(if1 < 1 || if1 > l1) { if1 = if1 - sens1; fini1 = Standard_True; } } - + for(i = id2; (i*sens2) <= (if2*sens2) && !found && !fini1; i = i+sens2 ) { if(ChFi3d_IsInFront(DStr,cd1,cd2,if1,i,sens1,sens2,p1,p2,face,sameside,jf1,jf2,visavis,Vtx,Standard_False,0)) { - i1 = if1; - i2 = i; - found = Standard_True; + i1 = if1; + i2 = i; + found = Standard_True; } else if (visavis && !visavisok) { - visavisok = Standard_True; - i1 = if1; - i2 = i; + visavisok = Standard_True; + i1 = if1; + i2 = i; } } if(!fini2) { @@ -3770,9 +3772,9 @@ Standard_Boolean ChFi3d_SearchFD(TopOpeBRepDS_DataStructure& DStr, //======================================================================= void ChFi3d_Parameters(const Handle(Geom_Surface)& S, - const gp_Pnt& p3d, - Standard_Real& u, - Standard_Real& v) + const gp_Pnt& p3d, + Standard_Real& u, + Standard_Real& v) { GeomAdaptor_Surface gas(S); switch ( gas.GetType() ) { @@ -3797,9 +3799,9 @@ void ChFi3d_Parameters(const Handle(Geom_Surface)& S, { GeomAPI_ProjectPointOnSurf tool(p3d,S); if ( tool.NbPoints() != 1 ) - StdFail_NotDone::Raise(""); + StdFail_NotDone::Raise(""); else - tool.Parameters(1,u,v); + tool.Parameters(1,u,v); } } } @@ -3811,9 +3813,9 @@ void ChFi3d_Parameters(const Handle(Geom_Surface)& S, //======================================================================= void ChFi3d_TrimCurve(const Handle(Geom_Curve)& gc, - const gp_Pnt& FirstP, - const gp_Pnt& LastP, - Handle(Geom_TrimmedCurve)& gtc) + const gp_Pnt& FirstP, + const gp_Pnt& LastP, + Handle(Geom_TrimmedCurve)& gtc) { Standard_Real uf = 0.,ul = 0.; GeomAdaptor_Curve gac(gc); @@ -3850,17 +3852,17 @@ void ChFi3d_TrimCurve(const Handle(Geom_Curve)& gc, break; default : { - GeomAPI_ProjectPointOnCurve tool(FirstP,gc); - if ( tool.NbPoints() != 1 ) - StdFail_NotDone::Raise(""); - else - uf = tool.Parameter(1); - tool.Init(LastP,gc); - if ( tool.NbPoints() != 1 ) - StdFail_NotDone::Raise(""); - else - ul = tool.Parameter(1); - } + GeomAPI_ProjectPointOnCurve tool(FirstP,gc); + if ( tool.NbPoints() != 1 ) + StdFail_NotDone::Raise(""); + else + uf = tool.Parameter(1); + tool.Init(LastP,gc); + if ( tool.NbPoints() != 1 ) + StdFail_NotDone::Raise(""); + else + ul = tool.Parameter(1); + } } gtc = new Geom_TrimmedCurve(gc,uf,ul); } @@ -3872,10 +3874,10 @@ void ChFi3d_TrimCurve(const Handle(Geom_Curve)& gc, //purpose : //======================================================================= static Standard_Boolean GoodExt(const Handle(Geom_Curve)& C, - const gp_Vec& V, - const Standard_Real f, - const Standard_Real l, - const Standard_Real a) + const gp_Vec& V, + const Standard_Real f, + const Standard_Real l, + const Standard_Real a) { for(Standard_Integer i = 0; i < 6; i++) { gp_Pnt d0; gp_Vec d1; @@ -3893,11 +3895,11 @@ static Standard_Boolean GoodExt(const Handle(Geom_Curve)& C, //======================================================================= Standard_EXPORT void ChFi3d_PerformElSpine(Handle(ChFiDS_HElSpine)& HES, - Handle(ChFiDS_Spine)& Spine, - const GeomAbs_Shape continuity, - const Standard_Real tol) + Handle(ChFiDS_Spine)& Spine, + const GeomAbs_Shape continuity, + const Standard_Real tol) { - + Standard_Boolean periodic, Bof, checkdeb, cepadur,bIsSmooth; Standard_Integer IEdge,IF,IL,nbed, iToApproxByC2; Standard_Real WF, WL, Wrefdeb, Wreffin,nwf,nwl,period,pared = 0.,tolpared; @@ -3910,7 +3912,7 @@ Standard_EXPORT Handle(Geom_BSplineCurve) BS, BSpline; TopoDS_Edge E, Eold; TopoDS_Vertex V; - // + // ChFiDS_ElSpine& ES = HES->ChangeCurve(); WF = ES.FirstParameter(); WL = ES.LastParameter(); @@ -3975,14 +3977,14 @@ Standard_EXPORT Standard_Real ureffin = Spine->LastParameter(IL); Standard_Boolean checkfin = (nwl < ureffin); if(checkfin) { - Spine->Parameter(IL,nwl,pared,0); - pared = Cv->ReversedParameter(pared); + Spine->Parameter(IL,nwl,pared,0); + pared = Cv->ReversedParameter(pared); } else { - pared = Last; + pared = Last; } if(pared < Last) { - Last = pared; + Last = pared; } } Cv = Cv->Reversed(); @@ -3998,13 +4000,13 @@ Standard_EXPORT Standard_Real ureffin = Spine->LastParameter(IL); Standard_Boolean checkfin = (nwl < ureffin); if(checkfin) { - Spine->Parameter(IL,nwl,pared,0); + Spine->Parameter(IL,nwl,pared,0); } else { - pared = Last; + pared = Last; } if(pared < Last) { - Last = pared; + Last = pared; } } }// else {//#1 @@ -4082,25 +4084,25 @@ Standard_EXPORT Standard_Real ureffin = Spine->LastParameter(iloc); Standard_Boolean checkfin = (nwl < ureffin); if(checkfin) { - Spine->Parameter(iloc,nwl,pared,0); + Spine->Parameter(iloc,nwl,pared,0); } else { - pared = Last; + pared = Last; } if(E.Orientation() == TopAbs_REVERSED) { - Standard_Real sov = First; - First = Cv->ReversedParameter(Last); - Last = Cv->ReversedParameter(sov); - if(checkfin) { - pared = Cv->ReversedParameter(pared); - } - else{ - pared = Last; - } - Cv = Cv->Reversed(); + Standard_Real sov = First; + First = Cv->ReversedParameter(Last); + Last = Cv->ReversedParameter(sov); + if(checkfin) { + pared = Cv->ReversedParameter(pared); + } + else{ + pared = Last; + } + Cv = Cv->Reversed(); } if(pared < Last) { - Last = pared; + Last = pared; } } // @@ -4126,8 +4128,8 @@ Standard_EXPORT if (!Bof) { Bof = Concat.Add( TC, 200.*epsV, Standard_True ); if (!Bof) { - Standard_ConstructionError::Raise("PerformElSpine: spine merged error"); - } + Standard_ConstructionError::Raise("PerformElSpine: spine merged error"); + } } Eold = E; }// for (IEdge=IF+1; IEdge<=IL; ++IEdge) { @@ -4169,8 +4171,8 @@ Standard_EXPORT gacurve.Load(newc); GCPnts_AbscissaPoint GCP(gacurve,-rabdist,Wrefdeb,WF); if(GCP.IsDone()) { - WF = GCP.Parameter(); - goodext = GoodExt(newc,VrefDeb,Wrefdeb,WF,Angle); + WF = GCP.Parameter(); + goodext = GoodExt(newc,VrefDeb,Wrefdeb,WF,Angle); } } if(caredeb) { @@ -4194,8 +4196,8 @@ Standard_EXPORT gacurve.Load(newc); GCPnts_AbscissaPoint GCP(gacurve,rabdist,Wreffin,WL); if(GCP.IsDone()) { - WL = GCP.Parameter(); - goodext = GoodExt(newc, VrefFin, Wreffin,WL,Angle); + WL = GCP.Parameter(); + goodext = GoodExt(newc, VrefFin, Wreffin,WL,Angle); } } if(carefin) { @@ -4282,7 +4284,7 @@ Standard_EXPORT BSpline->SetPeriodic(); //modified by NIZNHY-PKV Fri Dec 10 12:20:22 2010ft if (iToApproxByC2) { - Bof = BSpline->RemoveKnot(1, MultMax, Abs(WL-WF)/10); + Bof = BSpline->RemoveKnot(1, MultMax, Abs(WL-WF)/10); } //Bof = BSpline->RemoveKnot(1, MultMax, Abs(WL-WF)/10); //modified by NIZNHY-PKV Mon Dec 13 14:12:54 2010t @@ -4300,10 +4302,10 @@ Standard_EXPORT Standard_Real scaldeb = VrefDeb.Dot(V1); Standard_Real disdeb = PDeb.Distance(P1); if((Abs(WF-LocalWF) < 1.e-12) && - ((scaldeb <= 0.9999999) || - disdeb >= tol)) { - // Yes if there was no extension and the tangent is not the good one. - adjust = Standard_True; + ((scaldeb <= 0.9999999) || + disdeb >= tol)) { + // Yes if there was no extension and the tangent is not the good one. + adjust = Standard_True; } BSpline->D1(WL, P2, V2); V2.Normalize(); @@ -4311,10 +4313,10 @@ Standard_EXPORT Standard_Real scalfin = VrefFin.Dot(V2); Standard_Real disfin = PFin.Distance(P2); if((Abs(WL-LocalWL) < 1.e-12) && - ((scalfin <= 0.9999999)|| - disfin >= tol)) { - // the same at the end - adjust = Standard_True; + ((scalfin <= 0.9999999)|| + disfin >= tol)) { + // the same at the end + adjust = Standard_True; } if(adjust) { GeomLib::AdjustExtremity(BSpline, PDeb, PFin, VrefDeb, VrefFin); @@ -4331,8 +4333,8 @@ Standard_EXPORT // The map contains two faces adjacent to an edge //======================================================================= void ChFi3d_cherche_face1 (const TopTools_ListOfShape & map, - const TopoDS_Face & F1, - TopoDS_Face & F) + const TopoDS_Face & F1, + TopoDS_Face & F) { TopoDS_Face Fcur; Standard_Boolean trouve=Standard_False; @@ -4349,10 +4351,10 @@ void ChFi3d_cherche_face1 (const TopTools_ListOfShape & map, // Vtx is the other vertex of E //======================================================================= void ChFi3d_cherche_element(const TopoDS_Vertex & V, - const TopoDS_Edge & E1, - const TopoDS_Face & F1, - TopoDS_Edge & E , - TopoDS_Vertex & Vtx ) + const TopoDS_Edge & E1, + const TopoDS_Face & F1, + TopoDS_Edge & E , + TopoDS_Vertex & Vtx ) { Standard_Integer ie; TopoDS_Vertex V1,V2; @@ -4366,18 +4368,18 @@ void ChFi3d_cherche_element(const TopoDS_Vertex & V, TopTools_IndexedMapOfShape MapV; TopExp::MapShapes(Ecur, TopAbs_VERTEX, MapV); if (MapV.Extent()==2) { - V1 = TopoDS::Vertex (MapV(1)); - V2 = TopoDS::Vertex (MapV(2)); - if (V1.IsSame(V)) { - Vtx=V2; - E=Ecur; - trouve=Standard_True; - } - else if (V2.IsSame(V)) { - Vtx=V1; - E=Ecur; - trouve=Standard_True; - } + V1 = TopoDS::Vertex (MapV(1)); + V2 = TopoDS::Vertex (MapV(2)); + if (V1.IsSame(V)) { + Vtx=V2; + E=Ecur; + trouve=Standard_True; + } + else if (V2.IsSame(V)) { + Vtx=V1; + E=Ecur; + trouve=Standard_True; + } } } } @@ -4388,10 +4390,10 @@ void ChFi3d_cherche_element(const TopoDS_Vertex & V, // containing vertex V Vtx is the other vertex of E. //======================================================================= void ChFi3d_cherche_edge(const TopoDS_Vertex & V, - const TopTools_Array1OfShape & E1, - const TopoDS_Face & F1, - TopoDS_Edge & E , - TopoDS_Vertex & Vtx ) + const TopTools_Array1OfShape & E1, + const TopoDS_Face & F1, + TopoDS_Edge & E , + TopoDS_Vertex & Vtx ) { Standard_Integer ie,i; TopoDS_Vertex V1,V2; @@ -4404,24 +4406,24 @@ void ChFi3d_cherche_edge(const TopoDS_Vertex & V, Ecur=TopoDS::Edge (MapE(ie)); same=Standard_False; for (i=E1.Lower();i<=E1.Upper() ;i++) { - if (Ecur.IsSame(E1.Value(i))) same=Standard_True; + if (Ecur.IsSame(E1.Value(i))) same=Standard_True; } - if (!same) { + if (!same) { TopTools_IndexedMapOfShape MapV; TopExp::MapShapes(Ecur, TopAbs_VERTEX, MapV); if (MapV.Extent()==2) { - V1 = TopoDS::Vertex (MapV(1)); - V2 = TopoDS::Vertex (MapV(2)); - if (V1.IsSame(V)) { - Vtx=V2; - E=Ecur; - trouve=Standard_True; - } - else if (V2.IsSame(V)) { - Vtx=V1; - E=Ecur; - trouve=Standard_True; - } + V1 = TopoDS::Vertex (MapV(1)); + V2 = TopoDS::Vertex (MapV(2)); + if (V1.IsSame(V)) { + Vtx=V2; + E=Ecur; + trouve=Standard_True; + } + else if (V2.IsSame(V)) { + Vtx=V1; + E=Ecur; + trouve=Standard_True; + } } } } @@ -4434,18 +4436,18 @@ void ChFi3d_cherche_edge(const TopoDS_Vertex & V, //======================================================================= Standard_Integer ChFi3d_nbface (const TopTools_ListOfShape & mapVF ) { Standard_Integer nface=0; - TopTools_ListIteratorOfListOfShape ItF,JtF; - Standard_Integer fj = 0; - for (ItF.Initialize(mapVF); ItF.More(); ItF.Next()) { - fj++; - Standard_Integer kf = 1; - const TopoDS_Shape& cur = ItF.Value(); - for (JtF.Initialize(mapVF); JtF.More( )&&(kf Resolution) { - C->D0(t, P1); - LProp.CentreOfCurvature(P2); - PrevVec = gp_Vec(P1, P2); - prevVecFound = Standard_True; - break; + C->D0(t, P1); + LProp.CentreOfCurvature(P2); + PrevVec = gp_Vec(P1, P2); + prevVecFound = Standard_True; + break; } t += step; } @@ -4760,28 +4762,28 @@ Standard_Boolean ChFi3d_IsSmooth( const Handle(Geom_Curve)& C ) Standard_Real t = TI(intrv); Standard_Real step = (TI(intrv+1) - t) / Discretisation; for (ii = 1; ii <= Discretisation; ii++) - { - LProp.SetParameter(t); - if (!LProp.IsTangentDefined()) - return Standard_False; - Curvature = Abs(LProp.Curvature()); - if (Curvature > Resolution) - { - C->D0(t, P1); - LProp.CentreOfCurvature(P2); - gp_Vec Vec(P1, P2); - Standard_Real Angle = PrevVec.Angle( Vec ); - if (Angle > M_PI/3.) - return Standard_False; - Standard_Real Ratio = Vec.Magnitude() / PrevVec.Magnitude(); - if (Ratio < 1.) - Ratio = 1. / Ratio; - if (Ratio > 2. && (intrv != nbintv || ii != Discretisation)) - return Standard_False; - PrevVec = Vec; - } - t += step; + { + LProp.SetParameter(t); + if (!LProp.IsTangentDefined()) + return Standard_False; + Curvature = Abs(LProp.Curvature()); + if (Curvature > Resolution) + { + C->D0(t, P1); + LProp.CentreOfCurvature(P2); + gp_Vec Vec(P1, P2); + Standard_Real Angle = PrevVec.Angle( Vec ); + if (Angle > M_PI/3.) + return Standard_False; + Standard_Real Ratio = Vec.Magnitude() / PrevVec.Magnitude(); + if (Ratio < 1.) + Ratio = 1. / Ratio; + if (Ratio > 2. && (intrv != nbintv || ii != Discretisation)) + return Standard_False; + PrevVec = Vec; } + t += step; + } } return Standard_True; diff --git a/src/IntCurve/IntCurve_ExactIntersectionPoint.gxx b/src/IntCurve/IntCurve_ExactIntersectionPoint.gxx index b0ede4d1dd..5318961892 100644 --- a/src/IntCurve/IntCurve_ExactIntersectionPoint.gxx +++ b/src/IntCurve/IntCurve_ExactIntersectionPoint.gxx @@ -203,13 +203,14 @@ void IntCurve_ExactIntersectionPoint::MathPerform(void) ,ToleranceVector ,BInfVector ,BSupVector - ,50); + ,60); if(Fct.IsDone()) { Fct.Root(Root); nbroots = 1; math_Vector XY(1,2); FctDist.Value(Root,XY); Standard_Real dist2 = ((XY(1)*XY(1)+XY(2)*XY(2))); + if(dist2 > myTol) { nbroots = 0; diff --git a/src/IntCurve/IntCurve_IntPolyPolyGen.gxx b/src/IntCurve/IntCurve_IntPolyPolyGen.gxx index d4eb46caa8..ba8ac30dab 100644 --- a/src/IntCurve/IntCurve_IntPolyPolyGen.gxx +++ b/src/IntCurve/IntCurve_IntPolyPolyGen.gxx @@ -45,6 +45,8 @@ #include #include #include +#include +#include //====================================================================== @@ -58,7 +60,12 @@ //---------------------------------------------------------------------- - +void GetIntersection(const TheCurve& theC1, const Standard_Real theT1f, const Standard_Real theT1l, + const TheCurve& theC2, const Standard_Real theT2f, const Standard_Real theT2l, + const Standard_Real theTolConf, + const Standard_Integer theMaxCount, + IntRes2d_IntersectionPoint& thePInt, Standard_Real& theDist, + Standard_Integer& theCount); Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1 @@ -787,10 +794,30 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect( //-------------------------------------------------------------------- //-- On verifie que le point trouve est bien une racine //-------------------------------------------------------------------- + EIP.Roots(U,V); TheCurveTool::D1(C1,U,P1,Tan1); TheCurveTool::D1(C2,V,P2,Tan2); Standard_Real Dist = P1.Distance(P2); + if(EIP.NbRoots() == 0 && Dist > TolConf) + { + IntRes2d_Transition aTrans; + IntRes2d_IntersectionPoint aPInt(P1, U, V, aTrans, aTrans, Standard_False); + Standard_Real aT1f, aT1l, aT2f, aT2l; + aT1f= thePoly1.ApproxParamOnCurve(SegIndex1, 0.0); + aT1l= thePoly1.ApproxParamOnCurve(SegIndex1, 1.0); + aT2f= thePoly2.ApproxParamOnCurve(SegIndex2, 0.0); + aT2l= thePoly2.ApproxParamOnCurve(SegIndex2, 1.0); + // + Standard_Integer aMaxCount = 16, aCount = 0; + GetIntersection(C1, aT1f, aT1l, C2, aT2f, aT2l, TolConf, aMaxCount, + aPInt, Dist, aCount); + U = aPInt.ParamOnFirst(); + V = aPInt.ParamOnSecond(); + TheCurveTool::D1(C1,U,P1,Tan1); + TheCurveTool::D1(C2,V,P2,Tan2); + Dist = P1.Distance(P2); + } //----------------------------------------------------------------- //-- On verifie que le point (u,v) n existe pas deja //-- @@ -1031,3 +1058,130 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect( return Standard_True; } +//====================================================================== +// GetIntersection +//====================================================================== + +void GetIntersection(const TheCurve& theC1, const Standard_Real theT1f, const Standard_Real theT1l, + const TheCurve& theC2, const Standard_Real theT2f, const Standard_Real theT2l, + const Standard_Real theTolConf, + const Standard_Integer theMaxCount, + IntRes2d_IntersectionPoint& thePInt, Standard_Real& theDist, + Standard_Integer& theCount) +{ + theCount++; + // + Standard_Real aTol2 = theTolConf*theTolConf; + Standard_Real aPTol1 = Max(100.*Epsilon(Max(Abs(theT1f), Abs(theT1l))), Precision::PConfusion()); + Standard_Real aPTol2 = Max(100.*Epsilon(Max(Abs(theT2f), Abs(theT2l))), Precision::PConfusion()); + gp_Pnt2d aP1f, aP1l, aP2f, aP2l; + Bnd_Box2d aB1, aB2; + // + TheCurveTool::D0(theC1, theT1f, aP1f); + TheCurveTool::D0(theC1, theT1l, aP1l); + aB1.Add(aP1f); + aB1.Add(aP1l); + aB1.Enlarge(theTolConf); + // + TheCurveTool::D0(theC2, theT2f, aP2f); + TheCurveTool::D0(theC2, theT2l, aP2l); + aB2.Add(aP2f); + aB2.Add(aP2l); + aB2.Enlarge(theTolConf); + // + if(aB1.IsOut(aB2)) + { + theCount--; + return; + } + // + Standard_Boolean isSmall1 = (theT1l - theT1f) <= aPTol1 || aP1f.SquareDistance(aP1l) / 4. <= aTol2; + Standard_Boolean isSmall2 = (theT2l - theT2f) <= aPTol2 || aP2f.SquareDistance(aP2l) / 4. <= aTol2; + + if((isSmall1 && isSmall2) || (theCount > theMaxCount)) + { + //Seems to be intersection + //Simple treatment of segment intersection + gp_XY aPnts1[3] = {aP1f.XY(), (aP1f.XY() + aP1l.XY()) / 2., aP1l.XY()}; + gp_XY aPnts2[3] = {aP2f.XY(), (aP2f.XY() + aP2l.XY()) / 2., aP2l.XY()}; + Standard_Integer i, j, imin = -1, jmin = -1; + Standard_Real dmin = RealLast(), d; + for(i = 0; i < 3; i++) + { + for(j = 0; j < 3; j++) + { + d = (aPnts1[i] - aPnts2[j]).SquareModulus(); + if(d < dmin) + { + dmin=d; + imin = i; + jmin = j; + } + } + } + // + dmin = Sqrt(dmin); + if(theDist > dmin) + { + theDist = dmin; + // + Standard_Real t1; + if(imin == 0) + { + t1 = theT1f; + } + else if(imin == 1) + { + t1 = (theT1f + theT1l) / 2.; + } + else + { + t1 = theT1l; + } + // + Standard_Real t2; + if(jmin == 0) + { + t2 = theT2f; + } + else if(jmin == 1) + { + t2 = (theT2f + theT2l) / 2.; + } + else + { + t2 = theT2l; + } + // + gp_Pnt2d aPint((aPnts1[imin] + aPnts2[jmin])/2.); + // + IntRes2d_Transition aTrans1, aTrans2; + thePInt.SetValues(aPint, t1, t2, aTrans1, aTrans2, Standard_False); + } + theCount--; + return; + } + + if(isSmall1) + { + Standard_Real aT2m = (theT2l + theT2f) / 2.; + GetIntersection(theC1, theT1f, theT1l, theC2, theT2f, aT2m, theTolConf, theMaxCount, thePInt, theDist, theCount); + GetIntersection(theC1, theT1f, theT1l, theC2, aT2m, theT2l, theTolConf, theMaxCount, thePInt, theDist, theCount); + } + else if(isSmall2) + { + Standard_Real aT1m = (theT1l + theT1f) / 2.; + GetIntersection(theC1, theT1f, aT1m, theC2, theT2f, theT2l, theTolConf, theMaxCount, thePInt, theDist, theCount); + GetIntersection(theC1, aT1m, theT1l, theC2, theT2f, theT2l, theTolConf, theMaxCount, thePInt, theDist, theCount); + } + else + { + Standard_Real aT1m = (theT1l + theT1f) / 2.; + Standard_Real aT2m = (theT2l + theT2f) / 2.; + GetIntersection(theC1, theT1f, aT1m, theC2, theT2f, aT2m, theTolConf, theMaxCount, thePInt, theDist, theCount); + GetIntersection(theC1, theT1f, aT1m, theC2, aT2m, theT2l, theTolConf, theMaxCount, thePInt, theDist, theCount); + GetIntersection(theC1, aT1m, theT1l, theC2, theT2f, aT2m, theTolConf, theMaxCount, thePInt, theDist, theCount); + GetIntersection(theC1, aT1m, theT1l, theC2, aT2m, theT2l, theTolConf, theMaxCount, thePInt, theDist, theCount); + } + +} diff --git a/src/MAT2d/MAT2d_Mat2d.cxx b/src/MAT2d/MAT2d_Mat2d.cxx index 820a8fbd28..d5a62084fb 100644 --- a/src/MAT2d/MAT2d_Mat2d.cxx +++ b/src/MAT2d/MAT2d_Mat2d.cxx @@ -830,10 +830,14 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) Standard_Integer parama[2]; Standard_Integer paramb[2]; + // + Standard_Integer aNbOfNarea1 = 0, aPrefNarea = 0, aNbMaxNarea1 = 10; + Standard_Integer aNbElts[2] = {0, 0}, aCountElts[2] = {0, 0}; + Standard_Boolean isBreak = Standard_False; -// ----------------------------------------- -// Initialisation et remise a zero des maps. -// ----------------------------------------- + // ----------------------------------------- + // Initialisation et remise a zero des maps. + // ----------------------------------------- bisectoronetoremove.Clear(); bisectortwotoremove.Clear(); typeofbisectortoremove.Clear(); @@ -843,10 +847,10 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) noofbisectors = noofedges; beginbisector = 0; -// -------------------------------------------------------------------- -// Construction de un edge correspond a un element simple -// du contour. -// -------------------------------------------------------------------- + // -------------------------------------------------------------------- + // Construction de un edge correspond a un element simple + // du contour. + // -------------------------------------------------------------------- theedgelist = new MAT_ListOfEdge(); for(i=0; iDistance(-1); theedgelist->BackAdd(edge); } - + theedgelist->Loop(); -//--------------------------------------------------- -// Initialisation des bissectrices issues du contour. -//--------------------------------------------------- + //--------------------------------------------------- + // Initialisation des bissectrices issues du contour. + //--------------------------------------------------- Standard_Real Dist; theedgelist->First(); @@ -879,9 +883,9 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) (atool.TangentAfter(theedgelist->Current()->EdgeNumber(), myIsOpenResult)); } -//---------------------------------------------------- -// Affectation a chaque edge de ses deux bissectrices. -//---------------------------------------------------- + //---------------------------------------------------- + // Affectation a chaque edge de ses deux bissectrices. + //---------------------------------------------------- theedgelist->First(); for(i=0; iNumber(); i++) { @@ -892,9 +896,9 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) theedgelist->Next(); } -//=========================================================================== -// Boucle Principale (etape 2) -//=========================================================================== + //=========================================================================== + // Boucle Principale (etape 2) + //=========================================================================== Standard_Integer NumberOfIte = 0; while(theedgelist->Number()>1) { @@ -903,12 +907,12 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) // ------------------------------------------------------------------ // Creation des geometries des bissectrices via le tool. (etape 2.1) // ------------------------------------------------------------------- - + Standard_Integer aNbBis = noofbisectors - beginbisector; for(i=beginbisector; iBisectorNumber(),1); #ifdef ICONTINUE @@ -917,15 +921,55 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) #endif } + //Patch to prevent infinit loop because of + //bad geometry + if(aNbBis == 1) + { + if(aPrefNarea == 1) + { + aNbOfNarea1++; + Standard_Integer edge1number = bisectormap(beginbisector)->FirstEdge()->EdgeNumber(); + Standard_Integer edge2number = bisectormap(beginbisector)->SecondEdge()->EdgeNumber(); + if(aNbElts[0] == edge1number) + { + aCountElts[0]++; + } + else + { + aCountElts[0] = 0; + aNbElts[0] = edge1number; + } + if(aNbElts[1] == edge2number) + { + aCountElts[1]++; + } + else + { + aCountElts[1] = 0; + aNbElts[1] = edge2number; + } + if(aNbOfNarea1 >= aNbMaxNarea1 && (aCountElts[0] >= aNbMaxNarea1 || aCountElts[1] >= aNbMaxNarea1)) + { + isBreak = Standard_True; + } + } + else + { + aNbOfNarea1 = 0; + aCountElts[0] = 0; + aCountElts[1] = 0; + } + } + aPrefNarea = aNbBis; // --------------------------------------------- // Condition de sortie de la boucle principale. // --------------------------------------------- -// Modified by Sergey KHROMOV - Fri Nov 17 10:28:28 2000 Begin + // Modified by Sergey KHROMOV - Fri Nov 17 10:28:28 2000 Begin if (theedgelist->Number() < 3) break; -// Modified by Sergey KHROMOV - Fri Nov 17 10:28:37 2000 End - + // Modified by Sergey KHROMOV - Fri Nov 17 10:28:37 2000 End + //--------------------------------------------------- // boucle 2 Tant qu il y a des bisectrices a effacer. //--------------------------------------------------- @@ -940,51 +984,51 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) //-------------------------------------------------------------- if (NbIterBis <= EvenNbIterBis+1) - EdgeNumbers(NbIterBis) = theedgelist->Number(); + EdgeNumbers(NbIterBis) = theedgelist->Number(); else - { - for (k = 1; k <= EvenNbIterBis; k++) - EdgeNumbers(k) = EdgeNumbers(k+1); - EdgeNumbers(EvenNbIterBis+1) = theedgelist->Number(); - } + { + for (k = 1; k <= EvenNbIterBis; k++) + EdgeNumbers(k) = EdgeNumbers(k+1); + EdgeNumbers(EvenNbIterBis+1) = theedgelist->Number(); + } if (EdgeNumbers(EvenNbIterBis+1) == EdgeNumbers(1)) - ToNullifyNoofbisectorstoremove = Standard_True; + ToNullifyNoofbisectorstoremove = Standard_True; for(i=0; iNumber(); i++) { - edge = theedgelist->Current(); - if(edge->Distance() == -1.) { - firstbisector = edge->FirstBisector(); - secondbisector = edge->SecondBisector(); - edge->Distance(atool.IntersectBisector - (firstbisector,secondbisector,intersectionpoint)); - edge->IntersectionPoint(intersectionpoint); + edge = theedgelist->Current(); + if(edge->Distance() == -1.) { + firstbisector = edge->FirstBisector(); + secondbisector = edge->SecondBisector(); + edge->Distance(atool.IntersectBisector + (firstbisector,secondbisector,intersectionpoint)); + edge->IntersectionPoint(intersectionpoint); - if(edge->Distance() == Precision::Infinite()) { - if(firstbisector->IndexNumber() >= beginbisector || - secondbisector->IndexNumber() >= beginbisector) - Intersect(atool,0,noofbisectorstoremove, - firstbisector,secondbisector ); - } - else { - if(firstbisector->IndexNumber() >= beginbisector) { - Intersect(atool,1,noofbisectorstoremove, - firstbisector,secondbisector ); - } - if(secondbisector->IndexNumber() >= beginbisector) { - Intersect(atool,2,noofbisectorstoremove, - firstbisector,secondbisector ); - } - } - } - theedgelist->Next(); + if(edge->Distance() == Precision::Infinite()) { + if(firstbisector->IndexNumber() >= beginbisector || + secondbisector->IndexNumber() >= beginbisector) + Intersect(atool,0,noofbisectorstoremove, + firstbisector,secondbisector ); + } + else { + if(firstbisector->IndexNumber() >= beginbisector) { + Intersect(atool,1,noofbisectorstoremove, + firstbisector,secondbisector ); + } + if(secondbisector->IndexNumber() >= beginbisector) { + Intersect(atool,2,noofbisectorstoremove, + firstbisector,secondbisector ); + } + } + } + theedgelist->Next(); } - + //------------------------------- // Test de sortie de la boucle 2. //------------------------------- if (ToNullifyNoofbisectorstoremove) - noofbisectorstoremove = 0; + noofbisectorstoremove = 0; if(noofbisectorstoremove == 0) break; //--------------------------------------------------- @@ -993,119 +1037,119 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) for(i=0; i - // On descend dans l arbre jusqu a ce qu on atteigne - // + // On descend dans l arbre jusqu a ce qu on atteigne + // BisectorNumber(),0); + atool.Dump(bisectortoremove->BisectorNumber(),0); #endif - // ---------------------------------- - // Annulation de . - // ---------------------------------- - thenumberofbisectors--; - currentbisectorlist = bisectortoremove->List(); - currentbisectorlist->First(); - currentbisector = currentbisectorlist->FirstItem(); - previousedge = currentbisector->FirstEdge(); - theedgelist->Init(previousedge); - previousedge->Distance(-1.); - previousedge->FirstBisector()->SecondParameter(Precision::Infinite()); - previousedge->SecondBisector()->FirstParameter(Precision::Infinite()); + // ---------------------------------- + // Annulation de . + // ---------------------------------- + thenumberofbisectors--; + currentbisectorlist = bisectortoremove->List(); + currentbisectorlist->First(); + currentbisector = currentbisectorlist->FirstItem(); + previousedge = currentbisector->FirstEdge(); + theedgelist->Init(previousedge); + previousedge->Distance(-1.); + previousedge->FirstBisector()->SecondParameter(Precision::Infinite()); + previousedge->SecondBisector()->FirstParameter(Precision::Infinite()); - //------------------------------------------ - // Annulation des fils de . - //------------------------------------------ + //------------------------------------------ + // Annulation des fils de . + //------------------------------------------ - while(currentbisectorlist->More()) { - currentbisector = currentbisectorlist->Current(); - currentedge = currentbisector->SecondEdge(); + while(currentbisectorlist->More()) { + currentbisector = currentbisectorlist->Current(); + currentedge = currentbisector->SecondEdge(); - //--------------------------------------- - // Reinsertion de l edge dans le contour. - //--------------------------------------- - theedgelist->LinkAfter(currentedge); - theedgelist->Next(); - - currentedge->FirstBisector(currentbisector); - previousedge->SecondBisector(currentbisector); + //--------------------------------------- + // Reinsertion de l edge dans le contour. + //--------------------------------------- + theedgelist->LinkAfter(currentedge); + theedgelist->Next(); + + currentedge->FirstBisector(currentbisector); + previousedge->SecondBisector(currentbisector); #ifdef OCCT_DEBUG_Mat - atool.Dump(currentbisector->BisectorNumber(),0); + atool.Dump(currentbisector->BisectorNumber(),0); #endif - //------------------------------------------------------ - // Annulation de l intersection ie les fils qui - // ont generes l intersection sont prolonges a l infini. - //------------------------------------------------------ + //------------------------------------------------------ + // Annulation de l intersection ie les fils qui + // ont generes l intersection sont prolonges a l infini. + //------------------------------------------------------ + + currentbisector->FirstParameter (Precision::Infinite()); + currentbisector->SecondParameter(Precision::Infinite()); + + atool.TrimBisector(currentbisector); - currentbisector->FirstParameter (Precision::Infinite()); - currentbisector->SecondParameter(Precision::Infinite()); - - atool.TrimBisector(currentbisector); - #ifdef OCCT_DEBUG_Mat - atool.Dump(currentbisector->BisectorNumber(),1); + atool.Dump(currentbisector->BisectorNumber(),1); #endif - currentedge->Distance(-1.); - currentedge->FirstBisector()->SecondParameter(Precision::Infinite()); - currentedge->SecondBisector()->FirstParameter(Precision::Infinite()); - - previousedge = currentedge; - currentbisectorlist->Next(); - } - - theedgelist->Unlink(); + currentedge->Distance(-1.); + currentedge->FirstBisector()->SecondParameter(Precision::Infinite()); + currentedge->SecondBisector()->FirstParameter(Precision::Infinite()); - //----------------------------------------------------------- - // Test de sortie de la boucle d annulation des bissectrices. - //----------------------------------------------------------- + previousedge = currentedge; + currentbisectorlist->Next(); + } - if(bisectortoremove->BisectorNumber() == - bisectortwotoremove(i)->BisectorNumber()) break; + theedgelist->Unlink(); - //----------------------- - // Descente dans l arbre. - //----------------------- + //----------------------------------------------------------- + // Test de sortie de la boucle d annulation des bissectrices. + //----------------------------------------------------------- - if(typeofbisectortoremove(i) == 1) - bisectortoremove = bisectortoremove->FirstBisector(); - else - bisectortoremove = bisectortoremove->LastBisector(); - - } //---------------------------------------------------- - // Fin boucle d annulation des bissectrices issue de - // . - //---------------------------------------------------- + if(bisectortoremove->BisectorNumber() == + bisectortwotoremove(i)->BisectorNumber()) break; + + //----------------------- + // Descente dans l arbre. + //----------------------- + + if(typeofbisectortoremove(i) == 1) + bisectortoremove = bisectortoremove->FirstBisector(); + else + bisectortoremove = bisectortoremove->LastBisector(); + + } //---------------------------------------------------- + // Fin boucle d annulation des bissectrices issue de + // . + //---------------------------------------------------- } //------------------------------------------ - // Fin boucle d annulation des bissectrices. - //------------------------------------------- + // Fin boucle d annulation des bissectrices. + //------------------------------------------- #ifdef ICONTINUE cin>>Icontinue; #endif } //-------------- - // Fin Boucle 2. - //-------------- - + // Fin Boucle 2. + //-------------- + // ---------------------------------------------------------------------- // Analyse des parametres des intersections sur les bisectrices de chaque // edge et determination des portions de contour a supprimees. (etape 2.5) // ---------------------------------------------------------------------- theedgelist->First(); - + currentbisector = theedgelist->Current()->FirstBisector(); if (currentbisector->FirstParameter() == Precision::Infinite() && - currentbisector->SecondParameter() == Precision::Infinite()) { - parama[0] = -1; - paramb[0] = -1; + currentbisector->SecondParameter() == Precision::Infinite()) { + parama[0] = -1; + paramb[0] = -1; } else if(currentbisector->FirstParameter() == Precision::Infinite()) { parama[0] = -1; @@ -1116,60 +1160,60 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) parama[0] = 1; } else if (atool.Distance(currentbisector, - currentbisector->FirstParameter(), - currentbisector->SecondParameter()) - > toleranceofconfusion) { - if((currentbisector->FirstParameter() - - currentbisector->SecondParameter()) - *currentbisector->Sense() > 0.) { - parama[0] = -1; - paramb[0] = 1; - } - else { - paramb[0] = -1; - parama[0] = 1; - } + currentbisector->FirstParameter(), + currentbisector->SecondParameter()) + > toleranceofconfusion) { + if((currentbisector->FirstParameter() - + currentbisector->SecondParameter()) + *currentbisector->Sense() > 0.) { + parama[0] = -1; + paramb[0] = 1; + } + else { + paramb[0] = -1; + parama[0] = 1; + } } else { parama[0] = 1; paramb[0] = 1; } - + narea = -1; - + for(i=0; iNumber(); i++) { currentbisector = theedgelist->Current()->SecondBisector(); if (currentbisector->FirstParameter() == Precision::Infinite() && - currentbisector->SecondParameter() == Precision::Infinite()) { - parama[1] = -1; - paramb[1] = -1; + currentbisector->SecondParameter() == Precision::Infinite()) { + parama[1] = -1; + paramb[1] = -1; } else if(currentbisector->FirstParameter() == Precision::Infinite()) { - parama[1] = -1; - paramb[1] = 1; + parama[1] = -1; + paramb[1] = 1; } else if(currentbisector->SecondParameter() == Precision::Infinite()) { - paramb[1] = -1; - parama[1] = 1; + paramb[1] = -1; + parama[1] = 1; } else if (atool.Distance(currentbisector, - currentbisector->FirstParameter(), - currentbisector->SecondParameter()) - > toleranceofconfusion) { - if((currentbisector->FirstParameter() - - currentbisector->SecondParameter()) - *currentbisector->Sense() > 0.) { - parama[1] = -1; - paramb[1] = 1; - } - else { - paramb[1] = -1; - parama[1] = 1; - } + currentbisector->FirstParameter(), + currentbisector->SecondParameter()) + > toleranceofconfusion) { + if((currentbisector->FirstParameter() - + currentbisector->SecondParameter()) + *currentbisector->Sense() > 0.) { + parama[1] = -1; + paramb[1] = 1; } else { - parama[1] = 1; - paramb[1] = 1; + paramb[1] = -1; + parama[1] = 1; + } + } + else { + parama[1] = 1; + paramb[1] = 1; } //----------------------------------------------------------------- @@ -1189,52 +1233,59 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) if(paramb[0] > 0 && parama[1] > 0) { #ifdef OCCT_DEBUG_Mat - cout <<" A ELIMINER "<Index(); - lastarea(narea) = firstarea(narea); - noofarea(narea) = 1; - } - else { - if(theedgelist->Index() == lastarea(narea)+1) { - lastarea(narea)++; - noofarea(narea)++; - } - else { - firstarea(++narea) = theedgelist->Index(); - lastarea(narea) = firstarea(narea); - noofarea(narea) = 1; - } - } + if(narea < 0) { + firstarea(++narea) = theedgelist->Index(); + lastarea(narea) = firstarea(narea); + noofarea(narea) = 1; + } + else { + if(theedgelist->Index() == lastarea(narea)+1) { + lastarea(narea)++; + noofarea(narea)++; + } + else { + firstarea(++narea) = theedgelist->Index(); + lastarea(narea) = firstarea(narea); + noofarea(narea) = 1; + } + } } parama[0] = parama[1]; paramb[0] = paramb[1]; theedgelist->Next(); - + } - + compact = 0; if(narea > 0) { if(lastarea(narea) == theedgelist->Number() && firstarea(0) == 1) { - firstarea(0) = firstarea(narea); - noofarea(0) = noofarea(0)+noofarea(narea); - compact = noofarea(narea); - narea--; + firstarea(0) = firstarea(narea); + noofarea(0) = noofarea(0)+noofarea(narea); + compact = noofarea(narea); + narea--; } } - + narea++; //------------------------------------------------------------------ // Sortie de la boucle principale si il n y a pas d edge a eliminer. // (etape 2.6) //------------------------------------------------------------------ + // + //Patch to break infinite loop. + if(narea == 1 && isBreak) + { + narea = 0; + } + // if(narea == 0) { interrupt = Standard_True; break; } - + //---------------------------------------------------------------- // Elimination des edges a enlever du contour @@ -1251,20 +1302,20 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) if(i == 1)shift = shift-compact; theedgelist->First(); edgetoremove = theedgelist->Brackets(firstarea(i)-shift); - + edgetoremove->FirstBisector()->EndPoint(edgetoremove - ->IntersectionPoint()); - + ->IntersectionPoint()); + #ifdef OCCT_DEBUG_Mat atool.Dump(edgetoremove->FirstBisector()->BisectorNumber(),0); #endif edgetoremove->FirstBisector()->FirstParameter - (edgetoremove->FirstBisector()->SecondParameter()); - + (edgetoremove->FirstBisector()->SecondParameter()); + #ifdef OCCT_DEBUG_Mat if(atool.TrimBisector(edgetoremove->FirstBisector())) - atool.Dump(edgetoremove->FirstBisector()->BisectorNumber(),1); + atool.Dump(edgetoremove->FirstBisector()->BisectorNumber(),1); #else atool.TrimBisector(edgetoremove->FirstBisector()); #endif @@ -1273,64 +1324,64 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) bisectormap(noofbisectors)->IndexNumber(noofbisectors); bisectormap(noofbisectors)->DistIssuePoint(edgetoremove->Distance()); bisectormap(noofbisectors)->IssuePoint(edgetoremove - ->IntersectionPoint()); + ->IntersectionPoint()); bisectormap(noofbisectors)->FirstEdge(theedgelist->PreviousItem()); bisectormap(noofbisectors)->AddBisector(edgetoremove - ->FirstBisector()); + ->FirstBisector()); for(j=0; jUnlink(); - theedgelist->Next(); - shift++; + theedgelist->Unlink(); + theedgelist->Next(); + shift++; #ifdef OCCT_DEBUG_Mat - cout<<" Suppression de l'arete : "<EdgeNumber()<EdgeNumber()<AddBisector(edgetoremove - ->SecondBisector()); - } - edgetoremove->SecondBisector()->EndPoint(edgetoremove - ->IntersectionPoint()); + if(all == 0 || j+1 != noofarea(i)) { + bisectormap(noofbisectors)->AddBisector(edgetoremove + ->SecondBisector()); + } + edgetoremove->SecondBisector()->EndPoint(edgetoremove + ->IntersectionPoint()); #ifdef OCCT_DEBUG_Mat - atool.Dump(edgetoremove->SecondBisector()->BisectorNumber(),0); + atool.Dump(edgetoremove->SecondBisector()->BisectorNumber(),0); #endif - edgetoremove->SecondBisector()->SecondParameter - (edgetoremove->SecondBisector()->FirstParameter()); + edgetoremove->SecondBisector()->SecondParameter + (edgetoremove->SecondBisector()->FirstParameter()); #ifdef OCCT_DEBUG_Mat - if(atool.TrimBisector(edgetoremove->SecondBisector())) - atool.Dump(edgetoremove->SecondBisector()->BisectorNumber(),1); + if(atool.TrimBisector(edgetoremove->SecondBisector())) + atool.Dump(edgetoremove->SecondBisector()->BisectorNumber(),1); #else - atool.TrimBisector(edgetoremove->SecondBisector()); + atool.TrimBisector(edgetoremove->SecondBisector()); #endif - edgetoremove = theedgelist->Current(); + edgetoremove = theedgelist->Current(); } bisectormap(noofbisectors)->SecondEdge(theedgelist->Current()); - + theedgelist->PreviousItem() - ->SecondBisector(bisectormap(noofbisectors)); + ->SecondBisector(bisectormap(noofbisectors)); theedgelist->Current()->FirstBisector(bisectormap(noofbisectors)); - + bisectormap(noofbisectors)->FirstVector - (atool.Tangent - (bisectormap(noofbisectors)->FirstBisector() - ->BisectorNumber())); - + (atool.Tangent + (bisectormap(noofbisectors)->FirstBisector() + ->BisectorNumber())); + bisectormap(noofbisectors)->SecondVector - (atool.Tangent - (bisectormap(noofbisectors)->LastBisector() - ->BisectorNumber())); - + (atool.Tangent + (bisectormap(noofbisectors)->LastBisector() + ->BisectorNumber())); + noofbisectors++; - + theedgelist->PreviousItem()->Distance(-1); theedgelist->Current()->Distance(-1); - + theedgelist->PreviousItem()->FirstBisector() - ->SecondParameter(Precision::Infinite()); + ->SecondParameter(Precision::Infinite()); theedgelist->Current()->SecondBisector()->FirstParameter(Precision::Infinite()); } @@ -1348,9 +1399,9 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) NumberOfIte++; } //=============================================== - // Fin Boucle Principale. - //=============================================== - + // Fin Boucle Principale. + //=============================================== + //---------- // etape 3. //---------- @@ -1359,7 +1410,7 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) //---------------------------------------------- // interupt = True => bissectrices semi_infinies. //---------------------------------------------- - + if(interrupt) semiInfinite = Standard_True; else { @@ -1375,35 +1426,35 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) //------------------------------------------------------------------ if(theedgelist->Number() > 1) { //Now this branch is never reachable - //because the case edgenumber = 2 is processed in the main loop + //because the case edgenumber = 2 is processed in the main loop theedgelist->First(); edge = theedgelist->Current(); if(edge->FirstBisector()->IndexNumber() == noofbisectors-1) { -// Modified by skv - Tue Sep 13 12:13:28 2005 IDEM Begin - if (atool.TrimBisector(edge->SecondBisector(), - edge->FirstBisector()->IssuePoint())) { - if (edge->SecondBisector()->EndPoint() == 0) - edge->SecondBisector()->EndPoint(edge->FirstBisector()->IssuePoint()); - bisectormap(noofbisectors-1)->AddBisector(edge->SecondBisector()); - } else - semiInfinite = Standard_True; -// Modified by skv - Tue Sep 13 12:13:28 2005 IDEM End + // Modified by skv - Tue Sep 13 12:13:28 2005 IDEM Begin + if (atool.TrimBisector(edge->SecondBisector(), + edge->FirstBisector()->IssuePoint())) { + if (edge->SecondBisector()->EndPoint() == 0) + edge->SecondBisector()->EndPoint(edge->FirstBisector()->IssuePoint()); + bisectormap(noofbisectors-1)->AddBisector(edge->SecondBisector()); + } else + semiInfinite = Standard_True; + // Modified by skv - Tue Sep 13 12:13:28 2005 IDEM End } else { -// Modified by skv - Tue Sep 13 12:13:28 2005 IDEM Begin - if (atool.TrimBisector(edge->FirstBisector(), - edge->SecondBisector()->IssuePoint())) { - if (edge->FirstBisector()->EndPoint() == 0) - edge->FirstBisector()->EndPoint(edge->SecondBisector()->IssuePoint()); - bisectormap(noofbisectors-1)->AddBisector(edge->FirstBisector()); - } else - semiInfinite = Standard_True; -// Modified by skv - Tue Sep 13 12:13:28 2005 IDEM End + // Modified by skv - Tue Sep 13 12:13:28 2005 IDEM Begin + if (atool.TrimBisector(edge->FirstBisector(), + edge->SecondBisector()->IssuePoint())) { + if (edge->FirstBisector()->EndPoint() == 0) + edge->FirstBisector()->EndPoint(edge->SecondBisector()->IssuePoint()); + bisectormap(noofbisectors-1)->AddBisector(edge->FirstBisector()); + } else + semiInfinite = Standard_True; + // Modified by skv - Tue Sep 13 12:13:28 2005 IDEM End } if (!semiInfinite) { - thenumberofbisectors--; - bisectormap(noofbisectors-1)->SecondEdge(edge); - bisectormap(noofbisectors-1)->BisectorNumber(-1); + thenumberofbisectors--; + bisectormap(noofbisectors-1)->SecondEdge(edge); + bisectormap(noofbisectors-1)->BisectorNumber(-1); } } } @@ -1424,7 +1475,7 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) //--------------------------- roots = new MAT_ListOfBisector; - + if (bisectormap(noofbisectors-1)->BisectorNumber() == -1) { roots = bisectormap(noofbisectors-1)->List(); roots->First(); @@ -1436,7 +1487,7 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) roots->BackAdd(bisectormap(i)); } } - + } //======================================================================== @@ -1445,12 +1496,12 @@ void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) //======================================================================== void MAT2d_Mat2d::LoadBisectorsToRemove ( Standard_Integer& noofbisectorstoremove, - const Standard_Real distance1, - const Standard_Real distance2, - const Handle(MAT_Bisector)& firstbisectortoremove1, - const Handle(MAT_Bisector)& firstbisectortoremove2, - const Handle(MAT_Bisector)& lastbisectortoremove1, - const Handle(MAT_Bisector)& lastbisectortoremove2 ) + const Standard_Real distance1, + const Standard_Real distance2, + const Handle(MAT_Bisector)& firstbisectortoremove1, + const Handle(MAT_Bisector)& firstbisectortoremove2, + const Handle(MAT_Bisector)& lastbisectortoremove1, + const Handle(MAT_Bisector)& lastbisectortoremove2 ) { Standard_Integer found,index; @@ -1461,35 +1512,35 @@ void MAT2d_Mat2d::LoadBisectorsToRemove firstbisectortoremove[1] = firstbisectortoremove2; lastbisectortoremove[0] = lastbisectortoremove1; lastbisectortoremove[1] = lastbisectortoremove2; - + if (distance1 < Precision::Infinite() && - distance2 == Precision::Infinite() ) index = 0; + distance2 == Precision::Infinite() ) index = 0; else if(distance2 < Precision::Infinite() && - distance1 == Precision::Infinite() ) index = 1; + distance1 == Precision::Infinite() ) index = 1; else index = -1; - + if(index != -1) { found = noofbisectorstoremove; for(int j=0; jBisectorNumber() == - firstbisectortoremove[index]->BisectorNumber()) { - found = j; - if(bisectortwotoremove(j)->BisectorNumber() < - lastbisectortoremove[index]->BisectorNumber())found = -1; - break; + firstbisectortoremove[index]->BisectorNumber()) { + found = j; + if(bisectortwotoremove(j)->BisectorNumber() < + lastbisectortoremove[index]->BisectorNumber())found = -1; + break; } } - + if(found != -1) { #ifdef OCCT_DEBUG_Mat cout<<" first last bisector to remove :"<< - firstbisectortoremove[index]->BisectorNumber()<<" "<< - lastbisectortoremove[index]->BisectorNumber()<BisectorNumber()<<" "<< + lastbisectortoremove[index]->BisectorNumber()<List()->IsEmpty())continue; if(bisectornumber == 0) - previousbisector = firstbisectortoremove[bisectornumber] - ->FirstBisector(); + previousbisector = firstbisectortoremove[bisectornumber] + ->FirstBisector(); else - previousbisector = firstbisectortoremove[bisectornumber] - ->LastBisector(); + previousbisector = firstbisectortoremove[bisectornumber] + ->LastBisector(); } - + distant = distance[bisectornumber]; while(!previousbisector->List()->IsEmpty()) { if(bisectornumber == 0) - previousbisector = previousbisector->FirstBisector(); + previousbisector = previousbisector->FirstBisector(); else - previousbisector = previousbisector->LastBisector(); - + previousbisector = previousbisector->LastBisector(); + if(aside == 1 || (aside == 0 && bisectornumber == 0)) { - saveparameter = previousbisector->FirstParameter(); - distant = atool.IntersectBisector - (firstbisector,previousbisector,intersectionpoint); - previousbisector->FirstParameter(saveparameter); + saveparameter = previousbisector->FirstParameter(); + distant = atool.IntersectBisector + (firstbisector,previousbisector,intersectionpoint); + previousbisector->FirstParameter(saveparameter); } else { - saveparameter = previousbisector->SecondParameter(); - distant = atool.IntersectBisector - (previousbisector,secondbisector,intersectionpoint); - previousbisector->SecondParameter(saveparameter); + saveparameter = previousbisector->SecondParameter(); + distant = atool.IntersectBisector + (previousbisector,secondbisector,intersectionpoint); + previousbisector->SecondParameter(saveparameter); } - + if(distant < Precision::Infinite()) { - distance[bisectornumber] = distant; - lastbisectortoremove[bisectornumber] = lastbisector; + distance[bisectornumber] = distant; + lastbisectortoremove[bisectornumber] = lastbisector; } - + lastbisector = previousbisector; } } @@ -1592,9 +1643,9 @@ void MAT2d_Mat2d::Intersect( MAT2d_Tool2d& atool, //--------------------------------------- LoadBisectorsToRemove(noofbisectortoremove, - distance[0],distance[1], - firstbisectortoremove[0],firstbisectortoremove[1], - lastbisectortoremove[0] ,lastbisectortoremove[1]); + distance[0],distance[1], + firstbisectortoremove[0],firstbisectortoremove[1], + lastbisectortoremove[0] ,lastbisectortoremove[1]); } //======================================================================== diff --git a/src/MAT2d/MAT2d_Tool2d.cxx b/src/MAT2d/MAT2d_Tool2d.cxx index bce491e5ec..733b6a899b 100644 --- a/src/MAT2d/MAT2d_Tool2d.cxx +++ b/src/MAT2d/MAT2d_Tool2d.cxx @@ -15,7 +15,8 @@ // commercial license or contractual agreement. #define Debug(expr) cout<<" MAT2d_Tool2d.cxx : expr :"< #include @@ -68,12 +69,14 @@ #include #ifdef DRAW - static Handle(DrawTrSurf_Curve2d) draw; +static Handle(DrawTrSurf_Curve2d) draw; +static Standard_Integer AffichBis = Standard_False; #endif #ifdef OCCT_DEBUG - static void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve, - const Standard_Integer Indice); - static Standard_Boolean Store = Standard_False; +static void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve, + const Standard_Integer Indice); +static Standard_Boolean Store = Standard_False; +static Standard_Boolean AffichDist = Standard_False; #endif //===================================================================== @@ -81,15 +84,19 @@ //===================================================================== static IntRes2d_Domain Domain (const Handle(Geom2d_TrimmedCurve)& Bisector1, - const Standard_Real Tolerance); + const Standard_Real Tolerance); static Handle(Standard_Type) Type (const Handle(Geom2d_Geometry)& acurve); static Standard_Boolean AreNeighbours(const Standard_Integer IEdge1, - const Standard_Integer IEdge2, - const Standard_Integer NbEdge); + const Standard_Integer IEdge2, + const Standard_Integer NbEdge); static void SetTrim(Bisector_Bisec& Bis , Handle(Geom2d_Curve)& Line1); +static Standard_Boolean CheckEnds (const Handle(Geom2d_Geometry)& Elt , + const gp_Pnt2d& PCom , + const Standard_Real Distance, + const Standard_Real Tol); static Standard_Real MAT2d_TOLCONF = 1.e-7; @@ -119,10 +126,10 @@ void MAT2d_Tool2d::InitItems(const Handle(MAT2d_Circuit)& EquiCircuit) theNumberOfBisectors = 0; theNumberOfVecs = 0; theNumberOfPnts = 0; - + theCircuit = EquiCircuit; } - + //============================================================================= //function : Sense //purpose : @@ -165,7 +172,7 @@ Standard_Real MAT2d_Tool2d::ToleranceOfConfusion() const //purpose : //============================================================================= Standard_Integer MAT2d_Tool2d::FirstPoint(const Standard_Integer anitem, - Standard_Real& dist ) + Standard_Real& dist ) { Handle(Geom2d_Curve) curve; Handle(Geom2d_Point) point; @@ -175,7 +182,7 @@ Standard_Integer MAT2d_Tool2d::FirstPoint(const Standard_Integer anitem, gp_Pnt2d P1 = theCircuit->Connexion(anitem)->PointOnFirst(); gp_Pnt2d P2 = theCircuit->Connexion(anitem)->PointOnSecond(); theGeomPnts.Bind(theNumberOfPnts,gp_Pnt2d((P1.X() + P2.X())*0.5, - (P1.Y() + P2.Y())*0.5)); + (P1.Y() + P2.Y())*0.5)); dist = P1.Distance(P2)*0.5; return theNumberOfPnts; } @@ -207,7 +214,7 @@ Standard_Integer MAT2d_Tool2d::TangentBefore(const Standard_Integer anitem, theNumberOfVecs++; if (!IsOpenResult) - item = (anitem == theCircuit->NumberOfItems()) ? 1 : (anitem + 1); + item = (anitem == theCircuit->NumberOfItems()) ? 1 : (anitem + 1); else item = (anitem == theCircuit->NumberOfItems()) ? (anitem - 1) : (anitem + 1); if (theCircuit->ConnexionOn(item)){ @@ -262,7 +269,7 @@ Standard_Integer MAT2d_Tool2d::TangentAfter(const Standard_Integer anitem, } else { if (!IsOpenResult) - item = (anitem == 1) ? theCircuit->NumberOfItems() : (anitem - 1); + item = (anitem == 1) ? theCircuit->NumberOfItems() : (anitem - 1); else item = (anitem == 1) ? 2 : (anitem - 1); curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(item)); @@ -282,8 +289,8 @@ Standard_Integer MAT2d_Tool2d::Tangent(const Standard_Integer bisector) { theNumberOfVecs++; theGeomVecs.Bind(theNumberOfVecs,GeomBis(bisector).Value() - ->DN(GeomBis(bisector).Value() - ->LastParameter(),1)); + ->DN(GeomBis(bisector).Value() + ->LastParameter(),1)); return theNumberOfVecs; } @@ -301,8 +308,8 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector) Standard_Integer edge1number = abisector->FirstEdge()->EdgeNumber(); Standard_Integer edge2number = abisector->SecondEdge()->EdgeNumber(); Standard_Boolean ontheline = AreNeighbours(edge1number, - edge2number, - NumberOfItems()); + edge2number, + NumberOfItems()); Standard_Boolean InitialNeighbour = ontheline; if(theCircuit->ConnexionOn(edge2number)) ontheline = Standard_False; @@ -333,49 +340,49 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector) cout<<" Item 1 : "<Dump(1,1); + // elt1->Dump(1,1); cout<Dump(1,1); + // elt2->Dump(1,1); cout<IssuePoint()), - GeomVec (abisector->FirstVector()), - GeomVec (abisector->SecondVector()), - theDirection,tolerance,ontheline); + type2 != STANDARD_TYPE(Geom2d_CartesianPoint)) { + bisector.Perform(item1,item2, + GeomPnt (abisector->IssuePoint()), + GeomVec (abisector->FirstVector()), + GeomVec (abisector->SecondVector()), + theDirection,tolerance,ontheline); } else if(type1 == STANDARD_TYPE(Geom2d_CartesianPoint) && - type2 == STANDARD_TYPE(Geom2d_CartesianPoint)) { - point1 = Handle(Geom2d_Point)::DownCast(elt1); - point2 = Handle(Geom2d_Point)::DownCast(elt2); - bisector.Perform(point1,point2, - GeomPnt (abisector->IssuePoint()), - GeomVec (abisector->FirstVector()), - GeomVec (abisector->SecondVector()), - theDirection,tolerance,ontheline); + type2 == STANDARD_TYPE(Geom2d_CartesianPoint)) { + point1 = Handle(Geom2d_Point)::DownCast(elt1); + point2 = Handle(Geom2d_Point)::DownCast(elt2); + bisector.Perform(point1,point2, + GeomPnt (abisector->IssuePoint()), + GeomVec (abisector->FirstVector()), + GeomVec (abisector->SecondVector()), + theDirection,tolerance,ontheline); } else if(type1 == STANDARD_TYPE(Geom2d_CartesianPoint)) { point1 = Handle(Geom2d_Point)::DownCast(elt1); bisector.Perform(point1,item2, - GeomPnt (abisector->IssuePoint()), - GeomVec (abisector->FirstVector()), - GeomVec (abisector->SecondVector()), - theDirection,tolerance,ontheline); + GeomPnt (abisector->IssuePoint()), + GeomVec (abisector->FirstVector()), + GeomVec (abisector->SecondVector()), + theDirection,tolerance,ontheline); } else { point2 = Handle(Geom2d_Point)::DownCast(elt2); bisector.Perform(item1,point2, - GeomPnt (abisector->IssuePoint()), - GeomVec (abisector->FirstVector()), - GeomVec (abisector->SecondVector()), - theDirection,tolerance,ontheline); + GeomPnt (abisector->IssuePoint()), + GeomVec (abisector->FirstVector()), + GeomVec (abisector->SecondVector()), + theDirection,tolerance,ontheline); } //------------------------------ @@ -398,7 +405,7 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector) Handle(Geom2d_Curve) BasisCurve; if (Type1 == STANDARD_TYPE(Bisector_BisecAna)) { BasisCurve = Handle(Bisector_BisecAna) - ::DownCast(bisector.Value()->BasisCurve())->Geom2dCurve(); + ::DownCast(bisector.Value()->BasisCurve())->Geom2dCurve(); #ifdef DRAW char *name = new char[100]; sprintf(name,"BISSEC_%d",abisector->BisectorNumber()); @@ -418,47 +425,47 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector) // Cette restriction est necessaire a la logique de l algorithme. //============================================================================= void MAT2d_Tool2d::TrimBisec ( Bisector_Bisec& B1, - const Standard_Integer IndexEdge, - const Standard_Boolean InitialNeighbour, - const Standard_Integer StartOrEnd ) const + const Standard_Integer IndexEdge, + const Standard_Boolean InitialNeighbour, + const Standard_Integer StartOrEnd ) const { Handle(Geom2d_Curve) Curve; Handle(Geom2d_TrimmedCurve) LineSupportDomain,Line; Handle(Geom2d_Line) Line1,Line2; - + //gp_Vec2d Tan1,Tan2; gp_Pnt2d Ori; //PEdge; Standard_Integer INext; INext = (IndexEdge == theCircuit->NumberOfItems()) ? 1 : (IndexEdge + 1); - + Handle(Standard_Type) EdgeType = theCircuit->Value(IndexEdge)->DynamicType(); - + if (EdgeType != STANDARD_TYPE(Geom2d_CartesianPoint)) { if(!InitialNeighbour) { Curve = Handle(Geom2d_TrimmedCurve) - ::DownCast(theCircuit->Value(IndexEdge))->BasisCurve(); + ::DownCast(theCircuit->Value(IndexEdge))->BasisCurve(); EdgeType = Curve->DynamicType(); //------------------------------------------------------------------- // si l edge est liee a sa voisine precedente par une connexion. //------------------------------------------------------------------- if (theCircuit->ConnexionOn(IndexEdge) && StartOrEnd == 1){ - if (EdgeType == STANDARD_TYPE(Geom2d_Circle)) { - Ori = Handle(Geom2d_Circle)::DownCast(Curve)->Location(); - gp_Pnt2d P2 = theCircuit->Connexion(IndexEdge)->PointOnFirst(); - Line1 = new Geom2d_Line (Ori,gp_Dir2d(P2.X() - Ori.X(), - P2.Y() - Ori.Y())); - } + if (EdgeType == STANDARD_TYPE(Geom2d_Circle)) { + Ori = Handle(Geom2d_Circle)::DownCast(Curve)->Location(); + gp_Pnt2d P2 = theCircuit->Connexion(IndexEdge)->PointOnFirst(); + Line1 = new Geom2d_Line (Ori,gp_Dir2d(P2.X() - Ori.X(), + P2.Y() - Ori.Y())); + } } //----------------------------------------------------------------------- // Si l edge est liee a sa voisine suivante par une connexion. //----------------------------------------------------------------------- if (theCircuit->ConnexionOn(INext) && StartOrEnd == 2){ - if (EdgeType == STANDARD_TYPE(Geom2d_Circle)) { - Ori = Handle(Geom2d_Circle)::DownCast(Curve)->Location(); - gp_Pnt2d P2 = theCircuit->Connexion(INext)->PointOnSecond(); - Line2 = new Geom2d_Line (Ori,gp_Dir2d(P2.X() - Ori.X(), - P2.Y() - Ori.Y())); - } + if (EdgeType == STANDARD_TYPE(Geom2d_Circle)) { + Ori = Handle(Geom2d_Circle)::DownCast(Curve)->Location(); + gp_Pnt2d P2 = theCircuit->Connexion(INext)->PointOnSecond(); + Line2 = new Geom2d_Line (Ori,gp_Dir2d(P2.X() - Ori.X(), + P2.Y() - Ori.Y())); + } } if (Line1.IsNull() && Line2.IsNull()) return; @@ -467,12 +474,12 @@ void MAT2d_Tool2d::TrimBisec ( Bisector_Bisec& B1, // si elles existent. //----------------------------------------------------------------------- if (!Line1.IsNull()) { - Line = new Geom2d_TrimmedCurve(Line1,0.,Precision::Infinite()); - SetTrim(B1,Line); + Line = new Geom2d_TrimmedCurve(Line1,0.,Precision::Infinite()); + SetTrim(B1,Line); } if (!Line2.IsNull()) { - Line = new Geom2d_TrimmedCurve(Line2,0.,Precision::Infinite()); - SetTrim(B1,Line); + Line = new Geom2d_TrimmedCurve(Line2,0.,Precision::Infinite()); + SetTrim(B1,Line); } } } @@ -494,13 +501,13 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector Handle(Geom2d_TrimmedCurve) bisector = Handle(Geom2d_TrimmedCurve) - ::DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue()); - + ::DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue()); + if(bisector->BasisCurve()->IsPeriodic() && param == Precision::Infinite()) { param = bisector->FirstParameter() + 2*M_PI; } if (param > bisector->BasisCurve()->LastParameter()) { - param = bisector->BasisCurve()->LastParameter(); + param = bisector->BasisCurve()->LastParameter(); } if(bisector->FirstParameter() == param) return Standard_False; @@ -514,17 +521,17 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector //============================================================================= Standard_Boolean MAT2d_Tool2d::TrimBisector (const Handle(MAT_Bisector)& abisector, - const Standard_Integer apoint) + const Standard_Integer apoint) { Standard_Real Param; Handle(Geom2d_TrimmedCurve) Bisector = Handle(Geom2d_TrimmedCurve):: - DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue()); + DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue()); Handle(Bisector_Curve) Bis = Handle(Bisector_Curve):: DownCast(Bisector->BasisCurve()); -// Param = ParameterOnCurve(Bisector,theGeomPnts.Value(apoint)); + // Param = ParameterOnCurve(Bisector,theGeomPnts.Value(apoint)); Param = Bis->Parameter(GeomPnt (apoint)); if (Bisector->BasisCurve()->IsPeriodic()) { @@ -547,9 +554,9 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector //purpose : //============================================================================= Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge , - const gp_Pnt2d& PCom , - Standard_Real& Distance) - const + const gp_Pnt2d& PCom , + Standard_Real& Distance) + const { gp_Pnt2d PEdge; Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge); @@ -579,7 +586,7 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge , if (theCircuit->ConnexionOn(INext)) { ParamMax = theCircuit->Connexion(INext)->ParameterOnFirst(); if (Curve->BasisCurve()->IsPeriodic()){ - ElCLib::AdjustPeriodic(0.,2*M_PI,Eps,ParamMin,ParamMax); + ElCLib::AdjustPeriodic(0.,2*M_PI,Eps,ParamMin,ParamMax); } } //--------------------------------------------------------------------- @@ -589,10 +596,10 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge , GeomAbs_CurveType TypeC1 = C1.GetType(); if (TypeC1 == GeomAbs_Circle) { Standard_Real R = C1.Circle().Radius(); - Standard_Real EpsCirc = Eps; + Standard_Real EpsCirc = 100.*Eps; if ( R < 1.) EpsCirc = Eps/R; - if (!((ParamMax - ParamMin + 2*EpsCirc) < 2*M_PI)) { - ParamMax = ParamMax + EpsCirc; ParamMin = ParamMin - EpsCirc; + if (((ParamMax - ParamMin + 2*EpsCirc) < 2*M_PI)) { + ParamMax = ParamMax + EpsCirc; ParamMin = ParamMin - EpsCirc; } } else { @@ -603,16 +610,21 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge , //----------------------------------------------------- Extrema_ExtPC2d Extremas(PCom,C1,ParamMin,ParamMax); if (Extremas.IsDone()){ - if (Extremas.NbExt() == 0 ) return Standard_False; // Pas de solution! - for (Standard_Integer i = 1; i <= Extremas.NbExt(); i++) { - if (Extremas.SquareDistance(i) < Distance * Distance) { - Distance = sqrt (Extremas.SquareDistance(i)); - } + Distance = Precision::Infinite(); + if(Extremas.NbExt() < 1) + { + return Standard_False; } + for (Standard_Integer i = 1; i <= Extremas.NbExt(); i++) { + if (Extremas.SquareDistance(i) < Distance) { + Distance = Extremas.SquareDistance(i); + } + } + Distance = Sqrt(Distance); } else { if (TypeC1 == GeomAbs_Circle) { - Distance = C1.Circle().Radius(); + Distance = C1.Circle().Radius(); } } } @@ -624,12 +636,13 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge , // purpose : //============================================================================= Standard_Boolean MAT2d_Tool2d::IsSameDistance ( - const Handle(MAT_Bisector)& BisectorOne, - const Handle(MAT_Bisector)& BisectorTwo, - const gp_Pnt2d& PCom, - Standard_Real& Distance) const + const Handle(MAT_Bisector)& BisectorOne, + const Handle(MAT_Bisector)& BisectorTwo, + const gp_Pnt2d& PCom, + Standard_Real& Distance) const { TColStd_Array1OfReal Dist(1,4); + const Standard_Real eps = 1.e-7; Standard_Integer IEdge1,IEdge2,IEdge3,IEdge4; IEdge1 = BisectorOne->FirstEdge() ->EdgeNumber(); @@ -637,37 +650,87 @@ Standard_Boolean MAT2d_Tool2d::IsSameDistance ( IEdge3 = BisectorTwo->FirstEdge() ->EdgeNumber(); IEdge4 = BisectorTwo->SecondEdge()->EdgeNumber(); - Projection(IEdge1,PCom,Dist(1)); - Projection(IEdge2,PCom,Dist(2)); + Standard_Boolean isDone1 = Projection(IEdge1,PCom,Dist(1)); + Standard_Boolean isDone2 = Projection(IEdge2,PCom,Dist(2)); + if(isDone1) + { + if(!isDone2) + { + Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge2); + Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(1)); + if(CheckEnds (Elt, PCom, Dist(1), Tol)) + { + Dist(2) = Dist(1); + } + } + } + else + { + if(isDone2) + { + Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge1); + Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(2)); + if(CheckEnds (Elt, PCom, Dist(2), Tol)) + { + Dist(1) = Dist(2); + } + } + } + + Standard_Boolean isDone3 = Standard_True, isDone4 = Standard_True; if (IEdge3 == IEdge1) Dist(3) = Dist(1); else if (IEdge3 == IEdge2) Dist(3) = Dist(2); - else Projection(IEdge3,PCom,Dist(3)); + else isDone3 = Projection(IEdge3,PCom,Dist(3)); if (IEdge4 == IEdge1) Dist(4) = Dist(1); else if (IEdge4 == IEdge2) Dist(4) = Dist(2); - else Projection(IEdge4,PCom,Dist(4)); + else isDone4 = Projection(IEdge4,PCom,Dist(4)); + // + if(isDone3) + { + if(!isDone4) + { + Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge4); + Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(3)); + if(CheckEnds (Elt, PCom, Dist(3), Tol)) + { + Dist(4) = Dist(3); + } + } + } + else + { + if(isDone4) + { + Handle(Geom2d_Geometry) Elt = theCircuit->Value(IEdge3); + Standard_Real Tol = Max(Precision::Confusion(), eps*Dist(4)); + if(CheckEnds (Elt, PCom, Dist(4), Tol)) + { + Dist(3) = Dist(4); + } + } + } #ifdef OCCT_DEBUG - Standard_Boolean Affich = Standard_False; - if (Affich) + if (AffichDist) for (Standard_Integer j = 1; j <= 4;j++){ cout <<"Distance number : "< EpsDist) { - Distance = Precision::Infinite(); - return Standard_False; + if (Abs(Dist(i) - Distance) > EpsDist) { + Distance = Precision::Infinite(); + return Standard_False; + } } - } - return Standard_True; + return Standard_True; } //============================================================================= @@ -675,9 +738,9 @@ Standard_Boolean MAT2d_Tool2d::IsSameDistance ( //purpose : //============================================================================= Standard_Real MAT2d_Tool2d::IntersectBisector ( - const Handle(MAT_Bisector)& BisectorOne, - const Handle(MAT_Bisector)& BisectorTwo, - Standard_Integer& IntPnt) + const Handle(MAT_Bisector)& BisectorOne, + const Handle(MAT_Bisector)& BisectorTwo, + Standard_Integer& IntPnt) { Standard_Real Tolerance = MAT2d_TOLCONF; Standard_Real Param1,Param2; @@ -688,11 +751,11 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( Handle(Geom2d_TrimmedCurve) Bisector1 = Handle(Geom2d_TrimmedCurve) - ::DownCast(ChangeGeomBis(BisectorOne->BisectorNumber()).ChangeValue()); + ::DownCast(ChangeGeomBis(BisectorOne->BisectorNumber()).ChangeValue()); Handle(Geom2d_TrimmedCurve) Bisector2 = Handle(Geom2d_TrimmedCurve) - ::DownCast(ChangeGeomBis(BisectorTwo->BisectorNumber()).ChangeValue()); + ::DownCast(ChangeGeomBis(BisectorTwo->BisectorNumber()).ChangeValue()); if(Bisector1.IsNull() || Bisector2.IsNull()) return Precision::Infinite(); @@ -706,17 +769,17 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( Standard_Integer IS2 = BisectorTwo->SecondEdge()->EdgeNumber(); Standard_Integer IF1 = BisectorOne->FirstEdge() ->EdgeNumber(); Standard_Integer IF2 = BisectorTwo->FirstEdge() ->EdgeNumber(); - + if (AreNeighbours(IF1,IS1,NumberOfItems()) && - AreNeighbours(IF2,IS2,NumberOfItems()) && - theCircuit->ConnexionOn(IS2) && - theCircuit->ConnexionOn(IS1) ) { - Handle(MAT2d_Connexion) C1,C2; - C1 = theCircuit->Connexion(IS1); - C2 = theCircuit->Connexion(IS2); - if (C2->IndexFirstLine() == C1->IndexSecondLine() && - C1->IndexFirstLine() == C2->IndexSecondLine() ) - return Precision::Infinite(); + AreNeighbours(IF2,IS2,NumberOfItems()) && + theCircuit->ConnexionOn(IS2) && + theCircuit->ConnexionOn(IS1) ) { + Handle(MAT2d_Connexion) C1,C2; + C1 = theCircuit->Connexion(IS1); + C2 = theCircuit->Connexion(IS2); + if (C2->IndexFirstLine() == C1->IndexSecondLine() && + C1->IndexFirstLine() == C2->IndexSecondLine() ) + return Precision::Infinite(); } // ----------------------------------------- @@ -726,24 +789,24 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( IntRes2d_Domain Domain2 = Domain(Bisector2,Tolerance); if (Domain1.LastParameter() - Domain1.FirstParameter() < Tolerance) - return Precision::Infinite(); + return Precision::Infinite(); if (Domain2.LastParameter() - Domain2.FirstParameter() < Tolerance) - return Precision::Infinite(); + return Precision::Infinite(); #ifdef OCCT_DEBUG Standard_Boolean Affich = Standard_False; if (Affich) { cout<BisectorNumber()<< - " et de "<BisectorNumber()<BisectorNumber()<BasisCurve())->Dump(-1,1); + // (Bisector1->BasisCurve())->Dump(-1,1); cout<BasisCurve())->Dump(-1,1); + // (Bisector2->BasisCurve())->Dump(-1,1); cout<BisectorNumber()),Domain1, - GeomBis(BisectorTwo->BisectorNumber()),Domain2, - Tolerance,Tolerance,Standard_True); + GeomBis(BisectorTwo->BisectorNumber()),Domain2, + Tolerance,Tolerance,Standard_True); -// Geom2dInt_GInter Intersect; -// Intersect.Perform(Bisector1,Domain1,Bisector2,Domain2,Tolerance,Tolerance); + // Geom2dInt_GInter Intersect; + // Intersect.Perform(Bisector1,Domain1,Bisector2,Domain2,Tolerance,Tolerance); -// ------------------------------------------------------------------------- -// Exploitation du resultat de l intersection et selection du point solution -// equidistant des deux edges et le plus proche en parametre de l origine -// des bissectrices. -// ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // Exploitation du resultat de l intersection et selection du point solution + // equidistant des deux edges et le plus proche en parametre de l origine + // des bissectrices. + // ------------------------------------------------------------------------- if(!Intersect.IsDone()) return Precision::Infinite(); @@ -789,30 +852,30 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( // equidistants des edges. // ---------------------------------------------------------------- if ((Segment.HasFirstPoint() && Segment.HasLastPoint())) { - gp_Pnt2d P1,P2; - Standard_Real SegmentLength; - P1 = Segment.FirstPoint().Value(); - P2 = Segment.LastPoint().Value(); - SegmentLength = P1.Distance(P2); - if (SegmentLength <= Tolerance) { - PointOnSegment = P1; - if(IsSameDistance(BisectorOne,BisectorTwo, - PointOnSegment,Distance)) - PointRetenu = Standard_True; - } - else if (SegmentLength <= MaxSegmentLength) { - gp_Dir2d Dir(P2.X()-P1.X(),P2.Y()-P1.Y()); - Standard_Real Dist = 0.; - while (Dist <= SegmentLength + Tolerance){ - PointOnSegment = P1.Translated(Dist*Dir); - if(IsSameDistance(BisectorOne,BisectorTwo, - PointOnSegment,Distance)) { - PointRetenu = Standard_True; - break; - } - Dist = Dist + Tolerance; - } - } + gp_Pnt2d P1,P2; + Standard_Real SegmentLength; + P1 = Segment.FirstPoint().Value(); + P2 = Segment.LastPoint().Value(); + SegmentLength = P1.Distance(P2); + if (SegmentLength <= Tolerance) { + PointOnSegment = P1; + if(IsSameDistance(BisectorOne,BisectorTwo, + PointOnSegment,Distance)) + PointRetenu = Standard_True; + } + else if (SegmentLength <= MaxSegmentLength) { + gp_Dir2d Dir(P2.X()-P1.X(),P2.Y()-P1.Y()); + Standard_Real Dist = 0.; + while (Dist <= SegmentLength + Tolerance){ + PointOnSegment = P1.Translated(Dist*Dir); + if(IsSameDistance(BisectorOne,BisectorTwo, + PointOnSegment,Distance)) { + PointRetenu = Standard_True; + break; + } + Dist = Dist + Tolerance; + } + } } // ---------------------------------------------------------------- @@ -820,17 +883,17 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( // parametre sur les bissectrices. // ---------------------------------------------------------------- if(PointRetenu) { - Parama = Handle(Bisector_Curve)::DownCast(Bisector1->BasisCurve()) - ->Parameter(PointOnSegment); - Paramb = Handle(Bisector_Curve)::DownCast(Bisector2->BasisCurve()) - ->Parameter(PointOnSegment); - if(Parama < Param1 && Paramb < Param2) { - Param1 = Parama; - Param2 = Paramb; - DistanceMini = Distance; - PointSolution = PointOnSegment; - SolutionValide = Standard_True; - } + Parama = Handle(Bisector_Curve)::DownCast(Bisector1->BasisCurve()) + ->Parameter(PointOnSegment); + Paramb = Handle(Bisector_Curve)::DownCast(Bisector2->BasisCurve()) + ->Parameter(PointOnSegment); + if(Parama < Param1 && Paramb < Param2) { + Param1 = Parama; + Param2 = Paramb; + DistanceMini = Distance; + PointSolution = PointOnSegment; + SolutionValide = Standard_True; + } } } } @@ -838,17 +901,17 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( if(Intersect.NbPoints() != 1) { for(Standard_Integer i=1; i<=Intersect.NbPoints(); i++) { if(IsSameDistance(BisectorOne,BisectorTwo, - Intersect.Point(i).Value(),Distance) && - Distance > Tolerance ) { - Parama = Intersect.Point(i).ParamOnFirst(); - Paramb = Intersect.Point(i).ParamOnSecond(); - if (Parama < Param1 && Paramb < Param2) { - Param1 = Parama; - Param2 = Paramb; - DistanceMini = Distance; - PointSolution = Intersect.Point(i).Value(); - SolutionValide = Standard_True; - } + Intersect.Point(i).Value(),Distance) && + Distance > Tolerance ) { + Parama = Intersect.Point(i).ParamOnFirst(); + Paramb = Intersect.Point(i).ParamOnSecond(); + if (Parama < Param1 && Paramb < Param2) { + Param1 = Parama; + Param2 = Paramb; + DistanceMini = Distance; + PointSolution = Intersect.Point(i).Value(); + SolutionValide = Standard_True; + } } } } @@ -857,7 +920,7 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( Param1 = Intersect.Point(1).ParamOnFirst(); Param2 = Intersect.Point(1).ParamOnSecond(); SolutionValide = IsSameDistance(BisectorOne,BisectorTwo, - PointSolution,DistanceMini); + PointSolution,DistanceMini); } if (!SolutionValide) return Precision::Infinite(); @@ -887,57 +950,87 @@ Standard_Real MAT2d_Tool2d::IntersectBisector ( IndexEdge2 = BisectorOne->SecondEdge()->EdgeNumber(); IndexEdge3 = BisectorTwo->FirstEdge() ->EdgeNumber(); IndexEdge4 = BisectorTwo->SecondEdge()->EdgeNumber(); - + if (theCircuit->ConnexionOn(IndexEdge2)){ // -------------------------------------- // BisectorOne est issue d une connexion. // -------------------------------------- - if (AreNeighbours(IndexEdge1,IndexEdge2,NumberOfItems()) && - AreNeighbours(IndexEdge3,IndexEdge4,NumberOfItems()) && - IndexEdge2 == IndexEdge3 ){ - ExtremiteControle = Standard_False; - Param1 = Param1 + Tolerance; - } - } - - if (theCircuit->ConnexionOn(IndexEdge4)){ - // -------------------------------------- - // BisectorTwo est issue d une connexion. - // -------------------------------------- if (AreNeighbours(IndexEdge1,IndexEdge2,NumberOfItems()) && - AreNeighbours(IndexEdge3,IndexEdge4,NumberOfItems()) && - IndexEdge2 == IndexEdge3 ){ - ExtremiteControle = Standard_False; - Param2 = Param2 + Tolerance; + AreNeighbours(IndexEdge3,IndexEdge4,NumberOfItems()) && + IndexEdge2 == IndexEdge3 ){ + ExtremiteControle = Standard_False; + Param1 = Param1 + Tolerance; } } - - if (ExtremiteControle) { - if(Bisector1->StartPoint().Distance(PointSolution) < Tolerance || - Bisector2->StartPoint().Distance(PointSolution) < Tolerance ) - return Precision::Infinite(); - } + + if (theCircuit->ConnexionOn(IndexEdge4)){ + //-------------------------------------- + //BisectorTwo est issue d une connexion. + //-------------------------------------- + if (AreNeighbours(IndexEdge1,IndexEdge2,NumberOfItems()) && + AreNeighbours(IndexEdge3,IndexEdge4,NumberOfItems()) && + IndexEdge2 == IndexEdge3 ){ + ExtremiteControle = Standard_False; + Param2 = Param2 + Tolerance; + } + } + + //if (ExtremiteControle) { + // if(Bisector1->StartPoint().Distance(PointSolution) < Tolerance || + // Bisector2->StartPoint().Distance(PointSolution) < Tolerance ) + // return Precision::Infinite(); + //} + + if(ExtremiteControle) + { + if(Bisector1->StartPoint().Distance(PointSolution) < Tolerance) + { +#ifdef DRAW + if(AffichBis) + { + DrawTrSurf::Set("Bis1", Bisector1); + DrawTrSurf::Set("Bis2", Bisector2); + } +#endif + return Precision::Infinite(); + } + if(Bisector2->StartPoint().Distance(PointSolution) < Tolerance) + { + +#ifdef DRAW + if(AffichBis) + { + DrawTrSurf::Set("Bis1", Bisector1); + DrawTrSurf::Set("Bis2", Bisector2); + } +#endif + return Precision::Infinite(); + } + } + + if(BisectorOne->SecondParameter() < Precision::Infinite() && - BisectorOne->SecondParameter() < Param1*(1. - Tolerance )) + BisectorOne->SecondParameter() < Param1*(1. - Tolerance )) return Precision::Infinite(); - + if(BisectorTwo->FirstParameter() < Precision::Infinite() && - BisectorTwo->FirstParameter() < Param2*(1.- Tolerance)) + BisectorTwo->FirstParameter() < Param2*(1.- Tolerance)) return Precision::Infinite(); BisectorOne->SecondParameter(Param1); BisectorTwo->FirstParameter (Param2); + #ifdef OCCT_DEBUG if (Affich) { cout<<" coordonnees : "< theNumberOfBisectors) return; @@ -988,7 +1081,7 @@ void MAT2d_Tool2d::Dump(const Standard_Integer bisector, //purpose : //============================================================================= const Bisector_Bisec& MAT2d_Tool2d::GeomBis (const Standard_Integer Index) - const + const { return theGeomBisectors.Find(Index); } @@ -1008,7 +1101,7 @@ Bisector_Bisec& MAT2d_Tool2d::ChangeGeomBis(const Standard_Integer Index) //purpose : //============================================================================= Handle(Geom2d_Geometry) MAT2d_Tool2d::GeomElt(const Standard_Integer Index) - const + const { return theCircuit->Value(Index); } @@ -1046,7 +1139,7 @@ Handle(MAT2d_Circuit) MAT2d_Tool2d::Circuit()const //purpose : //============================================================================= void MAT2d_Tool2d::BisecFusion(const Standard_Integer I1, - const Standard_Integer I2) + const Standard_Integer I2) { Standard_Real DU,UL1,UF1; Handle(Geom2d_TrimmedCurve) Bisector1; @@ -1075,7 +1168,7 @@ void MAT2d_Tool2d::BisecFusion(const Standard_Integer I1, Handle(Bisector_BisecCC) BCC1 = Handle(Bisector_BisecCC)::DownCast(Bisector1->BasisCurve()); Bis.Perform(BCC1->Curve(2), BCC1->Curve(1), P2, VBid, VBid, - theDirection, Tolerance, Standard_False); + theDirection, Tolerance, Standard_False); Bisector1 = Handle(Geom2d_TrimmedCurve)::DownCast(Bis.Value()); BCC1 = Handle(Bisector_BisecCC) ::DownCast(Bisector1->BasisCurve()); @@ -1089,11 +1182,11 @@ void MAT2d_Tool2d::BisecFusion(const Standard_Integer I1, UF1 = UF1 - DU; Handle(Bisector_BisecAna) BAna = Handle(Bisector_BisecAna)::DownCast(Bisector1->BasisCurve()); -//---------------------------- uncomment if new method Bisector_BisecAna::SetTrim(f,l) is not used -// Handle(Geom2d_Curve) C2d = BAna->Geom2dCurve(); -// Handle(Geom2d_TrimmedCurve) trimC2d = new Geom2d_TrimmedCurve(C2d, UF1, UL1); -// BAna->Init(trimC2d); -//--------------------------- end + //---------------------------- uncomment if new method Bisector_BisecAna::SetTrim(f,l) is not used + // Handle(Geom2d_Curve) C2d = BAna->Geom2dCurve(); + // Handle(Geom2d_TrimmedCurve) trimC2d = new Geom2d_TrimmedCurve(C2d, UF1, UL1); + // BAna->Init(trimC2d); + //--------------------------- end BAna->SetTrim(UF1,UL1); // put comment if SetTrim(f,l) is not used Bisector1->SetTrim(UF1,UL1); @@ -1122,8 +1215,8 @@ static Handle(Standard_Type) Type(const Handle(Geom2d_Geometry)& aGeom) // consecutifs sur un contour ferme de NbEdge elements. //========================================================================== Standard_Boolean AreNeighbours(const Standard_Integer IEdge1, - const Standard_Integer IEdge2, - const Standard_Integer NbEdge) + const Standard_Integer IEdge2, + const Standard_Integer NbEdge) { if (Abs(IEdge1 - IEdge2) == 1) return Standard_True; else if (Abs(IEdge1 - IEdge2) == NbEdge -1) return Standard_True; @@ -1145,22 +1238,22 @@ void SetTrim(Bisector_Bisec& Bis, Handle(Geom2d_Curve)& Line1) IntRes2d_Domain Domain1 = Domain(Bisector,Tolerance); Standard_Real UB1 = Bisector->FirstParameter(); Standard_Real UB2 = Bisector->LastParameter(); - + gp_Pnt2d FirstPointBisector = Bisector->Value(UB1); Standard_Real UTrim = Precision::Infinite(); Geom2dAdaptor_Curve AdapBisector(Bisector); Geom2dAdaptor_Curve AdapLine1 (Line1); Intersect.Perform(AdapBisector, Domain1, - AdapLine1, Tolerance, Tolerance); + AdapLine1, Tolerance, Tolerance); if (Intersect.IsDone() && !Intersect.IsEmpty()) { for (Standard_Integer i = 1; i <= Intersect.NbPoints(); i++) { gp_Pnt2d PInt = Intersect.Point(i).Value(); Distance = FirstPointBisector.Distance(PInt); if (Distance > 10.*Tolerance && - Intersect.Point(i).ParamOnFirst() < UTrim ) { - UTrim = Intersect.Point(i).ParamOnFirst(); + Intersect.Point(i).ParamOnFirst() < UTrim ) { + UTrim = Intersect.Point(i).ParamOnFirst(); } } } @@ -1176,7 +1269,7 @@ void SetTrim(Bisector_Bisec& Bis, Handle(Geom2d_Curve)& Line1) //purpose : //========================================================================== IntRes2d_Domain Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1, - const Standard_Real Tolerance) + const Standard_Real Tolerance) { Standard_Real Param1 = Bisector1->FirstParameter(); Standard_Real Param2 = Bisector1->LastParameter(); @@ -1186,7 +1279,7 @@ IntRes2d_Domain Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1, Handle(Geom2d_Curve) BasisCurve; if (Type1 == STANDARD_TYPE(Bisector_BisecAna)) { BasisCurve = Handle(Bisector_BisecAna) - ::DownCast(Bisector1->BasisCurve())->Geom2dCurve(); + ::DownCast(Bisector1->BasisCurve())->Geom2dCurve(); Type1 = BasisCurve->DynamicType(); } gp_Parab2d gpParabola; @@ -1211,15 +1304,46 @@ IntRes2d_Domain Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1, Param2 = (Val1 <= Val2 ? Val1:Val2); } } - + IntRes2d_Domain Domain1(Bisector1->Value(Param1),Param1,Tolerance, - Bisector1->Value(Param2),Param2,Tolerance); + Bisector1->Value(Param2),Param2,Tolerance); if(Bisector1->BasisCurve()->IsPeriodic()) { Domain1.SetEquivalentParameters(0.,2.*M_PI); } return Domain1; } +//============================================================================= +//function : CheckEnds +//purpose : +//============================================================================= +Standard_Boolean CheckEnds (const Handle(Geom2d_Geometry)& Elt , + const gp_Pnt2d& PCom , + const Standard_Real Distance, + const Standard_Real Tol) + +{ + Handle(Standard_Type) Type = Elt->DynamicType(); + Handle(Geom2d_TrimmedCurve) Curve; + + if (Type == STANDARD_TYPE(Geom2d_CartesianPoint)) { + return Standard_False; + } + else { + Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Elt); + gp_Pnt2d aPf = Curve->StartPoint(); + gp_Pnt2d aPl = Curve->EndPoint(); + Standard_Real df = PCom.Distance(aPf); + Standard_Real dl = PCom.Distance(aPl); + if(Abs(df - Distance) <= Tol) + return Standard_True; + if(Abs(dl - Distance) <= Tol) + return Standard_True; + } + return Standard_False; +} + + #ifdef OCCT_DEBUG //========================================================================== //function : MAT2d_DrawCurve @@ -1231,7 +1355,7 @@ IntRes2d_Domain Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1, // Indice = 4 vert. //========================================================================== void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve, - const Standard_Integer /*Indice*/) + const Standard_Integer /*Indice*/) { Handle(Standard_Type) type = aCurve->DynamicType(); Handle(Geom2d_Curve) curve,CurveDraw; @@ -1252,27 +1376,27 @@ void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve, // PB de representation des courbes semi_infinies. if (aCurve->LastParameter() == Precision::Infinite()) { - + if (type == STANDARD_TYPE(Geom2d_Parabola)) { - gpParabola = Handle(Geom2d_Parabola)::DownCast(curve)->Parab2d(); - Focus = gpParabola.Focal(); - Standard_Real Val1 = Sqrt(Limit*Focus); - Standard_Real Val2 = Sqrt(Limit*Limit); - delta= (Val1 <= Val2 ? Val1:Val2); + gpParabola = Handle(Geom2d_Parabola)::DownCast(curve)->Parab2d(); + Focus = gpParabola.Focal(); + Standard_Real Val1 = Sqrt(Limit*Focus); + Standard_Real Val2 = Sqrt(Limit*Limit); + delta= (Val1 <= Val2 ? Val1:Val2); } else if (type == STANDARD_TYPE(Geom2d_Hyperbola)) { - gpHyperbola = Handle(Geom2d_Hyperbola)::DownCast(curve)->Hypr2d(); - Standard_Real Majr = gpHyperbola.MajorRadius(); - Standard_Real Minr = gpHyperbola.MinorRadius(); - Standard_Real Valu1 = Limit/Majr; - Standard_Real Valu2 = Limit/Minr; - Standard_Real Val1 = Log(Valu1+Sqrt(Valu1*Valu1-1)); - Standard_Real Val2 = Log(Valu2+Sqrt(Valu2*Valu2+1)); - delta = (Val1 <= Val2 ? Val1:Val2); + gpHyperbola = Handle(Geom2d_Hyperbola)::DownCast(curve)->Hypr2d(); + Standard_Real Majr = gpHyperbola.MajorRadius(); + Standard_Real Minr = gpHyperbola.MinorRadius(); + Standard_Real Valu1 = Limit/Majr; + Standard_Real Valu2 = Limit/Minr; + Standard_Real Val1 = Log(Valu1+Sqrt(Valu1*Valu1-1)); + Standard_Real Val2 = Log(Valu2+Sqrt(Valu2*Valu2+1)); + delta = (Val1 <= Val2 ? Val1:Val2); } CurveDraw = new Geom2d_TrimmedCurve(aCurve, - aCurve->FirstParameter(), - aCurve->FirstParameter() + delta); + aCurve->FirstParameter(), + aCurve->FirstParameter() + delta); } else { CurveDraw = aCurve; @@ -1284,6 +1408,7 @@ void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve, } #ifdef DRAW + Standard_Integer Indice = 1; if (Indice == 1) Couleur = Draw_jaune; else if (Indice == 2) Couleur = Draw_bleu; else if (Indice == 3) Couleur = Draw_rouge; @@ -1296,8 +1421,8 @@ void MAT2d_DrawCurve(const Handle(Geom2d_Curve)& aCurve, else dr = new DrawTrSurf_Curve2d(CurveDraw,Couleur,500); - dout << dr; - dout.Flush(); + //dout << dr; + //dout.Flush(); #endif } diff --git a/tests/blend/buildevol/D9 b/tests/blend/buildevol/D9 index 160c2d515d..eff722c021 100644 --- a/tests/blend/buildevol/D9 +++ b/tests/blend/buildevol/D9 @@ -8,7 +8,7 @@ tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E mkevol result s -updatevol s_5 0 1*SCALE1 1 2*SCALE1 2 1*SCALE1 +updatevol s_4 0 1*SCALE1 1 2*SCALE1 2 1*SCALE1 buildevol set square 87027.5 diff --git a/tests/blend/buildevol/E2 b/tests/blend/buildevol/E2 index a639479236..f68464110d 100644 --- a/tests/blend/buildevol/E2 +++ b/tests/blend/buildevol/E2 @@ -8,7 +8,7 @@ tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E mkevol result s -updatevol s_5 0 1*SCALE1 1 2*SCALE1 2 1*SCALE1 +updatevol s_6 0 1*SCALE1 1 2*SCALE1 2 1*SCALE1 buildevol set square 81492.8 diff --git a/tests/blend/buildevol/E3 b/tests/blend/buildevol/E3 index da73729f10..d7b24cabd8 100644 --- a/tests/blend/buildevol/E3 +++ b/tests/blend/buildevol/E3 @@ -8,7 +8,7 @@ tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E mkevol result s -updatevol s_6 0 1*SCALE1 1 2*SCALE1 2 1*SCALE1 +updatevol s_5 0 1*SCALE1 1 2*SCALE1 2 1*SCALE1 buildevol set square 81299.7 diff --git a/tests/blend/simple/I1 b/tests/blend/simple/I1 index 24bb7346d9..51fea4b9f8 100644 --- a/tests/blend/simple/I1 +++ b/tests/blend/simple/I1 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_5 +blend result s 1*SCALE1 s_4 set square 91635.9 diff --git a/tests/blend/simple/I2 b/tests/blend/simple/I2 index 7b206b5b5b..8468beb14b 100644 --- a/tests/blend/simple/I2 +++ b/tests/blend/simple/I2 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_5 1*SCALE1 s_2 1*SCALE1 s_1 +blend result s 1*SCALE1 s_4 1*SCALE1 s_2 1*SCALE1 s_1 set square 90904.5 diff --git a/tests/blend/simple/I4 b/tests/blend/simple/I4 index fe0babb5e5..c703bb08d1 100644 --- a/tests/blend/simple/I4 +++ b/tests/blend/simple/I4 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_6 1*SCALE1 s_8 1*SCALE1 s_5 +blend result s 1*SCALE1 s_6 1*SCALE1 s_9 1*SCALE1 s_4 set square 90939.5 diff --git a/tests/blend/simple/I5 b/tests/blend/simple/I5 index 28bc408c15..ec52d8d6f4 100644 --- a/tests/blend/simple/I5 +++ b/tests/blend/simple/I5 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_5 +blend result s 1*SCALE1 s_6 set square 81863.7 diff --git a/tests/blend/simple/I6 b/tests/blend/simple/I6 index 75738004e9..feb8a92a32 100644 --- a/tests/blend/simple/I6 +++ b/tests/blend/simple/I6 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_5 1*SCALE1 s_8 1*SCALE1 s_6 +blend result s 1*SCALE1 s_5 1*SCALE1 s_10 1*SCALE1 s_6 set square 80209.3 diff --git a/tests/blend/simple/I7 b/tests/blend/simple/I7 index 0c43afb95a..570d06c027 100644 --- a/tests/blend/simple/I7 +++ b/tests/blend/simple/I7 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_6 +blend result s 1*SCALE1 s_5 set square 81743.8 diff --git a/tests/blend/simple/I8 b/tests/blend/simple/I8 index ab05b49fcc..ad2114293f 100644 --- a/tests/blend/simple/I8 +++ b/tests/blend/simple/I8 @@ -7,6 +7,6 @@ pipe s w profile tscale s 0 0 0 SCALE1 fsameparameter s SCALE1*1.e-7 explode s E -blend result s 1*SCALE1 s_6 1*SCALE1 s_10 1*SCALE1 s_7 +blend result s 1*SCALE1 s_5 1*SCALE1 s_8 1*SCALE1 s_7 set square 80586.1 diff --git a/tests/blend/simple/P5 b/tests/blend/simple/P5 index 6c257e7422..751c89b61e 100644 --- a/tests/blend/simple/P5 +++ b/tests/blend/simple/P5 @@ -4,6 +4,7 @@ #ttranslate s1 s2 5 5 0 #cut s s1 s2 #save s CFI_i1234fis.rle +puts "TODO ?OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_2" restore [locate_data_file CFI_i1234fis.rle] s tscale s 0 0 0 SCALE1 diff --git a/tests/boolean/bsection/R3 b/tests/boolean/bsection/R3 index 9358305594..36c94cb2dc 100644 --- a/tests/boolean/bsection/R3 +++ b/tests/boolean/bsection/R3 @@ -1,4 +1,5 @@ ## buc60289 +puts "TODO ?OCC24255 ALL: Error : The length of the resulting shape is" restore [locate_data_file heal-Face1.rle] a restore [locate_data_file Plan.rle] b diff --git a/tests/bugs/caf/bug21707 b/tests/bugs/caf/bug21707 index 113a40d103..459b9f091b 100644 --- a/tests/bugs/caf/bug21707 +++ b/tests/bugs/caf/bug21707 @@ -31,7 +31,7 @@ GetShape D $Lin2:1:2 L1 NewCommand D AddDriver D Prism Box PTxyz -set Prism [AddPrism D $Lin2 300 0] +set Prism [AddPrism D $Lin2 300 1] ComputeFun D $Prism:1 GetShape D $Prism:1:2 Pr diff --git a/tests/bugs/modalg_1/buc60782_1 b/tests/bugs/modalg_1/buc60782_1 index c3caf3c3d2..0cc51d71a2 100755 --- a/tests/bugs/modalg_1/buc60782_1 +++ b/tests/bugs/modalg_1/buc60782_1 @@ -31,9 +31,10 @@ if { [regexp {OK} $che ] != 1} { renamevar a result } else { puts "OK BUC60782: offset is created" - tpcompound result - } + compound result_1 a result + + } } -set square 0 +set square 4.24716e+006 set 2dviewer 0 diff --git a/tests/bugs/modalg_2/bug423_1 b/tests/bugs/modalg_2/bug423_1 index be5b56e832..59b05bcef4 100755 --- a/tests/bugs/modalg_2/bug423_1 +++ b/tests/bugs/modalg_2/bug423_1 @@ -15,7 +15,7 @@ mkplane cont cont nexplode cyl F ttranslate cont 0 200 0 -featdprism cyl cont cont 10 1 1 +featdprism cyl cont cont -10 1 1 if [catch {featperformval dprism result 55 cyl_3 } catch_result] { puts "Faulty OCC423 (case 1): function FEATPERFORMVAL works wrongly" diff --git a/tests/bugs/modalg_4/bug745_10 b/tests/bugs/modalg_4/bug745_10 index 05379fdbf1..e37f08d776 100755 --- a/tests/bugs/modalg_4/bug745_10 +++ b/tests/bugs/modalg_4/bug745_10 @@ -20,5 +20,5 @@ if { [regexp {WIRE} $list] == 0 } { renamevar result_1 result -set length 320.442 +set length 307.876 set 2dviewer 1 diff --git a/tests/bugs/modalg_4/bug829_1 b/tests/bugs/modalg_4/bug829_1 index 234867a3f8..6d5db1590b 100755 --- a/tests/bugs/modalg_4/bug829_1 +++ b/tests/bugs/modalg_4/bug829_1 @@ -42,6 +42,6 @@ if { [catch { mkoffset result a_1 1 5 } status] } { } } } - set length 0 + set length 8577.24 set 2dviewer 0 } diff --git a/tests/bugs/modalg_5/bug23706_1 b/tests/bugs/modalg_5/bug23706_1 index cc98cbe935..537b177274 100755 --- a/tests/bugs/modalg_5/bug23706_1 +++ b/tests/bugs/modalg_5/bug23706_1 @@ -18,9 +18,9 @@ explode p f mksurface ss1 p_1 mksurface ss2 p_2 mksurface ss3 p_3 -offset o1 ss1 0.1 -offset o2 ss2 0.1 -offset o3 ss3 0.1 +offset o1 ss1 -0.1 +offset o2 ss2 -0.1 +offset o3 ss3 -0.1 mkface res o2 set info [sprops res] diff --git a/tests/bugs/modalg_5/bug23952_1 b/tests/bugs/modalg_5/bug23952_1 index 29deb5079a..d3dcd2fdbf 100644 --- a/tests/bugs/modalg_5/bug23952_1 +++ b/tests/bugs/modalg_5/bug23952_1 @@ -3,6 +3,7 @@ puts "TODO ?OCC24156 MacOS: An exception was caught" puts "TODO OCC24156 MacOS: TEST INCOMPLETE" puts "TODO OCC24156 MacOS: \\*\\*\\* Abort" puts "TODO OCC24156 MacOS: ... The exception is" +puts "TODO ?OCC24255 ALL: An exception" puts "================" puts "OCC23952" diff --git a/tests/bugs/modalg_5/bug25298_09 b/tests/bugs/modalg_5/bug25298_09 index 74eb18f51b..f6897d077f 100755 --- a/tests/bugs/modalg_5/bug25298_09 +++ b/tests/bugs/modalg_5/bug25298_09 @@ -17,17 +17,17 @@ if [catch { mkoffset resoffset pp 1 -1. i } ] { } else { renamevar resoffset_1 result - set length 32 + set length 42 - set nb_v_good 5 - set nb_e_good 5 + set nb_v_good 6 + set nb_e_good 7 set nb_w_good 1 set nb_f_good 0 set nb_sh_good 0 set nb_sol_good 0 set nb_compsol_good 0 set nb_compound_good 0 - set nb_shape_good 11 + set nb_shape_good 14 display result fit diff --git a/tests/bugs/modalg_5/bug25704_1 b/tests/bugs/modalg_5/bug25704_1 index d880ff0ce6..c3f09d8dfc 100644 --- a/tests/bugs/modalg_5/bug25704_1 +++ b/tests/bugs/modalg_5/bug25704_1 @@ -15,7 +15,7 @@ if [catch { mkoffset resoffset a 1 2. } ] { } else { renamevar resoffset_1 result - set length 50.2655 + set length 75.3982 set nb_v_good 1 set nb_e_good 1 diff --git a/tests/bugs/modalg_5/bug25704_2 b/tests/bugs/modalg_5/bug25704_2 index ccd4dae343..98061b8bda 100644 --- a/tests/bugs/modalg_5/bug25704_2 +++ b/tests/bugs/modalg_5/bug25704_2 @@ -15,7 +15,7 @@ if [catch { mkoffset resoffset a 1 -3. } ] { } else { renamevar resoffset_1 result - set length 81.6814 + set length 43.9823 set nb_v_good 1 set nb_e_good 1 diff --git a/tests/caf/driver/B6 b/tests/caf/driver/B6 index 05b538e8c3..f5f7bb89e5 100755 --- a/tests/caf/driver/B6 +++ b/tests/caf/driver/B6 @@ -33,7 +33,7 @@ GetShape D $Lin2:1:2 L1; #4 Prism (after step #1) NewCommand D AddDriver D Prism Box PTxyz -set Prism [AddPrism D $Lin2 300 0] +set Prism [AddPrism D $Lin2 300 1] ComputeFun D $Prism:1 GetShape D $Prism:1:2 Pr GetReference D $Prism; ## check is reference set diff --git a/tests/caf/driver/B7 b/tests/caf/driver/B7 index 2210375b28..542693eddf 100755 --- a/tests/caf/driver/B7 +++ b/tests/caf/driver/B7 @@ -33,7 +33,7 @@ GetShape D $Lin2:1:2 L1; #4 Prism (after step #1) NewCommand D AddDriver D Prism Box PTxyz -set Prism [AddPrism D $Lin2 300 0] +set Prism [AddPrism D $Lin2 300 1] ComputeFun D $Prism:1 GetShape D $Prism:1:2 Pr GetReference D $Prism; ## check is reference set diff --git a/tests/caf/named_shape/F6 b/tests/caf/named_shape/F6 index 1e3c83d3b1..8f9878983d 100755 --- a/tests/caf/named_shape/F6 +++ b/tests/caf/named_shape/F6 @@ -56,7 +56,7 @@ GetShape D $Lin2:1:2 L1; #3 Prism NewCommand D AddDriver D Prism Box PTxyz -set Prism [AddPrism D $Lin2 300 0] +set Prism [AddPrism D $Lin2 300 1] ComputeFun D $Prism:1 GetShape D $Prism:1:2 Pr GetReference D $Prism; ## check is reference set diff --git a/tests/caf/named_shape/F7 b/tests/caf/named_shape/F7 index 84f937d86e..7cd6bb7279 100644 --- a/tests/caf/named_shape/F7 +++ b/tests/caf/named_shape/F7 @@ -54,7 +54,7 @@ GetShape D $Lin2:1:2 L1; #3 Prism NewCommand D AddDriver D Prism Box PTxyz -set Prism [AddPrism D $Lin2 300 0] +set Prism [AddPrism D $Lin2 300 1] ComputeFun D $Prism:1 GetShape D $Prism:1:2 Pr GetReference D $Prism; ## check is reference set diff --git a/tests/draft/angle/M2 b/tests/draft/angle/M2 index 18efa8b98b..264566958f 100644 --- a/tests/draft/angle/M2 +++ b/tests/draft/angle/M2 @@ -1,7 +1,7 @@ # Original bug : pro12877 # Date : 02 Dec 98 -puts "TODO OCC22803 All:Error: The tolerance of the resulting shape is too big" +puts "TODO OCC22803 All: Error: The tolerance of the resulting shape is too big" #puts "TODO OCC23511 Debian60-64: The area of the resulting shape is 186543" restore [locate_data_file CFE903_pro12ggx.rle] base diff --git a/tests/feat/featdprism/A1 b/tests/feat/featdprism/A1 index 93dc597736..7eafd9812d 100644 --- a/tests/feat/featdprism/A1 +++ b/tests/feat/featdprism/A1 @@ -3,7 +3,7 @@ restore [locate_data_file contour.rle] cont mkplane cont cont nexplode cyl F -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperform dprism result set square 93872.9 diff --git a/tests/feat/featdprism/A2 b/tests/feat/featdprism/A2 index 22b56b1b19..2c3099e020 100644 --- a/tests/feat/featdprism/A2 +++ b/tests/feat/featdprism/A2 @@ -3,7 +3,7 @@ restore [locate_data_file contour.rle] cont mkplane cont cont nexplode cyl F -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperformval dprism result -100 -set square 78539.8 +set square 87985.1 diff --git a/tests/feat/featdprism/A3 b/tests/feat/featdprism/A3 index 35c868a6ba..d06ec98599 100644 --- a/tests/feat/featdprism/A3 +++ b/tests/feat/featdprism/A3 @@ -3,7 +3,7 @@ restore [locate_data_file contour.rle] cont mkplane cont cont nexplode cyl F -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperformval dprism result 100 cyl_3 set square 87914.5 diff --git a/tests/feat/featdprism/A4 b/tests/feat/featdprism/A4 index 26e2174d7b..21c636559c 100644 --- a/tests/feat/featdprism/A4 +++ b/tests/feat/featdprism/A4 @@ -4,7 +4,7 @@ mkplane cont cont nexplode cyl F ttranslate cont 0 200 0 -featdprism cyl cont cont 10 1 1 +featdprism cyl cont cont -10 1 1 featperform dprism result cyl_3 set square 93058.7 diff --git a/tests/feat/featdprism/A5 b/tests/feat/featdprism/A5 index 6c03f7223a..9a06966f72 100644 --- a/tests/feat/featdprism/A5 +++ b/tests/feat/featdprism/A5 @@ -4,7 +4,7 @@ mkplane cont cont nexplode cyl F ttranslate cont 0 200 0 -featdprism cyl cont cont 10 1 1 +featdprism cyl cont cont -10 1 1 featperformval dprism result 100 -set square 108523 +set square 93058.7 diff --git a/tests/feat/featdprism/A6 b/tests/feat/featdprism/A6 index 224eab8400..71578ad7b6 100644 --- a/tests/feat/featdprism/A6 +++ b/tests/feat/featdprism/A6 @@ -4,7 +4,7 @@ mkplane cont cont nexplode cyl F ttranslate cont 0 200 0 -featdprism cyl cont cont 10 1 1 +featdprism cyl cont cont -10 1 1 featperformval dprism result 55 cyl_3 set square 94944.4 diff --git a/tests/feat/featdprism/A9 b/tests/feat/featdprism/A9 index ba26b04f73..b4a31e75a8 100644 --- a/tests/feat/featdprism/A9 +++ b/tests/feat/featdprism/A9 @@ -3,7 +3,7 @@ restore [locate_data_file contour.rle] cont mkplane cont cont nexplode cyl F -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperform dprism result cyl_3 set square 93872.9 diff --git a/tests/feat/featdprism/B1 b/tests/feat/featdprism/B1 index 9f95fb1b63..dab134f3a2 100644 --- a/tests/feat/featdprism/B1 +++ b/tests/feat/featdprism/B1 @@ -4,7 +4,7 @@ mkplane cont cont nexplode cyl F ttranslate cont 0 0 -100 -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperformval dprism result -100 -set square 78539.8 +set square 81634.8 diff --git a/tests/feat/featdprism/B2 b/tests/feat/featdprism/B2 index 9b823b7a25..2c8e7e36eb 100644 --- a/tests/feat/featdprism/B2 +++ b/tests/feat/featdprism/B2 @@ -4,7 +4,7 @@ mkplane cont cont nexplode cyl F ttranslate cont 0 0 -100 -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperform dprism result set square 83382.4 diff --git a/tests/feat/featdprism/B3 b/tests/feat/featdprism/B3 index 968224e5e7..ca42c31107 100644 --- a/tests/feat/featdprism/B3 +++ b/tests/feat/featdprism/B3 @@ -9,7 +9,7 @@ ttranslate cont 0 0 -100 # mksurface surf cyl_3 mkface face surf -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperformval dprism result 100 face set square 81610.6 diff --git a/tests/feat/featdprism/B4 b/tests/feat/featdprism/B4 index 39df0e0b8a..e16c59f49c 100644 --- a/tests/feat/featdprism/B4 +++ b/tests/feat/featdprism/B4 @@ -3,7 +3,7 @@ restore [locate_data_file contour.rle] cont mkplane cont cont nexplode cyl F -featdprism cyl cont cont 10 0 1 +featdprism cyl cont cont -10 0 1 featperform dprism result cyl_3 cyl_3 set square 93872.9 diff --git a/tests/feat/featdprism/B5 b/tests/feat/featdprism/B5 index ae0bc64418..bfa67d9cda 100644 --- a/tests/feat/featdprism/B5 +++ b/tests/feat/featdprism/B5 @@ -5,7 +5,7 @@ nexplode cyl F ttranslate cont 0 0 -100 ttranslate cont 0 200 0 -featdprism cyl cont cont 10 1 1 +featdprism cyl cont cont -10 1 1 featperformval dprism result 100 -set square 108523 +set square 103687 diff --git a/tests/feat/featdprism/B6 b/tests/feat/featdprism/B6 index 2fa8ad6333..1beb8eeff2 100644 --- a/tests/feat/featdprism/B6 +++ b/tests/feat/featdprism/B6 @@ -10,7 +10,7 @@ ttranslate cont 0 200 0 # mksurface surf cyl_3 mkface face surf -featdprism cyl cont cont 10 1 1 +featdprism cyl cont cont -10 1 1 featperformval dprism result 55 face set square 99444.8 diff --git a/tests/offset/faces_type_i/M7 b/tests/offset/faces_type_i/M7 index d6413e00a2..63ccc648cb 100644 --- a/tests/offset/faces_type_i/M7 +++ b/tests/offset/faces_type_i/M7 @@ -7,6 +7,6 @@ polyline profile 0 0 0 10 0 0 5 0 5 0 0 0 mkplane profile profile pipe s w profile -OFFSETSHAPE -1 {s_2 s_3} $calcul $type +OFFSETSHAPE -1 {s_2 s_4} $calcul $type set volume 259.68 diff --git a/tests/offset/faces_type_i/M9 b/tests/offset/faces_type_i/M9 index 77267a1030..2c98e35a9f 100644 --- a/tests/offset/faces_type_i/M9 +++ b/tests/offset/faces_type_i/M9 @@ -5,6 +5,6 @@ polyline profile 0 0 0 10 0 0 5 0 5 0 0 0 mkplane profile profile pipe s w profile -OFFSETSHAPE -1 {s_4 s_5} $calcul $type +OFFSETSHAPE -1 {s_3 s_5} $calcul $type set volume 445.962 diff --git a/tests/offset/wire_closed_inside_0_005/B5 b/tests/offset/wire_closed_inside_0_005/B5 index 0090bedacd..016e4089fc 100644 --- a/tests/offset/wire_closed_inside_0_005/B5 +++ b/tests/offset/wire_closed_inside_0_005/B5 @@ -1,3 +1,5 @@ +puts "TODO OCC24255 ALL: Error : big tolerance of shape result" + restore [locate_data_file offset_wire_019.brep] s set length 1030.64 diff --git a/tests/offset/wire_closed_inside_0_005/E8 b/tests/offset/wire_closed_inside_0_005/E8 index d6a9a96812..e7bae09fd6 100644 --- a/tests/offset/wire_closed_inside_0_005/E8 +++ b/tests/offset/wire_closed_inside_0_005/E8 @@ -2,11 +2,12 @@ puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." +puts "TODO OCC24255 ALL: Faulty shapes in variables" restore [locate_data_file offset_wire_059.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 322.054 +set nbsh_v 551 +set nbsh_e 551 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_005/G4 b/tests/offset/wire_closed_inside_0_005/G4 index 1abfd83d94..bfcde6e259 100644 --- a/tests/offset/wire_closed_inside_0_005/G4 +++ b/tests/offset/wire_closed_inside_0_005/G4 @@ -1,7 +1,7 @@ restore [locate_data_file offset_wire_081.brep] s set length 376.906 -set nbsh_v 66 -set nbsh_e 66 +set nbsh_v 65 +set nbsh_e 65 set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_005/H3 b/tests/offset/wire_closed_inside_0_005/H3 index a91f56a544..cb868576c2 100644 --- a/tests/offset/wire_closed_inside_0_005/H3 +++ b/tests/offset/wire_closed_inside_0_005/H3 @@ -1,7 +1,7 @@ restore [locate_data_file offset_wire_089.brep] s set length 896.364 -set nbsh_v 18 -set nbsh_e 18 +set nbsh_v 19 +set nbsh_e 19 set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_025/A2 b/tests/offset/wire_closed_inside_0_025/A2 index bfd27a906f..263650532d 100644 --- a/tests/offset/wire_closed_inside_0_025/A2 +++ b/tests/offset/wire_closed_inside_0_025/A2 @@ -1,12 +1,12 @@ -puts "TODO ?OCC23068 ALL: An exception was caught" -puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" -puts "TODO ?OCC23748 ALL: Error: Offset is not done." -puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." +#puts "TODO ?OCC23068 ALL: An exception was caught" +#puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" +#puts "TODO ?OCC23748 ALL: Error: Offset is not done." +#puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." restore [locate_data_file offset_wire_003.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 787.515 +set nbsh_v 78 +set nbsh_e 78 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_025/B2 b/tests/offset/wire_closed_inside_0_025/B2 index d1c5602252..cd1dd2481a 100644 --- a/tests/offset/wire_closed_inside_0_025/B2 +++ b/tests/offset/wire_closed_inside_0_025/B2 @@ -5,8 +5,8 @@ puts "TODO ?OCC23748 ALL: Error: Offset is not done." restore [locate_data_file offset_wire_015.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 549.222 +set nbsh_v 55 +set nbsh_e 55 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_025/D1 b/tests/offset/wire_closed_inside_0_025/D1 index ef319ac193..4cc0997a64 100644 --- a/tests/offset/wire_closed_inside_0_025/D1 +++ b/tests/offset/wire_closed_inside_0_025/D1 @@ -1,6 +1,7 @@ cpulimit 2400 puts "TODO OCC23068 ALL: Error : The offset cannot be built." puts "TODO OCC23748 ALL: Error: Offset is not done." +#puts "TODO OCC24255 ALL: An exception was caught" restore [locate_data_file offset_wire_041.brep] s diff --git a/tests/offset/wire_closed_inside_0_025/E8 b/tests/offset/wire_closed_inside_0_025/E8 index 9a7e67494f..f529ee2269 100644 --- a/tests/offset/wire_closed_inside_0_025/E8 +++ b/tests/offset/wire_closed_inside_0_025/E8 @@ -3,11 +3,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes in variables" restore [locate_data_file offset_wire_059.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 282.776 +set nbsh_v 524 +set nbsh_e 524 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_025/F7 b/tests/offset/wire_closed_inside_0_025/F7 index 5db8abe890..13550bfcf3 100644 --- a/tests/offset/wire_closed_inside_0_025/F7 +++ b/tests/offset/wire_closed_inside_0_025/F7 @@ -2,11 +2,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_2" restore [locate_data_file offset_wire_067.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 17.5164 +set nbsh_v 40 +set nbsh_e 40 +set nbsh_w 2 diff --git a/tests/offset/wire_closed_inside_0_025/G4 b/tests/offset/wire_closed_inside_0_025/G4 index 0a8ad4412a..afea00e3d8 100644 --- a/tests/offset/wire_closed_inside_0_025/G4 +++ b/tests/offset/wire_closed_inside_0_025/G4 @@ -2,11 +2,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_2 " restore [locate_data_file offset_wire_081.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 291.991 +set nbsh_v 20 +set nbsh_e 20 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_025/H3 b/tests/offset/wire_closed_inside_0_025/H3 index 71b5e58c00..5662c256ce 100644 --- a/tests/offset/wire_closed_inside_0_025/H3 +++ b/tests/offset/wire_closed_inside_0_025/H3 @@ -1,8 +1,7 @@ -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" restore [locate_data_file offset_wire_089.brep] s -set length 953.42 -set nbsh_v 20 -set nbsh_e 20 +set length 746.196 +set nbsh_v 17 +set nbsh_e 17 set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_075/A8 b/tests/offset/wire_closed_inside_0_075/A8 index 84316cd73d..a21f71f851 100644 --- a/tests/offset/wire_closed_inside_0_075/A8 +++ b/tests/offset/wire_closed_inside_0_075/A8 @@ -8,5 +8,5 @@ restore [locate_data_file offset_wire_012.brep] s set length 0 set nbsh_v 0 set nbsh_e 0 -set nbsh_w 0 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_075/C7 b/tests/offset/wire_closed_inside_0_075/C7 index 497da0a356..9463c8a682 100644 --- a/tests/offset/wire_closed_inside_0_075/C7 +++ b/tests/offset/wire_closed_inside_0_075/C7 @@ -1,7 +1,3 @@ -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_4" -puts "TODO OCC23068 ALL: Error : The length of the resulting shape is" -puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG because it must contain" - restore [locate_data_file offset_wire_038.brep] s set length 223.954 diff --git a/tests/offset/wire_closed_inside_0_075/E8 b/tests/offset/wire_closed_inside_0_075/E8 index 9a7e67494f..a3106a6017 100644 --- a/tests/offset/wire_closed_inside_0_075/E8 +++ b/tests/offset/wire_closed_inside_0_075/E8 @@ -3,11 +3,13 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO ?OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_4" +puts "TODO ?OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_17" restore [locate_data_file offset_wire_059.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 240.01 +set nbsh_v 434 +set nbsh_e 434 +set nbsh_w 2 diff --git a/tests/offset/wire_closed_inside_0_075/F6 b/tests/offset/wire_closed_inside_0_075/F6 index 0bc0861ba0..277d0f6426 100644 --- a/tests/offset/wire_closed_inside_0_075/F6 +++ b/tests/offset/wire_closed_inside_0_075/F6 @@ -2,11 +2,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +#puts "TODO ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_066.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 45.4428 +set nbsh_v 52 +set nbsh_e 52 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_inside_0_075/G4 b/tests/offset/wire_closed_inside_0_075/G4 index 0a8ad4412a..dda29e5b1f 100644 --- a/tests/offset/wire_closed_inside_0_075/G4 +++ b/tests/offset/wire_closed_inside_0_075/G4 @@ -5,8 +5,8 @@ puts "TODO ?OCC23748 ALL: Error: Offset is not done." restore [locate_data_file offset_wire_081.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 428.734 +set nbsh_v 18 +set nbsh_e 18 +set nbsh_w 2 diff --git a/tests/offset/wire_closed_inside_0_075/H3 b/tests/offset/wire_closed_inside_0_075/H3 index fa41564255..3dd1020eff 100644 --- a/tests/offset/wire_closed_inside_0_075/H3 +++ b/tests/offset/wire_closed_inside_0_075/H3 @@ -1,8 +1,7 @@ -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" restore [locate_data_file offset_wire_089.brep] s -set length 1110.06 -set nbsh_v 17 -set nbsh_e 17 +set length 383.716 +set nbsh_v 4 +set nbsh_e 4 set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_005/D1 b/tests/offset/wire_closed_outside_0_005/D1 index 5ecce51f7b..c91ddb5f30 100644 --- a/tests/offset/wire_closed_outside_0_005/D1 +++ b/tests/offset/wire_closed_outside_0_005/D1 @@ -1,17 +1,20 @@ -puts "TODO OCC23068 ALL: Error : big tolerance of shape result" -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" +#puts "TODO OCC23068 ALL: Error : big tolerance of shape result" +#puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" +#puts "TODO OCC24255 ALL: An exception was caught" +puts "TODO OCC24255 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Error : The offset cannot be built." set os "ALL" if {[array get env os_type] != ""} { set os $env(os_type) } -if { - [string compare $os "Mandriva2010" ] != 0 - && [string compare $os "Debian40" ] != 0 - && [string compare $os "Mandriva2008" ] != 0 - } { - puts "TODO OCC23068 $os: Error : The resulting shape is WRONG" -} +#if { +# [string compare $os "Mandriva2010" ] != 0 +# && [string compare $os "Debian40" ] != 0 +# && [string compare $os "Mandriva2008" ] != 0 +# } { +# puts "TODO OCC23068 $os: Error : The resulting shape is WRONG" +#} restore [locate_data_file offset_wire_041.brep] s diff --git a/tests/offset/wire_closed_outside_0_005/E8 b/tests/offset/wire_closed_outside_0_005/E8 index aa21ea7625..e152ea97c7 100644 --- a/tests/offset/wire_closed_outside_0_005/E8 +++ b/tests/offset/wire_closed_outside_0_005/E8 @@ -8,7 +8,7 @@ puts "TODO ?OCC23748 ALL: Error: Offset is not done." restore [locate_data_file offset_wire_059.brep] s set length 347.204 -set nbsh_v 584 -set nbsh_e 584 +set nbsh_v 583 +set nbsh_e 583 set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_005/G1 b/tests/offset/wire_closed_outside_0_005/G1 index 4ff3526f78..675f58b67c 100644 --- a/tests/offset/wire_closed_outside_0_005/G1 +++ b/tests/offset/wire_closed_outside_0_005/G1 @@ -1,7 +1,7 @@ restore [locate_data_file offset_wire_078.brep] s set length 488.408 -set nbsh_v 72 -set nbsh_e 72 +set nbsh_v 73 +set nbsh_e 73 set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_025/B7 b/tests/offset/wire_closed_outside_0_025/B7 index 233e346638..f3f4a12fbb 100644 --- a/tests/offset/wire_closed_outside_0_025/B7 +++ b/tests/offset/wire_closed_outside_0_025/B7 @@ -1,9 +1,9 @@ -puts "TODO OCC23068 ALL: Error : big tolerance of shape result_1" -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" +#puts "TODO OCC23068 ALL: Error : big tolerance of shape result_1" +#puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" restore [locate_data_file offset_wire_021.brep] s -set length 175.927 -set nbsh_v 31 -set nbsh_e 31 +set length 164.679 +set nbsh_v 30 +set nbsh_e 30 set nbsh_w 2 diff --git a/tests/offset/wire_closed_outside_0_025/E8 b/tests/offset/wire_closed_outside_0_025/E8 index 9a7e67494f..1a5360ec96 100644 --- a/tests/offset/wire_closed_outside_0_025/E8 +++ b/tests/offset/wire_closed_outside_0_025/E8 @@ -3,11 +3,11 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." - +puts "TODO OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_" restore [locate_data_file offset_wire_059.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 406.425 +set nbsh_v 579 +set nbsh_e 579 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_025/F7 b/tests/offset/wire_closed_outside_0_025/F7 index 03348b85f8..6ca7277e64 100644 --- a/tests/offset/wire_closed_outside_0_025/F7 +++ b/tests/offset/wire_closed_outside_0_025/F7 @@ -3,11 +3,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty" restore [locate_data_file offset_wire_067.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 32.4572 +set nbsh_v 105 +set nbsh_e 105 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_025/F8 b/tests/offset/wire_closed_outside_0_025/F8 index aa95130d02..31ac4c3edb 100644 --- a/tests/offset/wire_closed_outside_0_025/F8 +++ b/tests/offset/wire_closed_outside_0_025/F8 @@ -1,8 +1,8 @@ -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" +#puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" restore [locate_data_file offset_wire_068.brep] s set length 1589.9 -set nbsh_v 49 -set nbsh_e 49 +set nbsh_v 48 +set nbsh_e 48 set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_075/A2 b/tests/offset/wire_closed_outside_0_075/A2 index 80534b18bf..1b76c4f003 100644 --- a/tests/offset/wire_closed_outside_0_075/A2 +++ b/tests/offset/wire_closed_outside_0_075/A2 @@ -2,11 +2,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_003.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 1613.94 +set nbsh_v 98 +set nbsh_e 98 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_075/B7 b/tests/offset/wire_closed_outside_0_075/B7 index 074723fb7d..7a6ac5857c 100644 --- a/tests/offset/wire_closed_outside_0_075/B7 +++ b/tests/offset/wire_closed_outside_0_075/B7 @@ -1,9 +1,9 @@ -puts "TODO OCC23068 ALL: Error : big tolerance of shape result" -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" +#puts "TODO OCC23068 ALL: Error : big tolerance of shape result" +#puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" restore [locate_data_file offset_wire_021.brep] s -set length 238.72 -set nbsh_v 27 -set nbsh_e 27 +set length 200.958 +set nbsh_v 26 +set nbsh_e 26 set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_075/E8 b/tests/offset/wire_closed_outside_0_075/E8 index 9a7e67494f..2dee073690 100644 --- a/tests/offset/wire_closed_outside_0_075/E8 +++ b/tests/offset/wire_closed_outside_0_075/E8 @@ -3,11 +3,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_" restore [locate_data_file offset_wire_059.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 555.502 +set nbsh_v 573 +set nbsh_e 573 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_075/F7 b/tests/offset/wire_closed_outside_0_075/F7 index 03348b85f8..43ab0cad1c 100644 --- a/tests/offset/wire_closed_outside_0_075/F7 +++ b/tests/offset/wire_closed_outside_0_075/F7 @@ -3,11 +3,13 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes" +puts "TODO OCC24255 ALL: Error : big tolerance" restore [locate_data_file offset_wire_067.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 51.8506 +set nbsh_v 61 +set nbsh_e 61 +set nbsh_w 1 diff --git a/tests/offset/wire_closed_outside_0_075/H3 b/tests/offset/wire_closed_outside_0_075/H3 index e6d1e88b31..d156e63b42 100644 --- a/tests/offset/wire_closed_outside_0_075/H3 +++ b/tests/offset/wire_closed_outside_0_075/H3 @@ -3,11 +3,12 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO ALL: Faulty shapes in variables faulty_1 to faulty_10" restore [locate_data_file offset_wire_089.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 1367.49 +set nbsh_v 20 +set nbsh_e 20 +set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_005/A7 b/tests/offset/wire_unclosed_outside_0_005/A7 index 22f08b7d52..a56f54ddce 100644 --- a/tests/offset/wire_unclosed_outside_0_005/A7 +++ b/tests/offset/wire_unclosed_outside_0_005/A7 @@ -2,7 +2,7 @@ puts "TODO OCC23068 ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_024.brep] s set length 40.4005 -set nbsh_v 40 -set nbsh_e 40 +set nbsh_v 44 +set nbsh_e 44 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_005/B9 b/tests/offset/wire_unclosed_outside_0_005/B9 index b55352c25c..5c692aaf5e 100644 --- a/tests/offset/wire_unclosed_outside_0_005/B9 +++ b/tests/offset/wire_unclosed_outside_0_005/B9 @@ -3,7 +3,7 @@ puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" restore [locate_data_file offset_wire_071.brep] s set length 83216 -set nbsh_v 205 -set nbsh_e 205 +set nbsh_v 215 +set nbsh_e 215 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_005/C1 b/tests/offset/wire_unclosed_outside_0_005/C1 index 36455ed2c1..3502aac4f9 100644 --- a/tests/offset/wire_unclosed_outside_0_005/C1 +++ b/tests/offset/wire_unclosed_outside_0_005/C1 @@ -1,5 +1,10 @@ -puts "TODO OCC23068 ALL: Error : big tolerance of shape result" -puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" +#puts "TODO OCC23068 ALL: Error : big tolerance of shape result" +#puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" +#puts "TODO OCC24255 ALL: An exception was caught" +puts "TODO OCC24255 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Error : The offset cannot be built." + + restore [locate_data_file offset_wire_072.brep] s set length 116267 diff --git a/tests/offset/wire_unclosed_outside_0_005/C2 b/tests/offset/wire_unclosed_outside_0_005/C2 index 25c34f4dc6..8470f087cb 100644 --- a/tests/offset/wire_unclosed_outside_0_005/C2 +++ b/tests/offset/wire_unclosed_outside_0_005/C2 @@ -3,7 +3,7 @@ puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2" restore [locate_data_file offset_wire_073.brep] s set length 80332.8 -set nbsh_v 214 -set nbsh_e 214 +set nbsh_v 212 +set nbsh_e 212 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_005/C4 b/tests/offset/wire_unclosed_outside_0_005/C4 index d9025779ab..faf0822470 100644 --- a/tests/offset/wire_unclosed_outside_0_005/C4 +++ b/tests/offset/wire_unclosed_outside_0_005/C4 @@ -2,7 +2,7 @@ restore [locate_data_file offset_wire_075.brep] s set length 308.604 -set nbsh_v 88 -set nbsh_e 88 +set nbsh_v 84 +set nbsh_e 84 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_025/A1 b/tests/offset/wire_unclosed_outside_0_025/A1 index 75e4470a08..8375d8be6d 100644 --- a/tests/offset/wire_unclosed_outside_0_025/A1 +++ b/tests/offset/wire_unclosed_outside_0_025/A1 @@ -5,8 +5,8 @@ puts "TODO ?OCC23748 ALL: Error: Offset is not done." restore [locate_data_file offset_wire_001.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 9.26702 +set nbsh_v 24 +set nbsh_e 24 +set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_025/A6 b/tests/offset/wire_unclosed_outside_0_025/A6 index 02d5f3a9ac..8ad67d1424 100644 --- a/tests/offset/wire_unclosed_outside_0_025/A6 +++ b/tests/offset/wire_unclosed_outside_0_025/A6 @@ -1,9 +1,7 @@ -puts "TODO OCC23068 ALL: Error : big tolerance of shape result_2" -puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG" restore [locate_data_file offset_wire_022.brep] s -set length 230.726 -set nbsh_v 50 -set nbsh_e 50 +set length 224.208 +set nbsh_v 49 +set nbsh_e 49 set nbsh_w 2 diff --git a/tests/offset/wire_unclosed_outside_0_025/A7 b/tests/offset/wire_unclosed_outside_0_025/A7 index d5c8369e6e..e6c04726b1 100644 --- a/tests/offset/wire_unclosed_outside_0_025/A7 +++ b/tests/offset/wire_unclosed_outside_0_025/A7 @@ -2,7 +2,7 @@ puts "TODO OCC23068 ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_024.brep] s set length 42.8997 -set nbsh_v 40 -set nbsh_e 40 +set nbsh_v 44 +set nbsh_e 44 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_025/B9 b/tests/offset/wire_unclosed_outside_0_025/B9 index e6751689fc..3b729a60aa 100644 --- a/tests/offset/wire_unclosed_outside_0_025/B9 +++ b/tests/offset/wire_unclosed_outside_0_025/B9 @@ -2,11 +2,13 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" puts "TODO ?OCC23748 ALL: Error: Offset is not done." +puts "TODO OCC24255 ALL: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO OCC24255 ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_071.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 121794 +set nbsh_v 205 +set nbsh_e 205 +set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_025/C4 b/tests/offset/wire_unclosed_outside_0_025/C4 index ddd9c94b46..8530879f71 100644 --- a/tests/offset/wire_unclosed_outside_0_025/C4 +++ b/tests/offset/wire_unclosed_outside_0_025/C4 @@ -2,7 +2,7 @@ restore [locate_data_file offset_wire_075.brep] s set length 326.251 -set nbsh_v 104 -set nbsh_e 104 +set nbsh_v 100 +set nbsh_e 100 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_075/A1 b/tests/offset/wire_unclosed_outside_0_075/A1 index c8ef21aa03..8bdffa6e34 100644 --- a/tests/offset/wire_unclosed_outside_0_075/A1 +++ b/tests/offset/wire_unclosed_outside_0_075/A1 @@ -7,8 +7,8 @@ puts "TODO OCC24156 MacOS: Error : The length of the resulting shape is" puts "TODO OCC24156 MacOS: Error : The resulting shape is WRONG" restore [locate_data_file offset_wire_001.brep] s -set length 0 -set nbsh_v 0 -set nbsh_e 0 -set nbsh_w 0 +set length 11.6898 +set nbsh_v 23 +set nbsh_e 23 +set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_075/A6 b/tests/offset/wire_unclosed_outside_0_075/A6 index 283a9af82b..56c2fdd601 100644 --- a/tests/offset/wire_unclosed_outside_0_075/A6 +++ b/tests/offset/wire_unclosed_outside_0_075/A6 @@ -1,11 +1,8 @@ -puts "TODO OCC23068 ALL: Error : big tolerance of shape result_2" -puts "TODO OCC23068 ALL: Error : The length of the resulting shape is" -puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG" restore [locate_data_file offset_wire_022.brep] s -set length 238.448 -set nbsh_v 40 -set nbsh_e 40 +set length 215.745 +set nbsh_v 39 +set nbsh_e 39 set nbsh_w 2 diff --git a/tests/offset/wire_unclosed_outside_0_075/A7 b/tests/offset/wire_unclosed_outside_0_075/A7 index 097b955b98..6cffb6bb68 100644 --- a/tests/offset/wire_unclosed_outside_0_075/A7 +++ b/tests/offset/wire_unclosed_outside_0_075/A7 @@ -2,7 +2,7 @@ puts "TODO OCC23068 ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_024.brep] s set length 49.1476 -set nbsh_v 40 -set nbsh_e 40 +set nbsh_v 44 +set nbsh_e 44 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_075/A8 b/tests/offset/wire_unclosed_outside_0_075/A8 index 0fca866670..718d3d9529 100755 --- a/tests/offset/wire_unclosed_outside_0_075/A8 +++ b/tests/offset/wire_unclosed_outside_0_075/A8 @@ -4,6 +4,6 @@ puts "TODO ?OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" restore [locate_data_file offset_wire_026.brep] s set length 25688.3 -set nbsh_v 319 -set nbsh_e 319 +set nbsh_v 315 +set nbsh_e 315 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_075/A9 b/tests/offset/wire_unclosed_outside_0_075/A9 index fecd86ebdb..53d6ea68b7 100755 --- a/tests/offset/wire_unclosed_outside_0_075/A9 +++ b/tests/offset/wire_unclosed_outside_0_075/A9 @@ -1,11 +1,12 @@ -puts "TODO OCC23068 ALL: Error : The length of the resulting shape is" -puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG" +#puts "TODO OCC23068 ALL: Error : The length of the resulting shape is" +#puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG" puts "TODO ?OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" +#puts "TODO OCC23068 ALL: Error : big tolerance of shape result" restore [locate_data_file offset_wire_027.brep] s -set length 80555.7 -set nbsh_v 217 -set nbsh_e 217 +set length 77744.9 +set nbsh_v 204 +set nbsh_e 204 set nbsh_w 1 diff --git a/tests/offset/wire_unclosed_outside_0_075/C4 b/tests/offset/wire_unclosed_outside_0_075/C4 index b508c5a788..938cc07530 100644 --- a/tests/offset/wire_unclosed_outside_0_075/C4 +++ b/tests/offset/wire_unclosed_outside_0_075/C4 @@ -2,8 +2,8 @@ restore [locate_data_file offset_wire_075.brep] s set length 368.064 -set nbsh_v 76 -set nbsh_e 76 +set nbsh_v 72 +set nbsh_e 72 set nbsh_w 1