From 47cbf134722ec0158b50f012bbe6f6734b55f531 Mon Sep 17 00:00:00 2001 From: dln Date: Wed, 12 Mar 2014 12:09:23 +0400 Subject: [PATCH] 0024727: Convertation of the generic classes to the non-generic. Part 3 1) Generic class "Intf_InterferencePolyhedron" from "Intf" package converted to the non-generic class and moved to the "IntPatch" package. Name of this class was changed to "IntPatch_InterferencePolyhedron". 2) Generic class "MoniTool_Elem" from "MoniTool" package converted to the non-generic class "MoniTool_TransientElem". 3) Generic class "IntWalk_PWalking" from "IntWalk" package converted to the non-generic class. And internal class "TheInt2S" of "IntWalk_PWalking" moved from IntWalk_PWalking.cdl to IntWalk.cdl for correct building. Also several "*.cxx" files of this class merged to one ".cxx". 4) Generic class "Transfer_SimpleBinder" from "Transfer" package converted to the non-generic class and moved to the "TransferBRep" package. Name of this class was changed to "TransferBRep_BinderOfShape". 5) Generic class "Geom2dInt_CurveTool" from "Geom2dInt" package converted to the non-generic class "Geom2dInt_Geom2dCurveTool". 6) Generic class "MAT2d_BisectingLocus" from "MAT2d" package converted to the non-generic class and moved to the "BRepMAT2d" package. Name of this class was changed to "BRepMAT2d_BisectingLocus". 7) Generic class "MAT_Mat" from "MAT" package converted to the non-generic class and moved to the "MAT2d" package. Name of this class was changed to "MAT2d_Mat2d". --- src/BRepMAT2d/BRepMAT2d.cdl | 9 +- .../BRepMAT2d_BisectingLocus.cdl} | 18 +- .../BRepMAT2d_BisectingLocus.cxx} | 28 +- src/ChFi3d/ChFi3d_Builder_0.cxx | 4 +- src/Geom2dInt/Geom2dInt.cdl | 7 +- ...Tool.cdl => Geom2dInt_Geom2dCurveTool.cdl} | 60 +- ...Tool.gxx => Geom2dInt_Geom2dCurveTool.cxx} | 8 +- ...Tool.lxx => Geom2dInt_Geom2dCurveTool.lxx} | 45 +- src/IntPatch/IntPatch.cdl | 15 +- .../IntPatch_InterferencePolyhedron.cdl} | 47 +- .../IntPatch_InterferencePolyhedron.cxx} | 193 +++-- src/IntPatch/IntPatch_PrmPrmIntersection.cxx | 22 +- src/IntWalk/FILES | 4 - src/IntWalk/IntWalk.cdl | 8 +- src/IntWalk/IntWalk_PWalking.cdl | 29 +- ...lk_PWalking_1.gxx => IntWalk_PWalking.cxx} | 809 +++++++++++++++--- src/IntWalk/IntWalk_PWalking.gxx | 24 - src/IntWalk/IntWalk_PWalking_2.gxx | 138 --- src/IntWalk/IntWalk_PWalking_3.gxx | 297 ------- src/IntWalk/IntWalk_PWalking_4.gxx | 176 ---- src/Intf/Intf.cdl | 5 - src/MAT/MAT.cdl | 5 - src/MAT2d/MAT2d.cdl | 9 +- .../MAT_Mat.cdl => MAT2d/MAT2d_Mat2d.cdl} | 17 +- .../MAT_Mat.gxx => MAT2d/MAT2d_Mat2d.cxx} | 27 +- src/MoniTool/MoniTool.cdl | 4 +- ...ol_Elem.cdl => MoniTool_TransientElem.cdl} | 29 +- ...ol_Elem.gxx => MoniTool_TransientElem.cxx} | 26 +- src/Transfer/Transfer.cdl | 1 - src/Transfer/Transfer_SimpleBinder.gxx | 48 -- src/TransferBRep/TransferBRep.cdl | 3 +- .../TransferBRep_BinderOfShape.cdl} | 36 +- .../TransferBRep_BinderOfShape.cxx | 47 + 33 files changed, 1042 insertions(+), 1156 deletions(-) rename src/{MAT2d/MAT2d_BisectingLocus.cdl => BRepMAT2d/BRepMAT2d_BisectingLocus.cdl} (95%) rename src/{MAT2d/MAT2d_BisectingLocus.gxx => BRepMAT2d/BRepMAT2d_BisectingLocus.cxx} (92%) rename src/Geom2dInt/{Geom2dInt_CurveTool.cdl => Geom2dInt_Geom2dCurveTool.cdl} (70%) rename src/Geom2dInt/{Geom2dInt_CurveTool.gxx => Geom2dInt_Geom2dCurveTool.cxx} (90%) rename src/Geom2dInt/{Geom2dInt_CurveTool.lxx => Geom2dInt_Geom2dCurveTool.lxx} (67%) rename src/{Intf/Intf_InterferencePolyhedron.cdl => IntPatch/IntPatch_InterferencePolyhedron.cdl} (73%) rename src/{Intf/Intf_InterferencePolyhedron.gxx => IntPatch/IntPatch_InterferencePolyhedron.cxx} (78%) rename src/IntWalk/{IntWalk_PWalking_1.gxx => IntWalk_PWalking.cxx} (72%) delete mode 100644 src/IntWalk/IntWalk_PWalking.gxx delete mode 100644 src/IntWalk/IntWalk_PWalking_2.gxx delete mode 100644 src/IntWalk/IntWalk_PWalking_3.gxx delete mode 100644 src/IntWalk/IntWalk_PWalking_4.gxx rename src/{MAT/MAT_Mat.cdl => MAT2d/MAT2d_Mat2d.cdl} (90%) rename src/{MAT/MAT_Mat.gxx => MAT2d/MAT2d_Mat2d.cxx} (98%) rename src/MoniTool/{MoniTool_Elem.cdl => MoniTool_TransientElem.cdl} (70%) rename src/MoniTool/{MoniTool_Elem.gxx => MoniTool_TransientElem.cxx} (53%) delete mode 100644 src/Transfer/Transfer_SimpleBinder.gxx rename src/{Transfer/Transfer_SimpleBinder.cdl => TransferBRep/TransferBRep_BinderOfShape.cdl} (75%) create mode 100644 src/TransferBRep/TransferBRep_BinderOfShape.cxx diff --git a/src/BRepMAT2d/BRepMAT2d.cdl b/src/BRepMAT2d/BRepMAT2d.cdl index 49829d89fe..5677c880a4 100644 --- a/src/BRepMAT2d/BRepMAT2d.cdl +++ b/src/BRepMAT2d/BRepMAT2d.cdl @@ -27,7 +27,8 @@ uses Geom2d, gp, TopoDS, - TopTools + TopTools, + Bisector is class Explorer; @@ -35,8 +36,10 @@ is -- bisecting locus from a Wire, a Face, or a set of -- curves from Geom2d. - class BisectingLocus instantiates BisectingLocus from MAT2d - (Explorer from BRepMAT2d); + class BisectingLocus; + ---Purpose: Constuction of the map of the bisector locus on a + -- set of geometrys from Geom2d. + ---Purpose: the map of bisecting locus. class LinkTopoBilo; diff --git a/src/MAT2d/MAT2d_BisectingLocus.cdl b/src/BRepMAT2d/BRepMAT2d_BisectingLocus.cdl similarity index 95% rename from src/MAT2d/MAT2d_BisectingLocus.cdl rename to src/BRepMAT2d/BRepMAT2d_BisectingLocus.cdl index 3ae4a9d173..a0f57fe989 100644 --- a/src/MAT2d/MAT2d_BisectingLocus.cdl +++ b/src/BRepMAT2d/BRepMAT2d_BisectingLocus.cdl @@ -14,8 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class BisectingLocus from MAT2d (Explorer as any) - -- as SketchExplorer from MAT2d +class BisectingLocus from BRepMAT2d ---Purpose : BisectingLocus generates and contains the Bisecting_Locus -- of a set of lines from Geom2d, defined by . @@ -48,7 +47,7 @@ generic class BisectingLocus from MAT2d (Explorer as any) -- -- The map of bisecting locus is described by a graph. -- - The BasicsElements correspond to elements on - -- the figure described by the Explorer. + -- the figure described by the Explorer from BRepMAT2d. -- - The Arcs correspond to the bisectors. -- - The Nodes are the extremities of the arcs. @@ -63,15 +62,16 @@ uses Bisec from Bisector, Geometry from Geom2d, Pnt2d from gp, - Tool2d from MAT2d + Tool2d from MAT2d, + Explorer from BRepMAT2d is - Create returns BisectingLocus from MAT2d; + Create returns BisectingLocus from BRepMAT2d; ---Category: Construction. Compute (me : in out ; - anExplo : in out Explorer; + anExplo : in out Explorer from BRepMAT2d; LineIndex : Integer = 1; aSide : Side from MAT = MAT_Left ) --- Purpose : Computation of the Bisector_Locus in a set of Lines @@ -161,9 +161,3 @@ fields end BisectingLocus; - - - - - - diff --git a/src/MAT2d/MAT2d_BisectingLocus.gxx b/src/BRepMAT2d/BRepMAT2d_BisectingLocus.cxx similarity index 92% rename from src/MAT2d/MAT2d_BisectingLocus.gxx rename to src/BRepMAT2d/BRepMAT2d_BisectingLocus.cxx index dc54690b87..11aef2052b 100644 --- a/src/MAT2d/MAT2d_BisectingLocus.gxx +++ b/src/BRepMAT2d/BRepMAT2d_BisectingLocus.cxx @@ -14,6 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +# include + # include # include # include @@ -40,10 +42,10 @@ static void CutSketch (MAT2d_SequenceOfSequenceOfGeometry& Figure, //============================================================================= -//function : MAT2d_BisectingLocus +//function : BRepMAT2d_BisectingLocus //purpose : Constructeur vide. //============================================================================= -MAT2d_BisectingLocus::MAT2d_BisectingLocus() +BRepMAT2d_BisectingLocus::BRepMAT2d_BisectingLocus() { } @@ -53,7 +55,7 @@ MAT2d_BisectingLocus::MAT2d_BisectingLocus() //purpose : Calcul de la carte des lieux bisecteurs sur le contour defini par // . //============================================================================= -void MAT2d_BisectingLocus::Compute( Explorer& anExplo, +void BRepMAT2d_BisectingLocus::Compute( BRepMAT2d_Explorer& anExplo, const Standard_Integer IndexLine, const MAT_Side aSide ) { @@ -150,7 +152,7 @@ void MAT2d_BisectingLocus::Compute( Explorer& anExplo, //function : RenumerationAndFusion //purpose : //============================================================================= -void MAT2d_BisectingLocus::RenumerationAndFusion +void BRepMAT2d_BisectingLocus::RenumerationAndFusion (const Standard_Integer ILine, const Standard_Integer LengthLine, Standard_Integer& IndexLast, @@ -191,7 +193,7 @@ void MAT2d_BisectingLocus::RenumerationAndFusion //function : IsDone //Purpose : //============================================================================= -Standard_Boolean MAT2d_BisectingLocus::IsDone() const +Standard_Boolean BRepMAT2d_BisectingLocus::IsDone() const { return isDone; } @@ -200,7 +202,7 @@ Standard_Boolean MAT2d_BisectingLocus::IsDone() const //function : Graph // //============================================================================= -Handle(MAT_Graph) MAT2d_BisectingLocus::Graph() const +Handle(MAT_Graph) BRepMAT2d_BisectingLocus::Graph() const { return theGraph; } @@ -209,7 +211,7 @@ Handle(MAT_Graph) MAT2d_BisectingLocus::Graph() const //function : NumberOfContours // //============================================================================= -Standard_Integer MAT2d_BisectingLocus::NumberOfContours () const +Standard_Integer BRepMAT2d_BisectingLocus::NumberOfContours () const { return nbContours; } @@ -218,7 +220,7 @@ Standard_Integer MAT2d_BisectingLocus::NumberOfContours () const //function : NumberOfElts // //============================================================================= -Standard_Integer MAT2d_BisectingLocus::NumberOfElts +Standard_Integer BRepMAT2d_BisectingLocus::NumberOfElts (const Standard_Integer IndLine) const { return theTool.Circuit()->LineLength(IndLine); @@ -228,7 +230,7 @@ Standard_Integer MAT2d_BisectingLocus::NumberOfElts //function : NumberOfSect // //============================================================================= -Standard_Integer MAT2d_BisectingLocus::NumberOfSections +Standard_Integer BRepMAT2d_BisectingLocus::NumberOfSections (const Standard_Integer IndLine, const Standard_Integer Index ) const @@ -241,7 +243,7 @@ Standard_Integer MAT2d_BisectingLocus::NumberOfSections //function : BasicElt // //============================================================================= -Handle(MAT_BasicElt) MAT2d_BisectingLocus::BasicElt +Handle(MAT_BasicElt) BRepMAT2d_BisectingLocus::BasicElt (const Standard_Integer IndLine, const Standard_Integer Index ) const @@ -260,7 +262,7 @@ Handle(MAT_BasicElt) MAT2d_BisectingLocus::BasicElt //function : GeomBis // //============================================================================= -Bisector_Bisec MAT2d_BisectingLocus::GeomBis (const Handle(MAT_Arc)& anArc, +Bisector_Bisec BRepMAT2d_BisectingLocus::GeomBis (const Handle(MAT_Arc)& anArc, Standard_Boolean& Reverse) const { @@ -285,7 +287,7 @@ const //function : GeomElt // //============================================================================= -Handle(Geom2d_Geometry) MAT2d_BisectingLocus::GeomElt +Handle(Geom2d_Geometry) BRepMAT2d_BisectingLocus::GeomElt (const Handle(MAT_BasicElt)& aBasicElt) const { return theTool.GeomElt(aBasicElt->GeomIndex()); @@ -296,7 +298,7 @@ Handle(Geom2d_Geometry) MAT2d_BisectingLocus::GeomElt //function : GeomElt // //============================================================================= -gp_Pnt2d MAT2d_BisectingLocus::GeomElt(const Handle(MAT_Node)& aNode) const +gp_Pnt2d BRepMAT2d_BisectingLocus::GeomElt(const Handle(MAT_Node)& aNode) const { return theTool.GeomPnt(aNode->GeomIndex()); } diff --git a/src/ChFi3d/ChFi3d_Builder_0.cxx b/src/ChFi3d/ChFi3d_Builder_0.cxx index 54f377d801..a034b75382 100644 --- a/src/ChFi3d/ChFi3d_Builder_0.cxx +++ b/src/ChFi3d/ChFi3d_Builder_0.cxx @@ -119,7 +119,7 @@ #include #include #include -#include +#include #include #include #include @@ -3314,7 +3314,7 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1, //Builder, so they are reestimated as much as possible. Standard_Real fleche = 1.e-3 * pdeb.Distance(pfin); Standard_Real tolap = 1.e-7; - IntPatch_ThePWalkingInter + IntWalk_PWalking IntKK(S1,S2,tol3d,tol3d,fleche,Step); //The extremities of the intersection (Pardeb,Parfin) are known, diff --git a/src/Geom2dInt/Geom2dInt.cdl b/src/Geom2dInt/Geom2dInt.cdl index 8211606947..437527849d 100644 --- a/src/Geom2dInt/Geom2dInt.cdl +++ b/src/Geom2dInt/Geom2dInt.cdl @@ -24,14 +24,11 @@ package Geom2dInt -- -uses Standard, gp, TColStd, GeomAbs, Geom2d, Adaptor3d,Adaptor2d, IntCurve +uses Standard, gp, TColStd, GeomAbs, Geom2d, Adaptor3d, Adaptor2d, IntCurve is - generic class CurveTool; - - class Geom2dCurveTool instantiates CurveTool from Geom2dInt - (Curve2d from Adaptor2d); + class Geom2dCurveTool; class GInter instantiates IntCurveCurveGen from IntCurve (Curve2d from Adaptor2d, diff --git a/src/Geom2dInt/Geom2dInt_CurveTool.cdl b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cdl similarity index 70% rename from src/Geom2dInt/Geom2dInt_CurveTool.cdl rename to src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cdl index cee39c90c2..9475f1c4c4 100644 --- a/src/Geom2dInt/Geom2dInt_CurveTool.cdl +++ b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cdl @@ -14,12 +14,11 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class CurveTool from Geom2dInt ( - IntCurveCurve as any) - +class Geom2dCurveTool from Geom2dInt + - ---Purpose: This class provides a CurveTool as < CurveTool from IntCurve > - -- from a Tool as < CurveTool from Adaptor3d > . + ---Purpose: This class provides a Geom2dCurveTool as < Geom2dCurveTool from IntCurve > + -- from a Tool as < Geom2dCurveTool from Adaptor3d > . uses @@ -31,21 +30,22 @@ uses Parab2d from gp, Hypr2d from gp, Array1OfReal from TColStd, - CurveType from GeomAbs + CurveType from GeomAbs, + Curve2d from Adaptor2d is - GetType(myclass; C: IntCurveCurve) + GetType(myclass; C: Curve2d from Adaptor2d) ---C++: inline returns CurveType from GeomAbs; - IsComposite(myclass; C: IntCurveCurve) + IsComposite(myclass; C: Curve2d from Adaptor2d) ---C++: inline returns Boolean from Standard; - Line(myclass; C: IntCurveCurve) + Line(myclass; C: Curve2d from Adaptor2d) ---Purpose: Returns the Lin2d from gp corresponding to the curve C. -- This method is called only when TheType returns @@ -54,7 +54,7 @@ is returns Lin2d from gp; - Circle(myclass; C: IntCurveCurve) + Circle(myclass; C: Curve2d from Adaptor2d) ---Purpose: Returns the Circ2d from gp corresponding to the curve C. -- This method is called only when TheType returns @@ -63,7 +63,7 @@ is returns Circ2d from gp; - Ellipse(myclass; C: IntCurveCurve) + Ellipse(myclass; C: Curve2d from Adaptor2d) ---Purpose: Returns the Elips2d from gp corresponding to the curve C. -- This method is called only when TheType returns @@ -72,7 +72,7 @@ is returns Elips2d from gp; - Parabola(myclass; C: IntCurveCurve) + Parabola(myclass; C: Curve2d from Adaptor2d) ---Purpose: Returns the Parab2d from gp corresponding to the curve C. -- This method is called only when TheType returns @@ -81,7 +81,7 @@ is returns Parab2d from gp; - Hyperbola(myclass; C: IntCurveCurve) + Hyperbola(myclass; C: Curve2d from Adaptor2d) ---Purpose: Returns the Hypr2d from gp corresponding to the curve C. -- This method is called only when TheType returns @@ -93,73 +93,73 @@ is -- The following method are used only when TheType returns IntCurve_Other. - EpsX (myclass; C: IntCurveCurve) + EpsX (myclass; C: Curve2d from Adaptor2d) ---C++: inline returns Real; - EpsX (myclass; C: IntCurveCurve; + EpsX (myclass; C: Curve2d from Adaptor2d; Eps_XYZ : Real from Standard) ---C++: inline returns Real; - NbSamples(myclass; C: IntCurveCurve) + NbSamples(myclass; C: Curve2d from Adaptor2d) returns Integer; - NbSamples(myclass; C: IntCurveCurve; U0,U1: Real from Standard) + NbSamples(myclass; C: Curve2d from Adaptor2d; U0,U1: Real from Standard) returns Integer; - FirstParameter(myclass; C:IntCurveCurve) + FirstParameter(myclass; C:Curve2d from Adaptor2d) ---C++: inline returns Real; - LastParameter(myclass; C:IntCurveCurve) + LastParameter(myclass; C:Curve2d from Adaptor2d) ---C++: inline returns Real; - Value (myclass; C: IntCurveCurve; X: Real) + Value (myclass; C: Curve2d from Adaptor2d; X: Real) ---C++: inline returns Pnt2d from gp; - D0 (myclass; C: IntCurveCurve; U: Real ; + D0 (myclass; C: Curve2d from Adaptor2d; U: Real ; P: out Pnt2d); ---C++: inline - D1 (myclass; C: IntCurveCurve; U: Real ; + D1 (myclass; C: Curve2d from Adaptor2d; U: Real ; P: out Pnt2d; T: out Vec2d); ---C++: inline - D2 (myclass; C: IntCurveCurve; U: Real ; + D2 (myclass; C: Curve2d from Adaptor2d; U: Real ; P: out Pnt2d; T,N: out Vec2d); ---C++: inline - D3 (myclass; C: IntCurveCurve; U: Real ; + D3 (myclass; C: Curve2d from Adaptor2d; U: Real ; P: out Pnt2d; T,N,V: out Vec2d); ---C++: inline - DN(myclass; C: IntCurveCurve; U: Real ; + DN(myclass; C: Curve2d from Adaptor2d; U: Real ; N: Integer from Standard) returns Vec2d; ---C++: inline - NbIntervals(myclass ; C: IntCurveCurve) + NbIntervals(myclass ; C: Curve2d from Adaptor2d) ---Purpose : output the number of interval of continuity C2 of -- the curve ---C++: inline returns Integer from Standard; - Intervals (myclass; C: IntCurveCurve + Intervals (myclass; C: Curve2d from Adaptor2d ; Tab : out Array1OfReal from TColStd); ---Purpose: compute Tab. ---C++: inline - GetInterval (myclass; C: IntCurveCurve + GetInterval (myclass; C: Curve2d from Adaptor2d ; Index : Integer from Standard ; Tab : Array1OfReal from TColStd ; U1, U2 : out Real from Standard); @@ -167,11 +167,11 @@ is -- used if Type == Composite. ---C++: inline - Degree(myclass; C : IntCurveCurve) returns Integer from Standard; + Degree(myclass; C : Curve2d from Adaptor2d) returns Integer from Standard; ---C++: inline -end CurveTool; +end Geom2dCurveTool; diff --git a/src/Geom2dInt/Geom2dInt_CurveTool.gxx b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx similarity index 90% rename from src/Geom2dInt/Geom2dInt_CurveTool.gxx rename to src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx index 41d7114e05..5c1633ac73 100644 --- a/src/Geom2dInt/Geom2dInt_CurveTool.gxx +++ b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx @@ -14,14 +14,18 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include #include #include #include +#include + //============================================================ -Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C, +Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& C, const Standard_Real U0, const Standard_Real U1) { GeomAbs_CurveType typC = C.GetType(); @@ -51,7 +55,7 @@ Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C, return((Standard_Integer)nbs); } //============================================================ -Standard_Integer Geom2dInt_CurveTool::NbSamples (const IntCurveCurve& C) { +Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& C) { GeomAbs_CurveType typC = C.GetType(); static Standard_Real nbsOther = 10.0; Standard_Real nbs = nbsOther; diff --git a/src/Geom2dInt/Geom2dInt_CurveTool.lxx b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.lxx similarity index 67% rename from src/Geom2dInt/Geom2dInt_CurveTool.lxx rename to src/Geom2dInt/Geom2dInt_Geom2dCurveTool.lxx index 3db9ed0b48..2d33555ea3 100644 --- a/src/Geom2dInt/Geom2dInt_CurveTool.lxx +++ b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.lxx @@ -14,8 +14,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include IntCurveCurve_hxx - #include #include @@ -26,52 +24,53 @@ #include #include +#include #define IS_C2_COMPOSITE 0 //============================================================ -inline GeomAbs_CurveType Geom2dInt_CurveTool::GetType(const IntCurveCurve& C) { +inline GeomAbs_CurveType Geom2dInt_Geom2dCurveTool::GetType(const Adaptor2d_Curve2d& C) { return(C.GetType()); } //============================================================ -inline gp_Lin2d Geom2dInt_CurveTool::Line (const IntCurveCurve& C) { +inline gp_Lin2d Geom2dInt_Geom2dCurveTool::Line (const Adaptor2d_Curve2d& C) { return(C.Line()); } //============================================================ -inline gp_Circ2d Geom2dInt_CurveTool::Circle (const IntCurveCurve& C) { +inline gp_Circ2d Geom2dInt_Geom2dCurveTool::Circle (const Adaptor2d_Curve2d& C) { return(C.Circle()); } //============================================================ -inline gp_Elips2d Geom2dInt_CurveTool::Ellipse (const IntCurveCurve& C) { +inline gp_Elips2d Geom2dInt_Geom2dCurveTool::Ellipse (const Adaptor2d_Curve2d& C) { return(C.Ellipse()); } //============================================================ -inline gp_Parab2d Geom2dInt_CurveTool::Parabola (const IntCurveCurve& C) { +inline gp_Parab2d Geom2dInt_Geom2dCurveTool::Parabola (const Adaptor2d_Curve2d& C) { return(C.Parabola()); } //============================================================ -inline gp_Hypr2d Geom2dInt_CurveTool::Hyperbola (const IntCurveCurve& C) { +inline gp_Hypr2d Geom2dInt_Geom2dCurveTool::Hyperbola (const Adaptor2d_Curve2d& C) { return(C.Hyperbola()); } //============================================================ -inline gp_Pnt2d Geom2dInt_CurveTool::Value (const IntCurveCurve& C, +inline gp_Pnt2d Geom2dInt_Geom2dCurveTool::Value (const Adaptor2d_Curve2d& C, const Standard_Real U) { return(C.Value(U)); } //============================================================ -inline void Geom2dInt_CurveTool::D0(const IntCurveCurve& C, +inline void Geom2dInt_Geom2dCurveTool::D0(const Adaptor2d_Curve2d& C, const Standard_Real U, gp_Pnt2d& P) { C.D0(U,P); } //============================================================ -inline void Geom2dInt_CurveTool::D1 (const IntCurveCurve& C, +inline void Geom2dInt_Geom2dCurveTool::D1 (const Adaptor2d_Curve2d& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& T) { C.D1(U,P,T); } //============================================================ -inline void Geom2dInt_CurveTool::D2 (const IntCurveCurve& C, +inline void Geom2dInt_Geom2dCurveTool::D2 (const Adaptor2d_Curve2d& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& T, @@ -81,7 +80,7 @@ inline void Geom2dInt_CurveTool::D2 (const IntCurveCurve& C, } //============================================================ -inline void Geom2dInt_CurveTool::D3 (const IntCurveCurve& C, +inline void Geom2dInt_Geom2dCurveTool::D3 (const Adaptor2d_Curve2d& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& T, @@ -91,7 +90,7 @@ inline void Geom2dInt_CurveTool::D3 (const IntCurveCurve& C, C.D3(U,P,T,N,V); } //============================================================ -inline gp_Vec2d Geom2dInt_CurveTool::DN(const Adaptor2d_Curve2d& C, +inline gp_Vec2d Geom2dInt_Geom2dCurveTool::DN(const Adaptor2d_Curve2d& C, const Standard_Real U, const Standard_Integer N) { @@ -99,25 +98,25 @@ inline gp_Vec2d Geom2dInt_CurveTool::DN(const Adaptor2d_Curve2d& C, } //============================================================ -inline Standard_Real Geom2dInt_CurveTool::FirstParameter (const IntCurveCurve& C) { +inline Standard_Real Geom2dInt_Geom2dCurveTool::FirstParameter (const Adaptor2d_Curve2d& C) { return(C.FirstParameter()); } //============================================================ -inline Standard_Real Geom2dInt_CurveTool::LastParameter (const IntCurveCurve& C) { +inline Standard_Real Geom2dInt_Geom2dCurveTool::LastParameter (const Adaptor2d_Curve2d& C) { return(C.LastParameter()); } //============================================================ //== tolerance used by mathemetical algorithms //== -inline Standard_Real Geom2dInt_CurveTool::EpsX (const IntCurveCurve& ) { +inline Standard_Real Geom2dInt_Geom2dCurveTool::EpsX (const Adaptor2d_Curve2d& ) { return(1.0e-10); } //------------------------------------------------------------ -inline Standard_Real Geom2dInt_CurveTool::EpsX (const IntCurveCurve& C,const Standard_Real Eps_XYZ) { +inline Standard_Real Geom2dInt_Geom2dCurveTool::EpsX (const Adaptor2d_Curve2d& C,const Standard_Real Eps_XYZ) { return(C.Resolution(Eps_XYZ)); } //============================================================ -inline void Geom2dInt_CurveTool::Intervals(const IntCurveCurve& C, +inline void Geom2dInt_Geom2dCurveTool::Intervals(const Adaptor2d_Curve2d& C, TColStd_Array1OfReal& Tab) { #if IS_C2_COMPOSITE C.Intervals(Tab,GeomAbs_C2); @@ -126,8 +125,8 @@ inline void Geom2dInt_CurveTool::Intervals(const IntCurveCurve& C, #endif } //============================================================ -//inline void Geom2dInt_CurveTool::GetInterval(const IntCurveCurve& C, -inline void Geom2dInt_CurveTool::GetInterval(const IntCurveCurve& , +//inline void Geom2dInt_Geom2dCurveTool::GetInterval(const Adaptor2d_Curve2d& C, +inline void Geom2dInt_Geom2dCurveTool::GetInterval(const Adaptor2d_Curve2d& , const Standard_Integer i, const TColStd_Array1OfReal& Tab, Standard_Real& a, @@ -136,7 +135,7 @@ inline void Geom2dInt_CurveTool::GetInterval(const IntCurveCurve& , b = Tab.Value(i+1); } //============================================================ -inline Standard_Integer Geom2dInt_CurveTool::NbIntervals(const IntCurveCurve& C) { +inline Standard_Integer Geom2dInt_Geom2dCurveTool::NbIntervals(const Adaptor2d_Curve2d& C) { Standard_Integer N=1; #if IS_C2_COMPOSITE N = C.NbIntervals(GeomAbs_C2); @@ -147,7 +146,7 @@ inline Standard_Integer Geom2dInt_CurveTool::NbIntervals(const IntCurveCurve& C) } //============================================================ - inline Standard_Integer Geom2dInt_CurveTool::Degree(const IntCurveCurve& C) + inline Standard_Integer Geom2dInt_Geom2dCurveTool::Degree(const Adaptor2d_Curve2d& C) { return C.Degree(); } diff --git a/src/IntPatch/IntPatch.cdl b/src/IntPatch/IntPatch.cdl index 1c85071a81..dfd821696a 100644 --- a/src/IntPatch/IntPatch.cdl +++ b/src/IntPatch/IntPatch.cdl @@ -48,6 +48,11 @@ is class RLine; -- inherits Line from IntPatch class ArcFunction; + + class InterferencePolyhedron; + ---Purpose: Compute the interference between two polyhedron. Points + -- of intersection , polylines of intersection and zones of + -- tangence. -- implicite/implicite @@ -141,16 +146,6 @@ is TopolTool from Adaptor3d, ArcFunction from IntPatch); - class TheInterfPolyhedron instantiates InterferencePolyhedron from Intf( - Polyhedron from IntPatch, - PolyhedronTool from IntPatch, - Polyhedron from IntPatch, - PolyhedronTool from IntPatch); - - class ThePWalkingInter instantiates PWalking from IntWalk( - HSurface from Adaptor3d, - HSurfaceTool from Adaptor3d); - alias SearchPnt is InterferencePolygon2d from Intf; class CSFunction instantiates ZerCOnSSParFunc from IntImp diff --git a/src/Intf/Intf_InterferencePolyhedron.cdl b/src/IntPatch/IntPatch_InterferencePolyhedron.cdl similarity index 73% rename from src/Intf/Intf_InterferencePolyhedron.cdl rename to src/IntPatch/IntPatch_InterferencePolyhedron.cdl index 58a9a32ed1..7b08e3fc6b 100644 --- a/src/Intf/Intf_InterferencePolyhedron.cdl +++ b/src/IntPatch/IntPatch_InterferencePolyhedron.cdl @@ -14,12 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class InterferencePolyhedron from Intf - (Polyhedron1 as any; - ToolPolyhe1 as any; - Polyhedron2 as any; - ToolPolyhe2 as any) - inherits Interference from Intf +class InterferencePolyhedron from IntPatch inherits Interference from Intf ---Purpose: Computes the interference between two polyhedra or the -- self interference of a polyhedron. @@ -32,43 +27,45 @@ uses Pnt from gp, SectionLine from Intf, SeqOfSectionLine from Intf, TangentZone from Intf, - SeqOfTangentZone from Intf + SeqOfTangentZone from Intf, + Polyhedron from IntPatch, + PolyhedronTool from IntPatch is -- Interface : - Create returns InterferencePolyhedron from Intf; + Create returns InterferencePolyhedron from IntPatch; ---Purpose: Constructs an empty interference of Polyhedron. - Create (Obje1 : in Polyhedron1; - Obje2 : in Polyhedron2) - returns InterferencePolyhedron from Intf; + Create (Obje1 : in Polyhedron from IntPatch; + Obje2 : in Polyhedron from IntPatch) + returns InterferencePolyhedron from IntPatch; ---Purpose: Constructs and computes an interference between the two -- Polyhedra. - Create (Obje : in Polyhedron1) - returns InterferencePolyhedron from Intf; + Create (Obje : in Polyhedron from IntPatch) + returns InterferencePolyhedron from IntPatch; ---Purpose: Constructs and computes the self interference of a -- Polyhedron. Perform (me : in out; - Obje1 : in Polyhedron1; - Obje2 : in Polyhedron2); + Obje1 : in Polyhedron from IntPatch; + Obje2 : in Polyhedron from IntPatch); ---Purpose: Computes the interference between the two Polyhedra. Perform (me : in out; - Obje : in Polyhedron1); + Obje : in Polyhedron from IntPatch); ---Purpose: Computes the self interference of a Polyhedron. -- Implementation : Interference (me : in out; - Obje1 : in Polyhedron1) + Obje1 : in Polyhedron from IntPatch) is private; Interference (me : in out; - Obje1 : in Polyhedron1; - Obje2 : in Polyhedron2) + Obje1 : in Polyhedron from IntPatch; + Obje2 : in Polyhedron from IntPatch) is private; ---Purpose: Compares the bounding volumes between the facets of -- and the facets of and intersects the facets when the @@ -76,9 +73,9 @@ is Intersect (me : in out; TriF : in Integer from Standard; - Obje1 : in Polyhedron1; + Obje1 : in Polyhedron from IntPatch; TriS : in Integer from Standard; - Obje2 : in Polyhedron2) + Obje2 : in Polyhedron from IntPatch) is private; ---Purpose: Computes the intersection between the facet of -- and the facet of . @@ -86,9 +83,9 @@ is TangentZoneValue (me; TheTZ : in out TangentZone from Intf; - Obje1 : Polyhedron1; + Obje1 : Polyhedron from IntPatch; Tri1 : Integer from Standard; - Obje2 : Polyhedron2; + Obje2 : Polyhedron from IntPatch; Tri2 : Integer from Standard) returns Boolean from Standard is private; @@ -96,8 +93,8 @@ is -- and the facet of . CoupleCharacteristics (me: in out; - FirstPol: Polyhedron1; - SeconPol: Polyhedron2) is private; + FirstPol: Polyhedron from IntPatch; + SeconPol: Polyhedron from IntPatch) is private; fields OI : Integer from Standard[3]; -- index des sommets de l objet TI : Integer from Standard[3]; -- index des sommets du tool diff --git a/src/Intf/Intf_InterferencePolyhedron.gxx b/src/IntPatch/IntPatch_InterferencePolyhedron.cxx similarity index 78% rename from src/Intf/Intf_InterferencePolyhedron.gxx rename to src/IntPatch/IntPatch_InterferencePolyhedron.cxx index 130b59aaed..a28cd38ee1 100644 --- a/src/Intf/Intf_InterferencePolyhedron.gxx +++ b/src/IntPatch/IntPatch_InterferencePolyhedron.cxx @@ -14,6 +14,11 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + +#include +#include + #include #include #include @@ -32,27 +37,27 @@ static const int Pourcent3[9] = {0, 1, 2, 0, 1, 2, 0, 1, 2}; //======================================================================= -//function : Intf_InterferencePolyhedron +//function : IntPatch_InterferencePolyhedron //purpose : Empty constructor. //======================================================================= -Intf_InterferencePolyhedron::Intf_InterferencePolyhedron () +IntPatch_InterferencePolyhedron::IntPatch_InterferencePolyhedron () : Intf_Interference(Standard_False) {} //======================================================================= -//function : Intf_InterferencePolyhedron +//function : IntPatch_InterferencePolyhedron //purpose : //======================================================================= -Intf_InterferencePolyhedron::Intf_InterferencePolyhedron - (const Polyhedron1& FirstPol, const Polyhedron2& SeconPol) +IntPatch_InterferencePolyhedron::IntPatch_InterferencePolyhedron + (const IntPatch_Polyhedron& FirstPol, const IntPatch_Polyhedron& SeconPol) : Intf_Interference(Standard_False) { - if (!ToolPolyhe1::Bounding(FirstPol).IsOut - (ToolPolyhe2::Bounding(SeconPol))) { - Tolerance=ToolPolyhe1::DeflectionOverEstimation(FirstPol)+ - ToolPolyhe2::DeflectionOverEstimation(SeconPol); + if (!IntPatch_PolyhedronTool::Bounding(FirstPol).IsOut + (IntPatch_PolyhedronTool::Bounding(SeconPol))) { + Tolerance=IntPatch_PolyhedronTool::DeflectionOverEstimation(FirstPol)+ + IntPatch_PolyhedronTool::DeflectionOverEstimation(SeconPol); if (Tolerance==0.) Tolerance=Epsilon(1000.); Interference(FirstPol, SeconPol); @@ -60,15 +65,15 @@ Intf_InterferencePolyhedron::Intf_InterferencePolyhedron } //======================================================================= -//function : Intf_InterferencePolyhedron +//function : IntPatch_InterferencePolyhedron //purpose : //======================================================================= -Intf_InterferencePolyhedron::Intf_InterferencePolyhedron - (const Polyhedron1& Objet) +IntPatch_InterferencePolyhedron::IntPatch_InterferencePolyhedron + (const IntPatch_Polyhedron& Objet) : Intf_Interference(Standard_True) { - Tolerance=ToolPolyhe1::DeflectionOverEstimation(Objet)*2; + Tolerance=IntPatch_PolyhedronTool::DeflectionOverEstimation(Objet)*2; if (Tolerance==0.) Tolerance=Epsilon(1000.); Interference(Objet,Objet); //-- lbr le 5 juillet 96 @@ -80,14 +85,14 @@ Intf_InterferencePolyhedron::Intf_InterferencePolyhedron //purpose : //======================================================================= -void Intf_InterferencePolyhedron::Perform - (const Polyhedron1& FirstPol, const Polyhedron2& SeconPol) +void IntPatch_InterferencePolyhedron::Perform + (const IntPatch_Polyhedron& FirstPol, const IntPatch_Polyhedron& SeconPol) { SelfInterference(Standard_False); - if (!ToolPolyhe1::Bounding(FirstPol).IsOut - (ToolPolyhe2::Bounding(SeconPol))) { - Tolerance=ToolPolyhe1::DeflectionOverEstimation(FirstPol)+ - ToolPolyhe2::DeflectionOverEstimation(SeconPol); + if (!IntPatch_PolyhedronTool::Bounding(FirstPol).IsOut + (IntPatch_PolyhedronTool::Bounding(SeconPol))) { + Tolerance=IntPatch_PolyhedronTool::DeflectionOverEstimation(FirstPol)+ + IntPatch_PolyhedronTool::DeflectionOverEstimation(SeconPol); if (Tolerance==0.) Tolerance=Epsilon(1000.); Interference(FirstPol, SeconPol); @@ -99,11 +104,11 @@ void Intf_InterferencePolyhedron::Perform //purpose : //======================================================================= -void Intf_InterferencePolyhedron::Perform - (const Polyhedron1& Objet) +void IntPatch_InterferencePolyhedron::Perform + (const IntPatch_Polyhedron& Objet) { SelfInterference(Standard_True); - Tolerance=ToolPolyhe1::DeflectionOverEstimation(Objet)*2; + Tolerance=IntPatch_PolyhedronTool::DeflectionOverEstimation(Objet)*2; if (Tolerance==0.) Tolerance=Epsilon(1000.); Interference(Objet); @@ -115,16 +120,16 @@ void Intf_InterferencePolyhedron::Perform //purpose : //======================================================================= -void Intf_InterferencePolyhedron::Interference - (const Polyhedron1&) +void IntPatch_InterferencePolyhedron::Interference + (const IntPatch_Polyhedron&) {} -void Intf_InterferencePolyhedron::Interference - (const Polyhedron1& FirstPol, const Polyhedron2& SeconPol) +void IntPatch_InterferencePolyhedron::Interference + (const IntPatch_Polyhedron& FirstPol, const IntPatch_Polyhedron& SeconPol) { Standard_Boolean gridOnFirst=Standard_True; - Standard_Integer NbTrianglesFirstPol = ToolPolyhe1::NbTriangles(FirstPol); - Standard_Integer NbTrianglesSecondPol = ToolPolyhe2::NbTriangles(SeconPol); + Standard_Integer NbTrianglesFirstPol = IntPatch_PolyhedronTool::NbTriangles(FirstPol); + Standard_Integer NbTrianglesSecondPol = IntPatch_PolyhedronTool::NbTriangles(SeconPol); Standard_Integer iFirst, iSecon; //------------------------------------------------------------------------------------------ @@ -140,10 +145,10 @@ void Intf_InterferencePolyhedron::Interference if(NbTrianglesFirstPol > NbTrianglesSecondPol+NbTrianglesSecondPol) gridOnFirst=Standard_False; Standard_Real vol1,vol2,Xmin, Ymin, Zmin, Xmax, Ymax, Zmax; - ToolPolyhe1::Bounding(FirstPol).Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); + IntPatch_PolyhedronTool::Bounding(FirstPol).Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); vol1 = (Xmax-Xmin)*(Ymax-Ymin)*(Zmax-Zmin); - ToolPolyhe1::Bounding(SeconPol).Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); + IntPatch_PolyhedronTool::Bounding(SeconPol).Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); vol2 = (Xmax-Xmin)*(Ymax-Ymin)*(Zmax-Zmin); if(vol1> 8.0*vol2) gridOnFirst=Standard_False; @@ -152,13 +157,13 @@ void Intf_InterferencePolyhedron::Interference if (gridOnFirst) { Bnd_BoundSortBox TheGridFirst; - TheGridFirst.Initialize(ToolPolyhe1::Bounding(FirstPol), - ToolPolyhe1::ComponentsBounding(FirstPol)); + TheGridFirst.Initialize(IntPatch_PolyhedronTool::Bounding(FirstPol), + IntPatch_PolyhedronTool::ComponentsBounding(FirstPol)); for (iSecon=1; iSecon<=NbTrianglesSecondPol; iSecon++) { TColStd_ListIteratorOfListOfInteger iLoI(TheGridFirst.Compare - (ToolPolyhe2::ComponentsBounding(SeconPol)->Value(iSecon))); + (IntPatch_PolyhedronTool::ComponentsBounding(SeconPol)->Value(iSecon))); while (iLoI.More()) { iFirst=iLoI.Value(); if (SelfIntf) { @@ -174,13 +179,13 @@ void Intf_InterferencePolyhedron::Interference else { Bnd_BoundSortBox TheGridSecond; - TheGridSecond.Initialize(ToolPolyhe2::Bounding(SeconPol), - ToolPolyhe2::ComponentsBounding(SeconPol)); + TheGridSecond.Initialize(IntPatch_PolyhedronTool::Bounding(SeconPol), + IntPatch_PolyhedronTool::ComponentsBounding(SeconPol)); for (iFirst=1; iFirst<=NbTrianglesFirstPol; iFirst++) { TColStd_ListIteratorOfListOfInteger iLoI(TheGridSecond.Compare - (ToolPolyhe1::ComponentsBounding(FirstPol)->Value(iFirst))); + (IntPatch_PolyhedronTool::ComponentsBounding(FirstPol)->Value(iFirst))); while (iLoI.More()) { iSecon=iLoI.Value(); @@ -202,12 +207,12 @@ void Intf_InterferencePolyhedron::Interference //purpose : Intersection of two triangles issue from two Polyhedron. //======================================================================= -void Intf_InterferencePolyhedron::Intersect -(const Standard_Integer Tri1, const Polyhedron1& FirstPol, - const Standard_Integer Tri2, const Polyhedron2& SeconPol) +void IntPatch_InterferencePolyhedron::Intersect +(const Standard_Integer Tri1, const IntPatch_Polyhedron& FirstPol, + const Standard_Integer Tri2, const IntPatch_Polyhedron& SeconPol) { - ToolPolyhe1::Triangle(FirstPol, Tri1,OI[0],OI[1],OI[2]); - ToolPolyhe2::Triangle(SeconPol, Tri2,TI[0],TI[1],TI[2]); + IntPatch_PolyhedronTool::Triangle(FirstPol, Tri1,OI[0],OI[1],OI[2]); + IntPatch_PolyhedronTool::Triangle(SeconPol, Tri2,TI[0],TI[1],TI[2]); // If there is an intersection of a polyhedron with itself, the // intersections are excluded @@ -236,18 +241,18 @@ void Intf_InterferencePolyhedron::Intersect // Equation of the triangle plane of the objet gp_XYZ ONor; // Normal vector. Standard_Real Odp; // Polar Distance. - Intf::PlaneEquation(ToolPolyhe1::Point(FirstPol, OI[0]), - ToolPolyhe1::Point(FirstPol, OI[1]), - ToolPolyhe1::Point(FirstPol, OI[2]), + Intf::PlaneEquation(IntPatch_PolyhedronTool::Point(FirstPol, OI[0]), + IntPatch_PolyhedronTool::Point(FirstPol, OI[1]), + IntPatch_PolyhedronTool::Point(FirstPol, OI[2]), ONor, Odp); // Equation of the triangle plane of the tool gp_XYZ TNor; // Normal vector. Standard_Real Tdp; // Polar distance. - Intf::PlaneEquation(ToolPolyhe2::Point(SeconPol, TI[0]), - ToolPolyhe2::Point(SeconPol, TI[1]), - ToolPolyhe2::Point(SeconPol, TI[2]), + Intf::PlaneEquation(IntPatch_PolyhedronTool::Point(SeconPol, TI[0]), + IntPatch_PolyhedronTool::Point(SeconPol, TI[1]), + IntPatch_PolyhedronTool::Point(SeconPol, TI[2]), TNor, Tdp); @@ -256,15 +261,15 @@ void Intf_InterferencePolyhedron::Intersect // Distance of the plane of the triangle from the object by three points of SeconPol Standard_Real dfOpT[3]; - dfOpT[0]=ONor*(ToolPolyhe2::Point(SeconPol, TI[0]).XYZ())-Odp; - dfOpT[1]=ONor*(ToolPolyhe2::Point(SeconPol, TI[1]).XYZ())-Odp; - dfOpT[2]=ONor*(ToolPolyhe2::Point(SeconPol, TI[2]).XYZ())-Odp; + dfOpT[0]=ONor*(IntPatch_PolyhedronTool::Point(SeconPol, TI[0]).XYZ())-Odp; + dfOpT[1]=ONor*(IntPatch_PolyhedronTool::Point(SeconPol, TI[1]).XYZ())-Odp; + dfOpT[2]=ONor*(IntPatch_PolyhedronTool::Point(SeconPol, TI[2]).XYZ())-Odp; // Distance of the plane of the triangle from the tool by three points of FirstPol Standard_Real dpOfT[3]; - dpOfT[0]=TNor*(ToolPolyhe1::Point(FirstPol, OI[0]).XYZ())-Tdp; - dpOfT[1]=TNor*(ToolPolyhe1::Point(FirstPol, OI[1]).XYZ())-Tdp; - dpOfT[2]=TNor*(ToolPolyhe1::Point(FirstPol, OI[2]).XYZ())-Tdp; + dpOfT[0]=TNor*(IntPatch_PolyhedronTool::Point(FirstPol, OI[0]).XYZ())-Tdp; + dpOfT[1]=TNor*(IntPatch_PolyhedronTool::Point(FirstPol, OI[1]).XYZ())-Tdp; + dpOfT[2]=TNor*(IntPatch_PolyhedronTool::Point(FirstPol, OI[2]).XYZ())-Tdp; // Values defining the couple of triangle dpOpT, dpOeT, deOpT CoupleCharacteristics(FirstPol, SeconPol); @@ -318,7 +323,7 @@ void Intf_InterferencePolyhedron::Intersect //for (iObj=0; iObj<3; iObj++) { // for (iToo=0; iToo<3; iToo++) { // if (dpOpT[iObj][iToo] <= floatGap) { - // piOT.Append(Intf_SectionPoint(ToolPolyhe1::Point(FirstPol, OI[iObj]), + // piOT.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(FirstPol, OI[iObj]), // Intf_VERTEX, OI[iObj], 0, 0., // Intf_VERTEX, TI[iToo], 0, 0., // Incidence)); @@ -334,7 +339,7 @@ void Intf_InterferencePolyhedron::Intersect for (iObj=0; iObj<3; iObj++) { for (iToo=0; iToo<3; iToo++) { if (dpOpT[iObj][iToo] <= floatGap) { - piOT.Append(Intf_SectionPoint(ToolPolyhe1::Point(FirstPol, OI[iObj]), + piOT.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(FirstPol, OI[iObj]), Intf_VERTEX, OI[iObj], 0, 0., Intf_VERTEX, TI[iToo], 0, 0., Incidence)); @@ -359,7 +364,7 @@ void Intf_InterferencePolyhedron::Intersect dpOpT[iObj][inext]); if (TI[iToo]>TI[inext]) parT[iToo]=1.-parT[iToo]; piOT.Append(Intf_SectionPoint - (ToolPolyhe1::Point(FirstPol, OI[iObj]), + (IntPatch_PolyhedronTool::Point(FirstPol, OI[iObj]), Intf_VERTEX, OI[iObj], 0, 0., Intf_EDGE, Min(TI[iToo],TI[inext]), Max(TI[iToo],TI[inext]), parT[iToo], @@ -387,7 +392,7 @@ void Intf_InterferencePolyhedron::Intersect dpOpT[inext][iToo]); if (OI[iObj]>OI[inext]) parO[iObj]=1.-parO[iObj]; piOT.Append(Intf_SectionPoint - (ToolPolyhe2::Point(SeconPol, TI[iToo]), + (IntPatch_PolyhedronTool::Point(SeconPol, TI[iToo]), Intf_EDGE, Min(OI[iObj],OI[inext]), Max(OI[iObj],OI[inext]), parO[iObj], Intf_VERTEX, TI[iToo], 0, 0., @@ -406,7 +411,7 @@ void Intf_InterferencePolyhedron::Intersect for (iToo=0; iToo<3; iToo++) { if (parT[iToo]!=0.) { if (Abs(dfOpT[iToo]) <= floatGap) { - piOT.Append(Intf_SectionPoint(ToolPolyhe2::Point(SeconPol, TI[iToo]), + piOT.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(SeconPol, TI[iToo]), Intf_FACE, Tri1, 0, 0., Intf_VERTEX, TI[iToo], 0, 0., Incidence)); @@ -421,7 +426,7 @@ void Intf_InterferencePolyhedron::Intersect for (iObj=0; iObj<3; iObj++) { if (parO[iObj]!=0.) { if (Abs(dpOfT[iObj]) <= floatGap) { - piOT.Append(Intf_SectionPoint(ToolPolyhe1::Point(FirstPol, OI[iObj]), + piOT.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(FirstPol, OI[iObj]), Intf_VERTEX, OI[iObj], 0, 0., Intf_FACE, Tri2, 0, 0., Incidence)); @@ -451,7 +456,7 @@ void Intf_InterferencePolyhedron::Intersect Standard_Real div=(dpOeT[inext][iToo]-dpOeT[iObj][iToo]); if(div>floatGap || div<-floatGap) { parO[iObj]=dpOeT[inext][iToo]/div; - piO=(ToolPolyhe1::Point(FirstPol,OI[inext]).XYZ()) + + piO=(IntPatch_PolyhedronTool::Point(FirstPol,OI[inext]).XYZ()) + (voo[iObj].Reversed()*parO[iObj]); } else @@ -462,7 +467,7 @@ void Intf_InterferencePolyhedron::Intersect if(div>floatGap || div<-floatGap) { parO[iObj]=dpOeT[iObj][iToo]/ (dpOeT[iObj][iToo]-dpOeT[inext][iToo]);; - piO=(ToolPolyhe1::Point(FirstPol,OI[iObj]).XYZ()) + + piO=(IntPatch_PolyhedronTool::Point(FirstPol,OI[iObj]).XYZ()) + (voo[iObj]*parO[iObj]); } else @@ -472,7 +477,7 @@ void Intf_InterferencePolyhedron::Intersect Standard_Real div=(deOpT[iObj][jnext]-deOpT[iObj][iToo]); if(div>floatGap || div<-floatGap) { parT[iToo]=deOpT[iObj][jnext]/div; - piT=(ToolPolyhe2::Point(SeconPol,TI[jnext]).XYZ()) + + piT=(IntPatch_PolyhedronTool::Point(SeconPol,TI[jnext]).XYZ()) + (vtt[iToo].Reversed()*parT[iToo]); } else @@ -482,7 +487,7 @@ void Intf_InterferencePolyhedron::Intersect Standard_Real div=(deOpT[iObj][iToo]-deOpT[iObj][jnext]); if(div>floatGap || div<-floatGap) { parT[iToo]=deOpT[iObj][iToo]/div; - piT=(ToolPolyhe2::Point(SeconPol,TI[iToo]).XYZ()) + + piT=(IntPatch_PolyhedronTool::Point(SeconPol,TI[iToo]).XYZ()) + (vtt[iToo]*parT[iToo]); } else @@ -517,7 +522,7 @@ void Intf_InterferencePolyhedron::Intersect lg=dpOfT[iObj]/(dpOfT[iObj]-dpOfT[inext]); if (lg>0. && lg<1.) { parO[iObj]=lg; - piO=(ToolPolyhe1::Point(FirstPol, OI[iObj]).XYZ())+ + piO=(IntPatch_PolyhedronTool::Point(FirstPol, OI[iObj]).XYZ())+ (voo[iObj]*parO[iObj]); if (OI[iObj]>OI[inext]) parO[iObj]=1.-parO[iObj]; piOT.Append( @@ -537,7 +542,7 @@ void Intf_InterferencePolyhedron::Intersect lg=dfOpT[iToo]/(dfOpT[iToo]-dfOpT[jnext]); if (lg>0. && lg<1.) { parT[iToo]=lg; - piO=(ToolPolyhe2::Point(SeconPol, TI[iToo]).XYZ())+ + piO=(IntPatch_PolyhedronTool::Point(SeconPol, TI[iToo]).XYZ())+ (vtt[iToo]*parT[iToo]); if (TI[iToo]>TI[jnext]) parT[iToo]=1.-parT[iToo]; piOT.Append(Intf_SectionPoint @@ -604,7 +609,7 @@ void Intf_InterferencePolyhedron::Intersect if (parO[2]==0.) pedg=2; } if (pivo>=0 && pedg>=0) { - ToolPolyhe1::TriConnex(FirstPol, Tri1,OI[pivo],OI[pedg],pivo,pedg); + IntPatch_PolyhedronTool::TriConnex(FirstPol, Tri1,OI[pivo],OI[pedg],pivo,pedg); if (pivo > Tri1) { nbpiOT=0; ideb=-1; // On a deja trouve celle ci @@ -625,7 +630,7 @@ void Intf_InterferencePolyhedron::Intersect if (parT[2]==0.) pedg=2; } if (pivo>=0 && pedg>=0) { - ToolPolyhe2::TriConnex(SeconPol, Tri2,TI[pivo],TI[pedg],pivo,pedg); + IntPatch_PolyhedronTool::TriConnex(SeconPol, Tri2,TI[pivo],TI[pedg],pivo,pedg); if (pivo > Tri2) { nbpiOT=0; ideb=-1; // It has been already found @@ -691,12 +696,12 @@ void Intf_InterferencePolyhedron::Intersect Standard_Real d=piOT(-ideb).Pnt().Distance(piOT(-ifin).Pnt()); if(dTI[nou2]) par=1.-par; - Tpi.Append(Intf_SectionPoint (ToolPolyhe1::Point(FirstPol, OI[nob]), + Tpi.Append(Intf_SectionPoint (IntPatch_PolyhedronTool::Point(FirstPol, OI[nob]), Intf_VERTEX, OI[nob], 0, 0., Intf_EDGE, Min(TI[nou], TI[nou2]), Max(TI[nou], TI[nou2]), par, @@ -778,11 +783,11 @@ Standard_Boolean Intf_InterferencePolyhedron::TangentZoneValue } } if (tOP[nob]==Intf_EXTERNAL) { - if (Intf::Contain(ToolPolyhe2::Point(SeconPol, TI[0]), - ToolPolyhe2::Point(SeconPol, TI[1]), - ToolPolyhe2::Point(SeconPol, TI[2]), - ToolPolyhe1::Point(FirstPol, OI[nob]))) { - Tpi.Append(Intf_SectionPoint(ToolPolyhe1::Point(FirstPol, OI[nob]), + if (Intf::Contain(IntPatch_PolyhedronTool::Point(SeconPol, TI[0]), + IntPatch_PolyhedronTool::Point(SeconPol, TI[1]), + IntPatch_PolyhedronTool::Point(SeconPol, TI[2]), + IntPatch_PolyhedronTool::Point(FirstPol, OI[nob]))) { + Tpi.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(FirstPol, OI[nob]), Intf_VERTEX, OI[nob], 0, 0., Intf_FACE, Tri2, 0, 0., 1.)); @@ -805,7 +810,7 @@ Standard_Boolean Intf_InterferencePolyhedron::TangentZoneValue if (dpOpT[nob][nou]+dpOpT[nob2][nou]OI[nob2]) par=1.-par; - Tpi.Append(Intf_SectionPoint(ToolPolyhe2::Point(SeconPol,TI[nou]), + Tpi.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(SeconPol,TI[nou]), Intf_EDGE, Min(OI[nob], OI[nob2]), Max(OI[nob], OI[nob2]), par, Intf_VERTEX, TI[nou], 0, 0., 1.)); @@ -816,11 +821,11 @@ Standard_Boolean Intf_InterferencePolyhedron::TangentZoneValue } } if (tTP[nou]==Intf_EXTERNAL) { - if (Intf::Contain(ToolPolyhe1::Point(FirstPol, OI[0]), - ToolPolyhe1::Point(FirstPol, OI[1]), - ToolPolyhe1::Point(FirstPol, OI[2]), - ToolPolyhe2::Point(SeconPol, TI[nou]))) { - Tpi.Append(Intf_SectionPoint(ToolPolyhe2::Point(SeconPol, TI[nou]), + if (Intf::Contain(IntPatch_PolyhedronTool::Point(FirstPol, OI[0]), + IntPatch_PolyhedronTool::Point(FirstPol, OI[1]), + IntPatch_PolyhedronTool::Point(FirstPol, OI[2]), + IntPatch_PolyhedronTool::Point(SeconPol, TI[nou]))) { + Tpi.Append(Intf_SectionPoint(IntPatch_PolyhedronTool::Point(SeconPol, TI[nou]), Intf_FACE, Tri1, 0, 0., Intf_VERTEX, TI[nou], 0, 0., 1.)); @@ -867,7 +872,7 @@ Standard_Boolean Intf_InterferencePolyhedron::TangentZoneValue else { parO[nbpInt]=dpOeT[nob][nou]/(dpOeT[nob][nou]-dpOeT[nob2][nou]); parT[nbpInt]=deOpT[nob][nou]/(deOpT[nob][nou]-deOpT[nob][nou2]); - gp_Pnt lepi=ToolPolyhe2::Point(SeconPol, TI[nou]).Translated + gp_Pnt lepi=IntPatch_PolyhedronTool::Point(SeconPol, TI[nou]).Translated (gp_Vec(vtt[nou]*parT[nbpInt])); if (OI[nob]>OI[nob2]) parO[nbpInt]=1.-parO[nbpInt]; if (TI[nou]>TI[nou2]) parT[nbpInt]=1.-parT[nbpInt]; @@ -919,18 +924,18 @@ Standard_Boolean Intf_InterferencePolyhedron::TangentZoneValue //purpose : //======================================================================= -void Intf_InterferencePolyhedron::CoupleCharacteristics (const Polyhedron1& FirstPol, - const Polyhedron2& SeconPol) +void IntPatch_InterferencePolyhedron::CoupleCharacteristics (const IntPatch_Polyhedron& FirstPol, + const IntPatch_Polyhedron& SeconPol) { Standard_Integer n1, n2; Standard_Real lg; for (n1=0; n1<3; n1++) { n2=Pourcent3[n1+1]; - voo[n1]=ToolPolyhe1::Point(FirstPol, OI[n2]).XYZ()- - ToolPolyhe1::Point(FirstPol, OI[n1]).XYZ(); - vtt[n1]=ToolPolyhe2::Point(SeconPol, TI[n2]).XYZ()- - ToolPolyhe2::Point(SeconPol, TI[n1]).XYZ(); + voo[n1]=IntPatch_PolyhedronTool::Point(FirstPol, OI[n2]).XYZ()- + IntPatch_PolyhedronTool::Point(FirstPol, OI[n1]).XYZ(); + vtt[n1]=IntPatch_PolyhedronTool::Point(SeconPol, TI[n2]).XYZ()- + IntPatch_PolyhedronTool::Point(SeconPol, TI[n1]).XYZ(); } gp_XYZ vvec=(voo[0]^voo[1])+(voo[1]^voo[2])+(voo[2]^voo[0]); @@ -942,8 +947,8 @@ void Intf_InterferencePolyhedron::CoupleCharacteristics (const Polyhedron1& Firs for (n2=0; n2<3; n2++) { - gp_XYZ vto=ToolPolyhe1::Point(FirstPol, OI[n1]).XYZ()- - ToolPolyhe2::Point(SeconPol, TI[n2]).XYZ(); + gp_XYZ vto=IntPatch_PolyhedronTool::Point(FirstPol, OI[n1]).XYZ()- + IntPatch_PolyhedronTool::Point(SeconPol, TI[n2]).XYZ(); dpOpT[n1][n2]=vto.Modulus(); lg=vtt[n2].Modulus(); diff --git a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx index 4491e7fa77..93c6eda8e8 100644 --- a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -19,8 +19,8 @@ #include -#include -#include +#include +#include #include #include @@ -143,7 +143,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& const Standard_Real Deflection, const Standard_Real Increment) { - IntPatch_TheInterfPolyhedron Interference(Poly1,Poly2); + IntPatch_InterferencePolyhedron Interference(Poly1,Poly2); empt = Standard_True; done = Standard_True; SLin.Clear(); @@ -158,7 +158,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& TColStd_Array1OfReal StartParams(1,4); - IntPatch_ThePWalkingInter PW( Surf1, Surf2, TolTangency, Epsilon, Deflection, Increment ); + IntWalk_PWalking PW( Surf1, Surf2, TolTangency, Epsilon, Deflection, Increment ); Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant Standard_Real incidence; @@ -538,7 +538,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& const Standard_Real Deflection, const Standard_Real Increment) { - IntPatch_TheInterfPolyhedron Interference(Poly1); + IntPatch_InterferencePolyhedron Interference(Poly1); empt = Standard_True; done = Standard_True; SLin.Clear(); @@ -553,7 +553,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Standard_Real pu1,pu2,pv1,pv2; TColStd_Array1OfReal StartParams(1,4); - IntPatch_ThePWalkingInter PW(Surf1,Surf1,TolTangency,Epsilon,Deflection,Increment); + IntWalk_PWalking PW(Surf1,Surf1,TolTangency,Epsilon,Deflection,Increment); Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant Standard_Real incidence; @@ -995,7 +995,7 @@ Handle_IntPatch_Line IntPatch_PrmPrmIntersection::NewLine (const Handle(Adaptor3 V2(Low) = v2; AC(Low) =0.0; - IntPatch_ThePWalkingInter PW(Surf1,Surf2,0.000001,0.000001,0.001,0.001); + IntWalk_PWalking PW(Surf1,Surf2,0.000001,0.000001,0.001,0.001); Standard_Integer i; for(i=Low+1; i<=High; i++) @@ -1340,7 +1340,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& gp_Pnt Point3dDebut,Point3dFin; TColStd_Array1OfReal StartParams(1,4); - IntPatch_ThePWalkingInter PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment); + IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment); IntSurf_ListIteratorOfListOfPntOn2S IterLOP2(LOfPnts); for(; IterLOP2.More(); IterLOP2.Next() ){ @@ -1639,7 +1639,7 @@ void IntPatch_PrmPrmIntersection::Perform(const Handle(Adaptor3d_HSurface)& S // nIncrement/=0.5*MaxOscill; // } - IntPatch_ThePWalkingInter PW(Surf1,Surf2, + IntWalk_PWalking PW(Surf1,Surf2, TolTangency, Epsilon, Deflection, @@ -1964,7 +1964,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur gp_Pnt Point3dDebut,Point3dFin; TColStd_Array1OfReal StartParams(1,4); - IntPatch_ThePWalkingInter PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment); + IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment); if(nbLigSec>=1) { @@ -2663,7 +2663,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur //if(MaxOscill>10) //nIncrement/=0.5*MaxOscill; - IntPatch_ThePWalkingInter PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,nIncrement); + IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,nIncrement); Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant Standard_Real dminiPointLigne; Standard_Boolean HasStartPoint,RejetLigne; diff --git a/src/IntWalk/FILES b/src/IntWalk/FILES index 0c13b99b58..8b529fec2e 100755 --- a/src/IntWalk/FILES +++ b/src/IntWalk/FILES @@ -4,9 +4,5 @@ IntWalk_IWalking_3.gxx IntWalk_IWalking_4.gxx IntWalk_IWalking_5.gxx IntWalk_IWalking_6.gxx -IntWalk_PWalking_1.gxx -IntWalk_PWalking_2.gxx -IntWalk_PWalking_3.gxx -IntWalk_PWalking_4.gxx IntWalk_VectorOfInteger.hxx IntWalk_VectorOfWalkingData.hxx diff --git a/src/IntWalk/IntWalk.cdl b/src/IntWalk/IntWalk.cdl index efcbbe4ed8..ac0b0c98c3 100644 --- a/src/IntWalk/IntWalk.cdl +++ b/src/IntWalk/IntWalk.cdl @@ -29,7 +29,7 @@ package IntWalk -- All the methods of the classes of this package are Internal. -- uses - Standard, MMgt, TCollection, TColStd, gp, math, StdFail, IntSurf, IntImp + Standard, MMgt, TCollection, TColStd, gp, math, StdFail, IntSurf, IntImp, Adaptor3d is @@ -58,7 +58,11 @@ is --algorithm/solution for a marching on intersection between -- 2 biparametric surfaces - generic class PWalking, TheInt2S; + class PWalking; + + --internal of PWalking + class TheInt2S instantiates Int2S from IntImp + (HSurface from Adaptor3d, HSurfaceTool from Adaptor3d); end IntWalk; diff --git a/src/IntWalk/IntWalk_PWalking.cdl b/src/IntWalk/IntWalk_PWalking.cdl index 86b5e967f4..5f4fc2e2ef 100644 --- a/src/IntWalk/IntWalk_PWalking.cdl +++ b/src/IntWalk/IntWalk_PWalking.cdl @@ -14,10 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class PWalking from IntWalk ( - ThePSurface as any; - ThePSurfaceTool as any) - +class PWalking from IntWalk ---Purpose: This class implements an algorithm to determine the -- intersection between 2 parametrized surfaces, marching from @@ -33,21 +30,21 @@ uses XY from gp, LineOn2S from IntSurf, Dir from gp, Dir2d from gp, - Pnt from gp + Pnt from gp, + TheInt2S from IntWalk, + HSurface from Adaptor3d, + HSurfaceTool from Adaptor3d raises OutOfRange from Standard, NotDone from StdFail - class TheInt2S instantiates Int2S from IntImp - (ThePSurface, ThePSurfaceTool); - is Create ( Caro1 , - Caro2 : ThePSurface ; + Caro2 : HSurface from Adaptor3d ; TolTangency, Epsilon, Deflection, @@ -73,7 +70,7 @@ is Create ( Caro1 , - Caro2 : ThePSurface ; + Caro2 : HSurface from Adaptor3d ; TolTangency, Epsilon, Deflection, @@ -259,7 +256,7 @@ theDirectionFlag: Boolean from Standard) is private; DistanceMinimizeByGradient( me : in out; - theASurf1 , theASurf2 : ThePSurface ; + theASurf1 , theASurf2 : HSurface from Adaptor3d ; theU1, theV1, theU2, theV2: out Real from Standard; theStep0U1V1: Real from Standard = 1.0e-6; theStep0U2V2: Real from Standard = 1.0e-6) @@ -269,7 +266,7 @@ theDirectionFlag: Boolean from Standard) -- initial point. DistanceMinimizeByExtrema(me : in out; - theASurf1 : ThePSurface ; + theASurf1 : HSurface from Adaptor3d ; theP0 : Pnt from gp; theU0, theV0: out Real from Standard; theStep0U: Real from Standard = 1.0; @@ -280,7 +277,7 @@ theDirectionFlag: Boolean from Standard) -- initial point. SeekPointOnBoundary(me : in out; - theASurf1 , theASurf2 : ThePSurface ; + theASurf1 , theASurf2 : HSurface from Adaptor3d ; theU1, theV1, theU2, theV2: Real from Standard; isTheFirst : Boolean from Standard) returns Boolean from Standard @@ -290,7 +287,7 @@ theDirectionFlag: Boolean from Standard) PutToBoundary( me : in out; - theASurf1 , theASurf2 : ThePSurface) + theASurf1 , theASurf2 : HSurface from Adaptor3d) -- Tries to extend existing intersection line -- (as set of points) to surface's boundaries, -- if it is possibly. @@ -301,7 +298,7 @@ theDirectionFlag: Boolean from Standard) SeekAdditionalPoints( me : in out; - theASurf1 , theASurf2 : ThePSurface; + theASurf1 , theASurf2 : HSurface from Adaptor3d; theMinNbPoints : Integer from Standard) returns Boolean from Standard; -- Unites and correctly coordinates of work of @@ -351,7 +348,7 @@ fields firstd1 : Dir2d from gp; firstd2 : Dir2d from gp; - myIntersectionOn2S : TheInt2S ; + myIntersectionOn2S : TheInt2S from IntWalk; STATIC_BLOCAGE_SUR_PAS_TROP_GRAND : Integer from Standard; STATIC_PRECEDENT_INFLEXION : Integer from Standard; end PWalking; diff --git a/src/IntWalk/IntWalk_PWalking_1.gxx b/src/IntWalk/IntWalk_PWalking.cxx similarity index 72% rename from src/IntWalk/IntWalk_PWalking_1.gxx rename to src/IntWalk/IntWalk_PWalking.cxx index 6cce3b82b6..17d1c13c0a 100644 --- a/src/IntWalk/IntWalk_PWalking_1.gxx +++ b/src/IntWalk/IntWalk_PWalking.cxx @@ -12,16 +12,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//----------------------------- -//-- IntWalk_PWalking_1.gxx -//-- +#include + +#include + +#include +#include + +#include + +#include +#include #include -#include +#include #include -//#define KELARG 20.0 +#include +#include //================================================================================== // function : IntWalk_PWalking::IntWalk_PWalking @@ -38,8 +47,8 @@ void ComputePasInit(Standard_Real *pasuv, Standard_Real _Vm1,Standard_Real _VM1, Standard_Real _Um2,Standard_Real _UM2, Standard_Real _Vm2,Standard_Real _VM2, - const ThePSurface& , - const ThePSurface& , + const Handle(Adaptor3d_HSurface)& , + const Handle(Adaptor3d_HSurface)& , const Standard_Real Increment) { Standard_Real du1=Abs(UM1-Um1); @@ -77,10 +86,10 @@ void ComputePasInit(Standard_Real *pasuv, // any point can be considered as parallel of any line). //======================================================================= static void IsParallel(const Handle(IntSurf_LineOn2S)& theLine, - const Standard_Boolean theCheckSurf1, - const Standard_Real theToler, - Standard_Boolean& theIsUparallel, - Standard_Boolean& theIsVparallel) + const Standard_Boolean theCheckSurf1, + const Standard_Real theToler, + Standard_Boolean& theIsUparallel, + Standard_Boolean& theIsVparallel) { const Standard_Integer aNbPointsMAX = 23; @@ -139,12 +148,12 @@ static void IsParallel(const Handle(IntSurf_LineOn2S)& theLine, // equal maximal deviation. //======================================================================= static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1, - const Handle(Adaptor3d_HSurface)& theASurf2, - Standard_Real& theU1, - Standard_Real& theV1, - Standard_Real& theU2, - Standard_Real& theV2, - Standard_Real& theFactTol) + const Handle(Adaptor3d_HSurface)& theASurf2, + Standard_Real& theU1, + Standard_Real& theV1, + Standard_Real& theU2, + Standard_Real& theV2, + Standard_Real& theFactTol) { const Standard_Real aTol = Precision::PConfusion(); const Standard_Real aU1bFirst = theASurf1->FirstUParameter(); @@ -166,7 +175,7 @@ static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1, theFactTol = Max(theFactTol, aDelta); isOnOrIn = Standard_False; } - + aDelta = theU1 - aU1bLast; if(aDelta > aTol) { @@ -182,7 +191,7 @@ static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1, theFactTol = Max(theFactTol, aDelta); isOnOrIn = Standard_False; } - + aDelta = theV1 - aV1bLast; if(aDelta > aTol) { @@ -198,7 +207,7 @@ static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1, theFactTol = Max(theFactTol, aDelta); isOnOrIn = Standard_False; } - + aDelta = theU2 - aU2bLast; if(aDelta > aTol) { @@ -214,7 +223,7 @@ static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1, theFactTol = Max(theFactTol, aDelta); isOnOrIn = Standard_False; } - + aDelta = theV2 - aV2bLast; if(aDelta > aTol) { @@ -230,8 +239,8 @@ static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1, // function : IntWalk_PWalking::IntWalk_PWalking // purpose : //================================================================================== -IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1, - const ThePSurface& Caro2, +IntWalk_PWalking::IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, + const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, @@ -250,21 +259,21 @@ STATIC_PRECEDENT_INFLEXION(0) Standard_Real KELARG=20.; // pasMax=Increment*0.2; //-- June 25 99 after problems with precision - Um1 = ThePSurfaceTool::FirstUParameter(Caro1); - Vm1 = ThePSurfaceTool::FirstVParameter(Caro1); - UM1 = ThePSurfaceTool::LastUParameter(Caro1); - VM1 = ThePSurfaceTool::LastVParameter(Caro1); + Um1 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro1); + Vm1 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro1); + UM1 = Adaptor3d_HSurfaceTool::LastUParameter(Caro1); + VM1 = Adaptor3d_HSurfaceTool::LastVParameter(Caro1); - Um2 = ThePSurfaceTool::FirstUParameter(Caro2); - Vm2 = ThePSurfaceTool::FirstVParameter(Caro2); - UM2 = ThePSurfaceTool::LastUParameter(Caro2); - VM2 = ThePSurfaceTool::LastVParameter(Caro2); + Um2 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro2); + Vm2 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro2); + UM2 = Adaptor3d_HSurfaceTool::LastUParameter(Caro2); + VM2 = Adaptor3d_HSurfaceTool::LastVParameter(Caro2); - ResoU1 = ThePSurfaceTool::UResolution(Caro1,Precision::Confusion()); - ResoV1 = ThePSurfaceTool::VResolution(Caro1,Precision::Confusion()); + ResoU1 = Adaptor3d_HSurfaceTool::UResolution(Caro1,Precision::Confusion()); + ResoV1 = Adaptor3d_HSurfaceTool::VResolution(Caro1,Precision::Confusion()); - ResoU2 = ThePSurfaceTool::UResolution(Caro2,Precision::Confusion()); - ResoV2 = ThePSurfaceTool::VResolution(Caro2,Precision::Confusion()); + ResoU2 = Adaptor3d_HSurfaceTool::UResolution(Caro2,Precision::Confusion()); + ResoV2 = Adaptor3d_HSurfaceTool::VResolution(Caro2,Precision::Confusion()); Standard_Real NEWRESO; Standard_Real MAXVAL; @@ -304,49 +313,49 @@ STATIC_PRECEDENT_INFLEXION(0) if(ResoV2>0.0001*pasuv[3]) ResoV2=0.00001*pasuv[3]; - if(ThePSurfaceTool::IsUPeriodic(Caro1)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro1)==Standard_False) { //UM1+=KELARG*pasuv[0]; Um1-=KELARG*pasuv[0]; } else { Standard_Real t = UM1-Um1; - if(tKELARG*pasuv[0])? KELARG*pasuv[0] : t; UM1+=t; Um1-=t; } } - if(ThePSurfaceTool::IsVPeriodic(Caro1)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro1)==Standard_False) { //VM1+=KELARG*pasuv[1]; Vm1-=KELARG*pasuv[1]; } else { Standard_Real t = VM1-Vm1; - if(tKELARG*pasuv[1])? KELARG*pasuv[1] : t; VM1+=t; Vm1-=t; } } - if(ThePSurfaceTool::IsUPeriodic(Caro2)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro2)==Standard_False) { //UM2+=KELARG*pasuv[2]; Um2-=KELARG*pasuv[2]; } else { Standard_Real t = UM2-Um2; - if(tKELARG*pasuv[2])? KELARG*pasuv[2] : t; UM2+=t; Um2-=t; } } - if(ThePSurfaceTool::IsVPeriodic(Caro2)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro2)==Standard_False) { //VM2+=KELARG*pasuv[3]; Vm2-=KELARG*pasuv[3]; } else { Standard_Real t = VM2-Vm2; - if(tKELARG*pasuv[3])? KELARG*pasuv[3] : t; VM2+=t; Vm2-=t; } @@ -366,8 +375,8 @@ STATIC_PRECEDENT_INFLEXION(0) // function : IntWalk_PWalking // purpose : //================================================================================== -IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1, - const ThePSurface& Caro2, +IntWalk_PWalking::IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, + const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, @@ -391,21 +400,21 @@ STATIC_PRECEDENT_INFLEXION(0) // pasMax=Increment*0.2; //-- June 25 99 after problems with precision // - Um1 = ThePSurfaceTool::FirstUParameter(Caro1); - Vm1 = ThePSurfaceTool::FirstVParameter(Caro1); - UM1 = ThePSurfaceTool::LastUParameter(Caro1); - VM1 = ThePSurfaceTool::LastVParameter(Caro1); + Um1 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro1); + Vm1 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro1); + UM1 = Adaptor3d_HSurfaceTool::LastUParameter(Caro1); + VM1 = Adaptor3d_HSurfaceTool::LastVParameter(Caro1); - Um2 = ThePSurfaceTool::FirstUParameter(Caro2); - Vm2 = ThePSurfaceTool::FirstVParameter(Caro2); - UM2 = ThePSurfaceTool::LastUParameter(Caro2); - VM2 = ThePSurfaceTool::LastVParameter(Caro2); + Um2 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro2); + Vm2 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro2); + UM2 = Adaptor3d_HSurfaceTool::LastUParameter(Caro2); + VM2 = Adaptor3d_HSurfaceTool::LastVParameter(Caro2); - ResoU1 = ThePSurfaceTool::UResolution(Caro1,Precision::Confusion()); - ResoV1 = ThePSurfaceTool::VResolution(Caro1,Precision::Confusion()); + ResoU1 = Adaptor3d_HSurfaceTool::UResolution(Caro1,Precision::Confusion()); + ResoV1 = Adaptor3d_HSurfaceTool::VResolution(Caro1,Precision::Confusion()); - ResoU2 = ThePSurfaceTool::UResolution(Caro2,Precision::Confusion()); - ResoV2 = ThePSurfaceTool::VResolution(Caro2,Precision::Confusion()); + ResoU2 = Adaptor3d_HSurfaceTool::UResolution(Caro2,Precision::Confusion()); + ResoV2 = Adaptor3d_HSurfaceTool::VResolution(Caro2,Precision::Confusion()); // Standard_Real NEWRESO, MAXVAL, MAXVAL2; // @@ -454,55 +463,55 @@ STATIC_PRECEDENT_INFLEXION(0) pasuv[2]=pasMax*Abs(UM2-Um2); pasuv[3]=pasMax*Abs(VM2-Vm2); // - if(ThePSurfaceTool::IsUPeriodic(Caro1)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro1)==Standard_False) { UM1+=KELARG*pasuv[0]; Um1-=KELARG*pasuv[0]; } else { Standard_Real t = UM1-Um1; - if(tKELARG*pasuv[0])? KELARG*pasuv[0] : t; UM1+=t; Um1-=t; } } // - if(ThePSurfaceTool::IsVPeriodic(Caro1)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro1)==Standard_False) { VM1+=KELARG*pasuv[1]; Vm1-=KELARG*pasuv[1]; } else { Standard_Real t = VM1-Vm1; - if(tKELARG*pasuv[1])? KELARG*pasuv[1] : t; VM1+=t; Vm1-=t; } } // - if(ThePSurfaceTool::IsUPeriodic(Caro2)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro2)==Standard_False) { UM2+=KELARG*pasuv[2]; Um2-=KELARG*pasuv[2]; } else { Standard_Real t = UM2-Um2; - if(tKELARG*pasuv[2])? KELARG*pasuv[2] : t; UM2+=t; Um2-=t; } } - if(ThePSurfaceTool::IsVPeriodic(Caro2)==Standard_False) { + if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro2)==Standard_False) { VM2+=KELARG*pasuv[3]; Vm2-=KELARG*pasuv[3]; } else { Standard_Real t = VM2-Vm2; - if(tKELARG*pasuv[3])? KELARG*pasuv[3] : t; VM2+=t; Vm2-=t; @@ -592,18 +601,18 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep, done = Standard_False; // // Caro1 and Caro2 - const ThePSurface& Caro1 =myIntersectionOn2S.Function().AuxillarSurface1(); - const ThePSurface& Caro2 =myIntersectionOn2S.Function().AuxillarSurface2(); + const Handle(Adaptor3d_HSurface)& Caro1 =myIntersectionOn2S.Function().AuxillarSurface1(); + const Handle(Adaptor3d_HSurface)& Caro2 =myIntersectionOn2S.Function().AuxillarSurface2(); // - const Standard_Real UFirst1 = ThePSurfaceTool::FirstUParameter(Caro1); - const Standard_Real VFirst1 = ThePSurfaceTool::FirstVParameter(Caro1); - const Standard_Real ULast1 = ThePSurfaceTool::LastUParameter (Caro1); - const Standard_Real VLast1 = ThePSurfaceTool::LastVParameter (Caro1); - - const Standard_Real UFirst2 = ThePSurfaceTool::FirstUParameter(Caro2); - const Standard_Real VFirst2 = ThePSurfaceTool::FirstVParameter(Caro2); - const Standard_Real ULast2 = ThePSurfaceTool::LastUParameter (Caro2); - const Standard_Real VLast2 = ThePSurfaceTool::LastVParameter (Caro2); + const Standard_Real UFirst1 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro1); + const Standard_Real VFirst1 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro1); + const Standard_Real ULast1 = Adaptor3d_HSurfaceTool::LastUParameter (Caro1); + const Standard_Real VLast1 = Adaptor3d_HSurfaceTool::LastVParameter (Caro1); + + const Standard_Real UFirst2 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro2); + const Standard_Real VFirst2 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro2); + const Standard_Real ULast2 = Adaptor3d_HSurfaceTool::LastUParameter (Caro2); + const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter (Caro2); // ComputePasInit(pasuv,u1min,u1max,v1min,v1max,u2min,u2max,v2min,v2max, Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2,pasMax+pasMax); @@ -1802,14 +1811,14 @@ Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsop //purpose : //======================================================================= Standard_Boolean IntWalk_PWalking:: - DistanceMinimizeByGradient( const Handle(Adaptor3d_HSurface)& theASurf1, - const Handle(Adaptor3d_HSurface)& theASurf2, - Standard_Real& theU1, - Standard_Real& theV1, - Standard_Real& theU2, - Standard_Real& theV2, - const Standard_Real theStep0U1V1, - const Standard_Real theStep0U2V2) +DistanceMinimizeByGradient( const Handle(Adaptor3d_HSurface)& theASurf1, + const Handle(Adaptor3d_HSurface)& theASurf2, + Standard_Real& theU1, + Standard_Real& theV1, + Standard_Real& theU2, + Standard_Real& theV2, + const Standard_Real theStep0U1V1, + const Standard_Real theStep0U2V2) { const Standard_Integer aNbIterMAX = 60; const Standard_Real aTol = 1.0e-14; @@ -1865,20 +1874,20 @@ Standard_Boolean IntWalk_PWalking:: { Standard_Real anAdd = aGradFu*aSTEPuv; Standard_Real aPARu = (anAdd >= 0.0)? - (theU1 - Max(anAdd, Epsilon(theU1))) : - (theU1 + Max(-anAdd, Epsilon(theU1))); + (theU1 - Max(anAdd, Epsilon(theU1))) : + (theU1 + Max(-anAdd, Epsilon(theU1))); anAdd = aGradFv*aSTEPuv; Standard_Real aPARv = (anAdd >= 0.0)? - (theV1 - Max(anAdd, Epsilon(theV1))) : - (theV1 + Max(-anAdd, Epsilon(theV1))); + (theV1 - Max(anAdd, Epsilon(theV1))) : + (theV1 + Max(-anAdd, Epsilon(theV1))); anAdd = aGradFU*aStepUV; Standard_Real aParU = (anAdd >= 0.0)? - (theU2 - Max(anAdd, Epsilon(theU2))) : - (theU2 + Max(-anAdd, Epsilon(theU2))); + (theU2 - Max(anAdd, Epsilon(theU2))) : + (theU2 + Max(-anAdd, Epsilon(theU2))); anAdd = aGradFV*aStepUV; Standard_Real aParV = (anAdd >= 0.0)? - (theV2 - Max(anAdd, Epsilon(theV2))) : - (theV2 + Max(-anAdd, Epsilon(theV2))); + (theV2 - Max(anAdd, Epsilon(theV2))) : + (theV2 + Max(-anAdd, Epsilon(theV2))); gp_Pnt aPt1, aPt2; @@ -1929,26 +1938,26 @@ Standard_Boolean IntWalk_PWalking:: //purpose : //======================================================================= Standard_Boolean IntWalk_PWalking:: - DistanceMinimizeByExtrema(const Handle(Adaptor3d_HSurface)& theASurf, - const gp_Pnt& theP0, - Standard_Real& theU0, - Standard_Real& theV0, - const Standard_Real theStep0U, - const Standard_Real theStep0V) +DistanceMinimizeByExtrema(const Handle(Adaptor3d_HSurface)& theASurf, + const gp_Pnt& theP0, + Standard_Real& theU0, + Standard_Real& theV0, + const Standard_Real theStep0U, + const Standard_Real theStep0V) { const Standard_Real aTol = 1.0e-14; gp_Pnt aPS; gp_Vec aD1Su, aD1Sv, aD2Su, aD2Sv, aD2SuvTemp; Standard_Real aSQDistPrev = RealLast(); Standard_Real aU = theU0, aV = theV0; - + Standard_Integer aNbIter = 10; do { theASurf->D2(aU, aV, aPS, aD1Su, aD1Sv, aD2Su, aD2Sv, aD2SuvTemp); - + gp_Vec aVec(theP0, aPS); - + Standard_Real aSQDist = aVec.SquareMagnitude(); if(aSQDist >= aSQDistPrev) @@ -1967,9 +1976,9 @@ Standard_Boolean IntWalk_PWalking:: //Derivatives const Standard_Real aDf1u = aD2Su.Dot(aVec) + aD1Su.Dot(aD1Su), - aDf1v = aD2Su.Dot(aD1Sv), - aDf2u = aDf1v, - aDf2v = aD2Sv.Dot(aVec) + aD1Sv.Dot(aD1Sv); + aDf1v = aD2Su.Dot(aD1Sv), + aDf2u = aDf1v, + aDf2v = aD2Sv.Dot(aVec) + aD1Sv.Dot(aD1Sv); const Standard_Real aDet = aDf1u*aDf2v - aDf1v*aDf2u; aU -= theStep0U*(aDf2v*aF1 - aDf1v*aF2)/aDet; @@ -1985,13 +1994,13 @@ Standard_Boolean IntWalk_PWalking:: //purpose : //======================================================================= Standard_Boolean IntWalk_PWalking:: - SeekPointOnBoundary(const Handle(Adaptor3d_HSurface)& theASurf1, - const Handle(Adaptor3d_HSurface)& theASurf2, - const Standard_Real theU1, - const Standard_Real theV1, - const Standard_Real theU2, - const Standard_Real theV2, - const Standard_Boolean isTheFirst) +SeekPointOnBoundary(const Handle(Adaptor3d_HSurface)& theASurf1, + const Handle(Adaptor3d_HSurface)& theASurf2, + const Standard_Real theU1, + const Standard_Real theV1, + const Standard_Real theU2, + const Standard_Real theV2, + const Standard_Boolean isTheFirst) { const Standard_Real aTol = 1.0e-14; Standard_Boolean isOK = Standard_False; @@ -2036,20 +2045,20 @@ Standard_Boolean IntWalk_PWalking:: Standard_Real u1 = U1prec, v1 = V1prec, u2 = U2prec, v2 = V2prec; flFinish = Checking(theASurf1, theASurf2, U1prec, V1prec, U2prec, V2prec, aTolF); - + if(aTolF <= aTolMax) { gp_Pnt aP1 = theASurf1->Value(u1, v1), - aP2 = theASurf2->Value(u2, v2); + aP2 = theASurf2->Value(u2, v2); gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ())); const Standard_Real aSQDist1 = aPInt.SquareDistance(aP1), - aSQDist2 = aPInt.SquareDistance(aP2); + aSQDist2 = aPInt.SquareDistance(aP2); if((aSQDist1 < aTol) && (aSQDist2 < aTol)) { IntSurf_PntOn2S anIP; anIP.SetValue(aPInt, u1, v1, u2, v2); - + if(isTheFirst) line->InsertBefore(1,anIP); else @@ -2076,8 +2085,8 @@ Standard_Boolean IntWalk_PWalking:: //purpose : //======================================================================= Standard_Boolean IntWalk_PWalking:: - PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1, - const Handle(Adaptor3d_HSurface)& theASurf2) +PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1, + const Handle(Adaptor3d_HSurface)& theASurf2) { const Standard_Real aTolMin = Precision::Confusion(); @@ -2111,7 +2120,7 @@ Standard_Boolean IntWalk_PWalking:: Standard_Real u1, v1, u2, v2; line->Value(1).Parameters(u1, v1, u2, v2); Standard_Real aDelta = 0.0; - + if(!isV1parallel) { aDelta = u1 - aU1bFirst; @@ -2192,7 +2201,7 @@ Standard_Boolean IntWalk_PWalking:: { hasBeenAdded = SeekPointOnBoundary(theASurf1, theASurf2, u1, - v1, u2, v2, Standard_True); + v1, u2, v2, Standard_True); } isNeedAdding = Standard_False; @@ -2278,7 +2287,7 @@ Standard_Boolean IntWalk_PWalking:: { hasBeenAdded = SeekPointOnBoundary(theASurf1, theASurf2, u1, - v1, u2, v2, Standard_False); + v1, u2, v2, Standard_False); } return hasBeenAdded; @@ -2289,9 +2298,9 @@ Standard_Boolean IntWalk_PWalking:: //purpose : //======================================================================= Standard_Boolean IntWalk_PWalking:: - SeekAdditionalPoints( const Handle(Adaptor3d_HSurface)& theASurf1, - const Handle(Adaptor3d_HSurface)& theASurf2, - const Standard_Integer theMinNbPoints) +SeekAdditionalPoints( const Handle(Adaptor3d_HSurface)& theASurf1, + const Handle(Adaptor3d_HSurface)& theASurf2, + const Standard_Integer theMinNbPoints) { const Standard_Real aTol = 1.0e-14; Standard_Integer aNbPoints = line->NbPoints(); @@ -2307,7 +2316,7 @@ Standard_Boolean IntWalk_PWalking:: const Standard_Real aV2bFirst = theASurf2->FirstVParameter(); const Standard_Real aV2bLast = theASurf2->LastVParameter(); - + Standard_Boolean isPrecise = Standard_False; Standard_Real U1prec = 0.0, V1prec = 0.0, U2prec = 0.0, V2prec = 0.0; @@ -2376,18 +2385,18 @@ Standard_Boolean IntWalk_PWalking:: if(aStatus) { gp_Pnt aP1 = theASurf1->Value(U1prec, V1prec), - aP2 = theASurf2->Value(U2prec, V2prec); + aP2 = theASurf2->Value(U2prec, V2prec); gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ())); const Standard_Real aSQDist1 = aPInt.SquareDistance(aP1), - aSQDist2 = aPInt.SquareDistance(aP2); + aSQDist2 = aPInt.SquareDistance(aP2); if((aSQDist1 < aTol) && (aSQDist2 < aTol)) { IntSurf_PntOn2S anIP; anIP.SetValue(aPInt, U1prec, V1prec, U2prec, V2prec); line->InsertBefore(lp, anIP); - + isPrecise = Standard_True; if(++aNbPoints >= theMinNbPoints) @@ -2404,4 +2413,534 @@ Standard_Boolean IntWalk_PWalking:: return isPrecise; } +void IntWalk_PWalking:: +RepartirOuDiviser(Standard_Boolean& DejaReparti, + IntImp_ConstIsoparametric& ChoixIso, + Standard_Boolean& Arrive) + + // at the neighborhood of a point, there is a fail of marching + // it is required to divide the steps to try to continue + // if the step is too small if we are on border + // restart in another direction if it was not done, otherwise stop + +{ + // Standard_Integer i; + if (Arrive) { //restart in the other direction + if (!DejaReparti ) { + Arrive = Standard_False; + DejaReparti = Standard_True; + previousPoint = line->Value(1); + previoustg = Standard_False; + previousd1 = firstd1; + previousd2 = firstd2; + previousd = tgdir; + indextg = line->NbPoints(); + tgdir.Reverse(); + line->Reverse(); + + //-- printf("\nIntWalk_PWalking_2.gxx Reverse %3d\n",indextg); + sensCheminement = -1; + tgfirst = tglast; + tglast = Standard_False; + ChoixIso = choixIsoSav; +#if 0 + pasuv[0]=pasSav[0]; + pasuv[1]=pasSav[1]; + pasuv[2]=pasSav[2]; + pasuv[3]=pasSav[3]; +#else + Standard_Real u1,v1,u2,v2; + Standard_Real U1,V1,U2,V2; + Standard_Integer nn=line->NbPoints(); + if(nn>2) { + line->Value(nn).Parameters(u1,v1,u2,v2); + line->Value(nn-1).Parameters(U1,V1,U2,V2); + pasuv[0]=Abs(u1-U1); + pasuv[1]=Abs(v1-V1); + pasuv[2]=Abs(u2-U2); + pasuv[3]=Abs(v2-V2); + } +#endif + + } + } + else { + if ( pasuv[0]*0.5 < ResoU1 + && pasuv[1]*0.5 < ResoV1 + && pasuv[2]*0.5 < ResoU2 + && pasuv[3]*0.5 < ResoV2 + ) { + if (!previoustg) { + tglast = Standard_True; // IS IT ENOUGH ???? + } + + if (!DejaReparti) { //restart in the other direction + DejaReparti = Standard_True; + previousPoint = line->Value(1); + previoustg = Standard_False; + previousd1 = firstd1; + previousd2 = firstd2; + previousd = tgdir; + indextg = line->NbPoints(); + tgdir.Reverse(); + line->Reverse(); + + //-- printf("\nIntWalk_PWalking_2.gxx Reverse %3d\n",indextg); + + sensCheminement = -1; + tgfirst = tglast; + tglast = Standard_False; + ChoixIso = choixIsoSav; + +#if 0 + pasuv[0]=pasSav[0]; + pasuv[1]=pasSav[1]; + pasuv[2]=pasSav[2]; + pasuv[3]=pasSav[3]; +#else + Standard_Real u1,v1,u2,v2; + Standard_Real U1,V1,U2,V2; + Standard_Integer nn=line->NbPoints(); + if(nn>2) { + line->Value(nn).Parameters(u1,v1,u2,v2); + line->Value(nn-1).Parameters(U1,V1,U2,V2); + pasuv[0]=Abs(u1-U1); + pasuv[1]=Abs(v1-V1); + pasuv[2]=Abs(u2-U2); + pasuv[3]=Abs(v2-V2); + } +#endif + } + else Arrive = Standard_True; + } + else { + pasuv[0]*=0.5; + pasuv[1]*=0.5; + pasuv[2]*=0.5; + pasuv[3]*=0.5; + } + } +} + +namespace { + //OCC431(apo): modified -> + static const Standard_Real CosRef2D = Cos(M_PI/9.0), AngRef2D = M_PI/2.0; + + static const Standard_Real d = 7.0; +} + +IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() + +// test if vector is observed by calculating an increase of vector +// or the previous point and its tangent, the new calculated point and its +// tangent; it is possible to find a cube passing by the 2 points and having as a +// derivative the tangents of the intersection +// calculate the point with parameter 0.5 on cube=p1 +// calculate the medium point of 2 points of intersection=p2 +// if arrow/2<=||p1p2||<= arrow consider that the vector is observed +// otherwise adjust the step depending on the ratio ||p1p2||/vector +// and the previous step +// test if in 2 tangent planes of surfaces there is no too great angle2d +// grand : if yes divide the step +// test if there is no change of side +// +{ + if(line->NbPoints() ==1 ) { + STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=STATIC_PRECEDENT_INFLEXION=0; + } + + IntWalk_StatusDeflection Status = IntWalk_OK; + Standard_Real FlecheCourante ,Ratio; + + + const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point(); + //================================================================================== + //========= S t o p o n p o i n t ============ + //================================================================================== + if (myIntersectionOn2S.IsTangent()) { + return IntWalk_ArretSurPoint; + } + + const gp_Dir& TgCourante = myIntersectionOn2S.Direction(); + + //================================================================================== + //========= R i s k o f i n f l e x i o n p o i n t ============ + //================================================================================== + if (TgCourante.Dot(previousd)<0) { + //------------------------------------------------------------ + //-- Risk of inflexion point : Divide the step by 2 + //-- Initialize STATIC_PRECEDENT_INFLEXION so that + //-- at the next call to return Pas_OK if there is no + //-- more risk of the point of inflexion + //------------------------------------------------------------ + + pasuv[0]*=0.5; + pasuv[1]*=0.5; + pasuv[2]*=0.5; + pasuv[3]*=0.5; + STATIC_PRECEDENT_INFLEXION+=3; + if (pasuv[0] < ResoU1 && pasuv[1] 0) { + STATIC_PRECEDENT_INFLEXION -- ; + return IntWalk_OK; + } + } + + //================================================================================== + //========= D e t e c t c o n f u s e d P o in t s =========== + //================================================================================== + + Standard_Real Dist = previousPoint.Value(). + SquareDistance(CurrentPoint.Value()); + + + if (Dist < tolconf*tolconf ) { + pasuv[0] = Max(5.*ResoU1,Min(1.5*pasuv[0],pasInit[0])); + pasuv[1] = Max(5.*ResoV1,Min(1.5*pasuv[1],pasInit[1])); + pasuv[2] = Max(5.*ResoU2,Min(1.5*pasuv[2],pasInit[2])); + pasuv[3] = Max(5.*ResoV2,Min(1.5*pasuv[3],pasInit[3])); + Status = IntWalk_PointConfondu; + } + + //================================================================================== + Standard_Real Up1,Vp1,Uc1,Vc1,Du1,Dv1,AbsDu1,AbsDu2,AbsDv1,AbsDv2; + Standard_Real Up2,Vp2,Uc2,Vc2,Du2,Dv2; + + previousPoint.Parameters(Up1,Vp1,Up2,Vp2); + CurrentPoint.Parameters(Uc1,Vc1,Uc2,Vc2); + + Du1 = Uc1 - Up1; Dv1 = Vc1 - Vp1; + Du2 = Uc2 - Up2; Dv2 = Vc2 - Vp2; + + AbsDu1 = Abs(Du1); + AbsDu2 = Abs(Du2); + AbsDv1 = Abs(Dv1); + AbsDv2 = Abs(Dv2); + //================================================================================= + //==== S t e p o f p r o g r e s s i o n (between previous and Current) ======= + //================================================================================= + if ( AbsDu1 < ResoU1 && AbsDv1 < ResoV1 + && AbsDu2 < ResoU2 && AbsDv2 < ResoV2) { + pasuv[0] = ResoU1; pasuv[1] = ResoV1; pasuv[2] = ResoU2; pasuv[3] = ResoV2; + return(IntWalk_ArretSurPointPrecedent); + } + //================================================================================== + + Standard_Real tolArea = 100.0; + if (ResoU1 < Precision::PConfusion() || + ResoV1 < Precision::PConfusion() || + ResoU2 < Precision::PConfusion() || + ResoV2 < Precision::PConfusion() ) + tolArea = tolArea*2.0; + + Standard_Real Cosi1, CosRef1, Ang1, AngRef1, ResoUV1, Duv1, d1, tolCoeff1; + Standard_Real Cosi2, CosRef2, Ang2, AngRef2, ResoUV2, Duv2, d2, tolCoeff2; + Cosi1 = Du1*previousd1.X() + Dv1*previousd1.Y(); + Cosi2 = Du2*previousd2.X() + Dv2*previousd2.Y(); + Duv1 = Du1*Du1 + Dv1*Dv1; + Duv2 = Du2*Du2 + Dv2*Dv2; + ResoUV1 = ResoU1*ResoU1 + ResoV1*ResoV1; + ResoUV2 = ResoU2*ResoU2 + ResoV2*ResoV2; + // + //modified by NIZNHY-PKV Wed Nov 13 12:25:44 2002 f + // + Standard_Real aMinDiv2=Precision::Confusion(); + aMinDiv2=aMinDiv2*aMinDiv2; + // + d1=d; + if (Duv1>aMinDiv2) { + d1 = Abs(ResoUV1/Duv1); + d1 = Min(Sqrt(d1)*tolArea, d); + } + //d1 = Abs(ResoUV1/Duv1); + //d1 = Min(Sqrt(d1)*tolArea,d); + //modified by NIZNHY-PKV Wed Nov 13 12:34:30 2002 t + tolCoeff1 = Exp(d1); + // + //modified by NIZNHY-PKV Wed Nov 13 12:34:43 2002 f + d2=d; + if (Duv2>aMinDiv2) { + d2 = Abs(ResoUV2/Duv2); + d2 = Min(Sqrt(d2)*tolArea,d); + } + //d2 = Abs(ResoUV2/Duv2); + //d2 = Min(Sqrt(d2)*tolArea,d); + //modified by NIZNHY-PKV Wed Nov 13 12:34:53 2002 t + tolCoeff2 = Exp(d2); + CosRef1 = CosRef2D/tolCoeff1; + CosRef2 = CosRef2D/tolCoeff2; + // + //================================================================================== + //== The points are not confused : == + //== D e t e c t t h e S t o p a t p r e v i o u s p o i n t == + //== N o t T o o G r e a t (angle in space UV) == + //== C h a n g e o f s i d e == + //================================================================================== + if (Status != IntWalk_PointConfondu) { + if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) { + pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5; + if (pasuv[0] AngRef1 || Ang2 > AngRef2) { + pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5; + if (pasuv[0]1e-16) { + Ratio = 0.5*(fleche/FlecheCourante); + } + else { + Ratio = 10.0; + } + Standard_Real pasSu1 = pasuv[0]; + Standard_Real pasSv1 = pasuv[1]; + Standard_Real pasSu2 = pasuv[2]; + Standard_Real pasSv2 = pasuv[3]; + + //-- In case if + //-- a point at U+DeltaU is required, .... + //-- return a point at U + Epsilon + //-- Epsilon << DeltaU. + + if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1; + if(pasuv[1]< AbsDv1) pasuv[1] = AbsDv1; + if(pasuv[2]< AbsDu2) pasuv[2] = AbsDu2; + if(pasuv[3]< AbsDv2) pasuv[3] = AbsDv2; + + if(pasuv[0]10.0 ) { Ratio=10.0; } + Standard_Real R1,R = pasInit[0]/pasuv[0]; + R1= pasInit[1]/pasuv[1]; if(R1 R) Ratio=R; + pasuv[0] = Min(Ratio*pasuv[0],pasInit[0]); + pasuv[1] = Min(Ratio*pasuv[1],pasInit[1]); + pasuv[2] = Min(Ratio*pasuv[2],pasInit[2]); + pasuv[3] = Min(Ratio*pasuv[3],pasInit[3]); + if (pasuv[0] != pasSu1 || pasuv[2] != pasSu2|| + pasuv[1] != pasSv1 || pasuv[3] != pasSv2) { + if(++STATIC_BLOCAGE_SUR_PAS_TROP_GRAND > 5) { + STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0; + return IntWalk_PasTropGrand; + } + } + if(Status == IntWalk_OK) { + STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0; + //-- Try to increase the step + } + return Status; + } + else { //-- CurrentVector > vector*0.5 + if (FlecheCourante > fleche) { //-- Current step too Great + Ratio = fleche/FlecheCourante; + pasuv[0] = Ratio*pasuv[0]; + pasuv[1] = Ratio*pasuv[1]; + pasuv[2] = Ratio*pasuv[2]; + pasuv[3] = Ratio*pasuv[3]; + //if(++STATIC_BLOCAGE_SUR_PAS_TROP_GRAND > 5) { + // STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0; + return IntWalk_PasTropGrand; + //} + } + else { //-- vector/2 < CurrentVector <= vector + Ratio = 0.75 * (fleche / FlecheCourante); + } + } + pasuv[0] = Max(5.*ResoU1,Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0])); + pasuv[1] = Max(5.*ResoV1,Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1])); + pasuv[2] = Max(5.*ResoU2,Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2])); + pasuv[3] = Max(5.*ResoV2,Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3])); + if(Status == IntWalk_OK) STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0; + return Status; +} + +Standard_Boolean IntWalk_PWalking:: +TestArret(const Standard_Boolean DejaReparti, + TColStd_Array1OfReal& Param, + IntImp_ConstIsoparametric& ChoixIso) + + // + // test if the point of intersection set by these parameters remains in the + // natural domain of each square. + // if the point outpasses reframe to find the best iso (border) + // that intersects easiest the other square + // otherwise test if closed line is present + // +{ + Standard_Real Uvd[4],Uvf[4],Epsuv[4],Duv[4],Uvp[4],dv,dv2,ParC[4]; + Standard_Real DPc,DPb; + Standard_Integer i = 0, k = 0; + Epsuv[0] = ResoU1; + Epsuv[1] = ResoV1; + Epsuv[2] = ResoU2; + Epsuv[3] = ResoV2; + previousPoint.Parameters(Uvp[0],Uvp[1],Uvp[2],Uvp[3]); + + Standard_Real SolParam[4]; + myIntersectionOn2S.Point().Parameters(SolParam[0],SolParam[1],SolParam[2],SolParam[3]); + + Standard_Boolean Trouve = Standard_False; + + Uvd[0]=Um1; Uvf[0]=UM1; Uvd[1]=Vm1; Uvf[1]=VM1; + Uvd[2]=Um2; Uvf[2]=UM2; Uvd[3]=Vm2; Uvf[3]=VM2; + + Standard_Integer im1; + for ( i = 1,im1 = 0;i<=4;i++,im1++) { + switch(i) { + case 1: k=2; break; + case 2: k=1; break; + case 3: k=4; break; + case 4: k=3; break; + } + if (Param(i) < (Uvd[im1]-Epsuv[im1]) || + SolParam[im1] < (Uvd[im1]-Epsuv[im1])) //-- Current ----- Bound Inf ----- Previous + { + Trouve = Standard_True; //-- + DPc = Uvp[im1]-Param(i); //-- Previous - Current + DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf + ParC[im1] = Uvd[im1]; //-- ParamCorrige + dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction) + dv2 = dv*dv; + if(dv2>RealEpsilon()) { //-- Progress at the other Direction ? + Duv[im1] = DPc*DPb + dv2; + Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); + } + else { + Duv[im1]=-1.0; //-- If no progress, do not change + } //-- the choice of iso + } + else if (Param(i) > (Uvf[im1] + Epsuv[im1]) || + SolParam[im1] > (Uvf[im1] + Epsuv[im1]))//-- Previous ----- Bound Sup ----- Current + { + Trouve = Standard_True; //-- + DPc = Param(i)-Uvp[im1]; //-- Current - Previous + DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous + ParC[im1] = Uvf[im1]; //-- Param Corrige + dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction) + dv2 = dv*dv; + if(dv2>RealEpsilon()) { //-- Progress in other Direction ? + Duv[im1] = DPc*DPb + dv2; + Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); + } + else { + Duv[im1]=-1.0; //-- If no progress, do not change + } //-- the choice of iso + } + else { + Duv[im1]= -1.; + ParC[im1]=Param(i); + } + } + + if (Trouve) { + //-------------------------------------------------- + //-- One of Parameters u1,v1,u2,v2 is outside of -- + //-- the natural limits. -- + //-- Find the best direction of -- + //-- progress and reframe the parameters. -- + //-------------------------------------------------- + Standard_Real ddv = -1.0; + k=-1; + for (i=0;i<=3;i++) { + Param(i+1) = ParC[i]; + if(Duv[i]>ddv) { + ddv = Duv[i]; + k=i; + } + } + if(k!=-1) { + ChoixIso = ChoixRef[k]; + } + else { + if((ParC[0]<=Uvd[0]+Epsuv[0]) || (ParC[0]>=Uvf[0]-Epsuv[0])) { + ChoixIso = IntImp_UIsoparametricOnCaro1; + } + else if((ParC[1]<=Uvd[1]+Epsuv[1]) || (ParC[1]>=Uvf[1]-Epsuv[1])) { + ChoixIso = IntImp_VIsoparametricOnCaro1; + } + else if((ParC[2]<=Uvd[2]+Epsuv[2]) || (ParC[2]>=Uvf[2]-Epsuv[2])) { + ChoixIso = IntImp_UIsoparametricOnCaro2; + } + else if((ParC[3]<=Uvd[3]+Epsuv[3]) || (ParC[3]>=Uvf[3]-Epsuv[3])) { + ChoixIso = IntImp_VIsoparametricOnCaro2; + } + } + close = Standard_False; + return Standard_True; + } + else + { + if (!DejaReparti) { // find if line closed + + Standard_Real u,v; + const IntSurf_PntOn2S& POn2S1=line->Value(1); + //On S1 + POn2S1.ParametersOnS1(u,v); + gp_Pnt2d P1uvS1(u,v); + previousPoint.ParametersOnS1(u,v); + gp_Pnt2d PrevuvS1(u,v); + myIntersectionOn2S.Point().ParametersOnS1(u,v); + gp_Pnt2d myIntersuvS1(u,v); + Standard_Boolean close2dS1 = (P1uvS1.XY()-PrevuvS1.XY())* + (P1uvS1.XY()-myIntersuvS1.XY()) < 0.0; + //On S2 + POn2S1.ParametersOnS2(u,v); + gp_Pnt2d P1uvS2(u,v); + previousPoint.ParametersOnS2(u,v); + gp_Pnt2d PrevuvS2(u,v); + myIntersectionOn2S.Point().ParametersOnS2(u,v); + gp_Pnt2d myIntersuvS2(u,v); + Standard_Boolean close2dS2 = (P1uvS2.XY()-PrevuvS2.XY())* + (P1uvS2.XY()-myIntersuvS2.XY()) < 0.0; + + close = close2dS1 && close2dS2; + return close; + } + else return Standard_False; + } +} diff --git a/src/IntWalk/IntWalk_PWalking.gxx b/src/IntWalk/IntWalk_PWalking.gxx deleted file mode 100644 index 259b51e953..0000000000 --- a/src/IntWalk/IntWalk_PWalking.gxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include -#include -#include -#include diff --git a/src/IntWalk/IntWalk_PWalking_2.gxx b/src/IntWalk/IntWalk_PWalking_2.gxx deleted file mode 100644 index 13173d43c2..0000000000 --- a/src/IntWalk/IntWalk_PWalking_2.gxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -//------------------------------------------------------------------- -//-- I n t W a l k _ P W a l k i n g _ 2 . g x x -//------------------------------------------------------------------- - - - -void IntWalk_PWalking:: - RepartirOuDiviser(Standard_Boolean& DejaReparti, - IntImp_ConstIsoparametric& ChoixIso, - Standard_Boolean& Arrive) - -// at the neighborhood of a point, there is a fail of marching -// it is required to divide the steps to try to continue -// if the step is too small if we are on border -// restart in another direction if it was not done, otherwise stop - -{ - // Standard_Integer i; - if (Arrive) { //restart in the other direction - if (!DejaReparti ) { - Arrive = Standard_False; - DejaReparti = Standard_True; - previousPoint = line->Value(1); - previoustg = Standard_False; - previousd1 = firstd1; - previousd2 = firstd2; - previousd = tgdir; - indextg = line->NbPoints(); - tgdir.Reverse(); - line->Reverse(); - -//-- printf("\nIntWalk_PWalking_2.gxx Reverse %3d\n",indextg); - sensCheminement = -1; - tgfirst = tglast; - tglast = Standard_False; - ChoixIso = choixIsoSav; -#if 0 - pasuv[0]=pasSav[0]; - pasuv[1]=pasSav[1]; - pasuv[2]=pasSav[2]; - pasuv[3]=pasSav[3]; -#else - Standard_Real u1,v1,u2,v2; - Standard_Real U1,V1,U2,V2; - Standard_Integer nn=line->NbPoints(); - if(nn>2) { - line->Value(nn).Parameters(u1,v1,u2,v2); - line->Value(nn-1).Parameters(U1,V1,U2,V2); - pasuv[0]=Abs(u1-U1); - pasuv[1]=Abs(v1-V1); - pasuv[2]=Abs(u2-U2); - pasuv[3]=Abs(v2-V2); - } -#endif - - } - } - else { - if ( pasuv[0]*0.5 < ResoU1 - && pasuv[1]*0.5 < ResoV1 - && pasuv[2]*0.5 < ResoU2 - && pasuv[3]*0.5 < ResoV2 - ) { - if (!previoustg) { - tglast = Standard_True; // IS IT ENOUGH ???? - } - - if (!DejaReparti) { //restart in the other direction - DejaReparti = Standard_True; - previousPoint = line->Value(1); - previoustg = Standard_False; - previousd1 = firstd1; - previousd2 = firstd2; - previousd = tgdir; - indextg = line->NbPoints(); - tgdir.Reverse(); - line->Reverse(); - -//-- printf("\nIntWalk_PWalking_2.gxx Reverse %3d\n",indextg); - - sensCheminement = -1; - tgfirst = tglast; - tglast = Standard_False; - ChoixIso = choixIsoSav; - -#if 0 - pasuv[0]=pasSav[0]; - pasuv[1]=pasSav[1]; - pasuv[2]=pasSav[2]; - pasuv[3]=pasSav[3]; -#else - Standard_Real u1,v1,u2,v2; - Standard_Real U1,V1,U2,V2; - Standard_Integer nn=line->NbPoints(); - if(nn>2) { - line->Value(nn).Parameters(u1,v1,u2,v2); - line->Value(nn-1).Parameters(U1,V1,U2,V2); - pasuv[0]=Abs(u1-U1); - pasuv[1]=Abs(v1-V1); - pasuv[2]=Abs(u2-U2); - pasuv[3]=Abs(v2-V2); - } -#endif - } - else Arrive = Standard_True; - } - else { - pasuv[0]*=0.5; - pasuv[1]*=0.5; - pasuv[2]*=0.5; - pasuv[3]*=0.5; - } - } -} - - - - - - - - - - diff --git a/src/IntWalk/IntWalk_PWalking_3.gxx b/src/IntWalk/IntWalk_PWalking_3.gxx deleted file mode 100644 index 1ef0e58c21..0000000000 --- a/src/IntWalk/IntWalk_PWalking_3.gxx +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include - -//#define DEBUG 0 - -namespace { -//OCC431(apo): modified -> -static const Standard_Real CosRef2D = Cos(M_PI/9.0), AngRef2D = M_PI/2.0; - -static const Standard_Real d = 7.0; -} - -IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() - -// test if vector is observed by calculating an increase of vector -// or the previous point and its tangent, the new calculated point and its -// tangent; it is possible to find a cube passing by the 2 points and having as a -// derivative the tangents of the intersection -// calculate the point with parameter 0.5 on cube=p1 -// calculate the medium point of 2 points of intersection=p2 -// if arrow/2<=||p1p2||<= arrow consider that the vector is observed -// otherwise adjust the step depending on the ratio ||p1p2||/vector -// and the previous step -// test if in 2 tangent planes of surfaces there is no too great angle2d -// grand : if yes divide the step -// test if there is no change of side -// -{ - if(line->NbPoints() ==1 ) { - STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=STATIC_PRECEDENT_INFLEXION=0; - } - - IntWalk_StatusDeflection Status = IntWalk_OK; - Standard_Real FlecheCourante ,Ratio; - - - const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point(); - //================================================================================== - //========= S t o p o n p o i n t ============ - //================================================================================== - if (myIntersectionOn2S.IsTangent()) { - return IntWalk_ArretSurPoint; - } - - const gp_Dir& TgCourante = myIntersectionOn2S.Direction(); - - //================================================================================== - //========= R i s k o f i n f l e x i o n p o i n t ============ - //================================================================================== - if (TgCourante.Dot(previousd)<0) { - //------------------------------------------------------------ - //-- Risk of inflexion point : Divide the step by 2 - //-- Initialize STATIC_PRECEDENT_INFLEXION so that - //-- at the next call to return Pas_OK if there is no - //-- more risk of the point of inflexion - //------------------------------------------------------------ - - pasuv[0]*=0.5; - pasuv[1]*=0.5; - pasuv[2]*=0.5; - pasuv[3]*=0.5; - STATIC_PRECEDENT_INFLEXION+=3; - if (pasuv[0] < ResoU1 && pasuv[1] 0) { - STATIC_PRECEDENT_INFLEXION -- ; - return IntWalk_OK; - } - } - - //================================================================================== - //========= D e t e c t c o n f u s e d P o in t s =========== - //================================================================================== - - Standard_Real Dist = previousPoint.Value(). - SquareDistance(CurrentPoint.Value()); - - - if (Dist < tolconf*tolconf ) { - pasuv[0] = Max(5.*ResoU1,Min(1.5*pasuv[0],pasInit[0])); - pasuv[1] = Max(5.*ResoV1,Min(1.5*pasuv[1],pasInit[1])); - pasuv[2] = Max(5.*ResoU2,Min(1.5*pasuv[2],pasInit[2])); - pasuv[3] = Max(5.*ResoV2,Min(1.5*pasuv[3],pasInit[3])); - Status = IntWalk_PointConfondu; - } - - //================================================================================== - Standard_Real Up1,Vp1,Uc1,Vc1,Du1,Dv1,AbsDu1,AbsDu2,AbsDv1,AbsDv2; - Standard_Real Up2,Vp2,Uc2,Vc2,Du2,Dv2; - - previousPoint.Parameters(Up1,Vp1,Up2,Vp2); - CurrentPoint.Parameters(Uc1,Vc1,Uc2,Vc2); - - Du1 = Uc1 - Up1; Dv1 = Vc1 - Vp1; - Du2 = Uc2 - Up2; Dv2 = Vc2 - Vp2; - - AbsDu1 = Abs(Du1); - AbsDu2 = Abs(Du2); - AbsDv1 = Abs(Dv1); - AbsDv2 = Abs(Dv2); - //================================================================================= - //==== S t e p o f p r o g r e s s i o n (between previous and Current) ======= - //================================================================================= - if ( AbsDu1 < ResoU1 && AbsDv1 < ResoV1 - && AbsDu2 < ResoU2 && AbsDv2 < ResoV2) { - pasuv[0] = ResoU1; pasuv[1] = ResoV1; pasuv[2] = ResoU2; pasuv[3] = ResoV2; - return(IntWalk_ArretSurPointPrecedent); - } - //================================================================================== - - Standard_Real tolArea = 100.0; - if (ResoU1 < Precision::PConfusion() || - ResoV1 < Precision::PConfusion() || - ResoU2 < Precision::PConfusion() || - ResoV2 < Precision::PConfusion() ) - tolArea = tolArea*2.0; - - Standard_Real Cosi1, CosRef1, Ang1, AngRef1, ResoUV1, Duv1, d1, tolCoeff1; - Standard_Real Cosi2, CosRef2, Ang2, AngRef2, ResoUV2, Duv2, d2, tolCoeff2; - Cosi1 = Du1*previousd1.X() + Dv1*previousd1.Y(); - Cosi2 = Du2*previousd2.X() + Dv2*previousd2.Y(); - Duv1 = Du1*Du1 + Dv1*Dv1; - Duv2 = Du2*Du2 + Dv2*Dv2; - ResoUV1 = ResoU1*ResoU1 + ResoV1*ResoV1; - ResoUV2 = ResoU2*ResoU2 + ResoV2*ResoV2; - // - //modified by NIZNHY-PKV Wed Nov 13 12:25:44 2002 f - // - Standard_Real aMinDiv2=Precision::Confusion(); - aMinDiv2=aMinDiv2*aMinDiv2; - // - d1=d; - if (Duv1>aMinDiv2) { - d1 = Abs(ResoUV1/Duv1); - d1 = Min(Sqrt(d1)*tolArea, d); - } - //d1 = Abs(ResoUV1/Duv1); - //d1 = Min(Sqrt(d1)*tolArea,d); - //modified by NIZNHY-PKV Wed Nov 13 12:34:30 2002 t - tolCoeff1 = Exp(d1); - // - //modified by NIZNHY-PKV Wed Nov 13 12:34:43 2002 f - d2=d; - if (Duv2>aMinDiv2) { - d2 = Abs(ResoUV2/Duv2); - d2 = Min(Sqrt(d2)*tolArea,d); - } - //d2 = Abs(ResoUV2/Duv2); - //d2 = Min(Sqrt(d2)*tolArea,d); - //modified by NIZNHY-PKV Wed Nov 13 12:34:53 2002 t - tolCoeff2 = Exp(d2); - CosRef1 = CosRef2D/tolCoeff1; - CosRef2 = CosRef2D/tolCoeff2; - // - //================================================================================== - //== The points are not confused : == - //== D e t e c t t h e S t o p a t p r e v i o u s p o i n t == - //== N o t T o o G r e a t (angle in space UV) == - //== C h a n g e o f s i d e == - //================================================================================== - if (Status != IntWalk_PointConfondu) { - if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) { - pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5; - if (pasuv[0] AngRef1 || Ang2 > AngRef2) { - pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5; - if (pasuv[0]1e-16) { - Ratio = 0.5*(fleche/FlecheCourante); - } - else { - Ratio = 10.0; - } - Standard_Real pasSu1 = pasuv[0]; - Standard_Real pasSv1 = pasuv[1]; - Standard_Real pasSu2 = pasuv[2]; - Standard_Real pasSv2 = pasuv[3]; - - //-- In case if - //-- a point at U+DeltaU is required, .... - //-- return a point at U + Epsilon - //-- Epsilon << DeltaU. - - if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1; - if(pasuv[1]< AbsDv1) pasuv[1] = AbsDv1; - if(pasuv[2]< AbsDu2) pasuv[2] = AbsDu2; - if(pasuv[3]< AbsDv2) pasuv[3] = AbsDv2; - - if(pasuv[0]10.0 ) { Ratio=10.0; } - Standard_Real R1,R = pasInit[0]/pasuv[0]; - R1= pasInit[1]/pasuv[1]; if(R1 R) Ratio=R; - pasuv[0] = Min(Ratio*pasuv[0],pasInit[0]); - pasuv[1] = Min(Ratio*pasuv[1],pasInit[1]); - pasuv[2] = Min(Ratio*pasuv[2],pasInit[2]); - pasuv[3] = Min(Ratio*pasuv[3],pasInit[3]); - if (pasuv[0] != pasSu1 || pasuv[2] != pasSu2|| - pasuv[1] != pasSv1 || pasuv[3] != pasSv2) { - if(++STATIC_BLOCAGE_SUR_PAS_TROP_GRAND > 5) { - STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0; - return IntWalk_PasTropGrand; - } - } - if(Status == IntWalk_OK) { - STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0; - //-- Try to increase the step - } - return Status; - } - else { //-- CurrentVector > vector*0.5 - if (FlecheCourante > fleche) { //-- Current step too Great - Ratio = fleche/FlecheCourante; - pasuv[0] = Ratio*pasuv[0]; - pasuv[1] = Ratio*pasuv[1]; - pasuv[2] = Ratio*pasuv[2]; - pasuv[3] = Ratio*pasuv[3]; - //if(++STATIC_BLOCAGE_SUR_PAS_TROP_GRAND > 5) { - // STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0; - return IntWalk_PasTropGrand; - //} - } - else { //-- vector/2 < CurrentVector <= vector - Ratio = 0.75 * (fleche / FlecheCourante); - } - } - pasuv[0] = Max(5.*ResoU1,Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0])); - pasuv[1] = Max(5.*ResoV1,Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1])); - pasuv[2] = Max(5.*ResoU2,Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2])); - pasuv[3] = Max(5.*ResoV2,Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3])); - if(Status == IntWalk_OK) STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0; - return Status; -} - - - diff --git a/src/IntWalk/IntWalk_PWalking_4.gxx b/src/IntWalk/IntWalk_PWalking_4.gxx deleted file mode 100644 index 5b97a85b92..0000000000 --- a/src/IntWalk/IntWalk_PWalking_4.gxx +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -//-- -//-- Modif of 5 October 94 (LBR) -//-- if(Trouve) ... -//-- outpasses a border, Duv[.] = -1 -1 -1 -1 -//-- keep the same iso limited (see if(k!=1) ) -//-- - -//-- Modif of 8 July 96 (LBR) -//-- simplify processing of auto-intersections. -//-- Idea : Test closed loop in 3d and in 2d. -//-- - -#include - - -Standard_Boolean IntWalk_PWalking:: - TestArret(const Standard_Boolean DejaReparti, - TColStd_Array1OfReal& Param, - IntImp_ConstIsoparametric& ChoixIso) - -// -// test if the point of intersection set by these parameters remains in the -// natural domain of each square. -// if the point outpasses reframe to find the best iso (border) -// that intersects easiest the other square -// otherwise test if closed line is present -// -{ - Standard_Real Uvd[4],Uvf[4],Epsuv[4],Duv[4],Uvp[4],dv,dv2,ParC[4]; - Standard_Real DPc,DPb; - Standard_Integer i = 0, k = 0; - Epsuv[0] = ResoU1; - Epsuv[1] = ResoV1; - Epsuv[2] = ResoU2; - Epsuv[3] = ResoV2; - previousPoint.Parameters(Uvp[0],Uvp[1],Uvp[2],Uvp[3]); - - Standard_Real SolParam[4]; - myIntersectionOn2S.Point().Parameters(SolParam[0],SolParam[1],SolParam[2],SolParam[3]); - - Standard_Boolean Trouve = Standard_False; - - Uvd[0]=Um1; Uvf[0]=UM1; Uvd[1]=Vm1; Uvf[1]=VM1; - Uvd[2]=Um2; Uvf[2]=UM2; Uvd[3]=Vm2; Uvf[3]=VM2; - - Standard_Integer im1; - for ( i = 1,im1 = 0;i<=4;i++,im1++) { - switch(i) { - case 1: k=2; break; - case 2: k=1; break; - case 3: k=4; break; - case 4: k=3; break; - } - if (Param(i) < (Uvd[im1]-Epsuv[im1]) || - SolParam[im1] < (Uvd[im1]-Epsuv[im1])) //-- Current ----- Bound Inf ----- Previous - { - Trouve = Standard_True; //-- - DPc = Uvp[im1]-Param(i); //-- Previous - Current - DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf - ParC[im1] = Uvd[im1]; //-- ParamCorrige - dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction) - dv2 = dv*dv; - if(dv2>RealEpsilon()) { //-- Progress at the other Direction ? - Duv[im1] = DPc*DPb + dv2; - Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); - } - else { - Duv[im1]=-1.0; //-- If no progress, do not change - } //-- the choice of iso - } - else if (Param(i) > (Uvf[im1] + Epsuv[im1]) || - SolParam[im1] > (Uvf[im1] + Epsuv[im1]))//-- Previous ----- Bound Sup ----- Current - { - Trouve = Standard_True; //-- - DPc = Param(i)-Uvp[im1]; //-- Current - Previous - DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous - ParC[im1] = Uvf[im1]; //-- Param Corrige - dv = Param(k)-Uvp[k-1]; //-- Current - Previous (other Direction) - dv2 = dv*dv; - if(dv2>RealEpsilon()) { //-- Progress in other Direction ? - Duv[im1] = DPc*DPb + dv2; - Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2); - } - else { - Duv[im1]=-1.0; //-- If no progress, do not change - } //-- the choice of iso - } - else { - Duv[im1]= -1.; - ParC[im1]=Param(i); - } - } - - if (Trouve) { - //-------------------------------------------------- - //-- One of Parameters u1,v1,u2,v2 is outside of -- - //-- the natural limits. -- - //-- Find the best direction of -- - //-- progress and reframe the parameters. -- - //-------------------------------------------------- - Standard_Real ddv = -1.0; - k=-1; - for (i=0;i<=3;i++) { - Param(i+1) = ParC[i]; - if(Duv[i]>ddv) { - ddv = Duv[i]; - k=i; - } - } - if(k!=-1) { - ChoixIso = ChoixRef[k]; - } - else { - if((ParC[0]<=Uvd[0]+Epsuv[0]) || (ParC[0]>=Uvf[0]-Epsuv[0])) { - ChoixIso = IntImp_UIsoparametricOnCaro1; - } - else if((ParC[1]<=Uvd[1]+Epsuv[1]) || (ParC[1]>=Uvf[1]-Epsuv[1])) { - ChoixIso = IntImp_VIsoparametricOnCaro1; - } - else if((ParC[2]<=Uvd[2]+Epsuv[2]) || (ParC[2]>=Uvf[2]-Epsuv[2])) { - ChoixIso = IntImp_UIsoparametricOnCaro2; - } - else if((ParC[3]<=Uvd[3]+Epsuv[3]) || (ParC[3]>=Uvf[3]-Epsuv[3])) { - ChoixIso = IntImp_VIsoparametricOnCaro2; - } - } - close = Standard_False; - return Standard_True; - } - else - { - if (!DejaReparti) { // find if line closed - - Standard_Real u,v; - const IntSurf_PntOn2S& POn2S1=line->Value(1); - //On S1 - POn2S1.ParametersOnS1(u,v); - gp_Pnt2d P1uvS1(u,v); - previousPoint.ParametersOnS1(u,v); - gp_Pnt2d PrevuvS1(u,v); - myIntersectionOn2S.Point().ParametersOnS1(u,v); - gp_Pnt2d myIntersuvS1(u,v); - Standard_Boolean close2dS1 = (P1uvS1.XY()-PrevuvS1.XY())* - (P1uvS1.XY()-myIntersuvS1.XY()) < 0.0; - //On S2 - POn2S1.ParametersOnS2(u,v); - gp_Pnt2d P1uvS2(u,v); - previousPoint.ParametersOnS2(u,v); - gp_Pnt2d PrevuvS2(u,v); - myIntersectionOn2S.Point().ParametersOnS2(u,v); - gp_Pnt2d myIntersuvS2(u,v); - Standard_Boolean close2dS2 = (P1uvS2.XY()-PrevuvS2.XY())* - (P1uvS2.XY()-myIntersuvS2.XY()) < 0.0; - - close = close2dS1 && close2dS2; - return close; - } - else return Standard_False; - } -} - - diff --git a/src/Intf/Intf.cdl b/src/Intf/Intf.cdl index fbeded13e5..9621ab099c 100644 --- a/src/Intf/Intf.cdl +++ b/src/Intf/Intf.cdl @@ -101,11 +101,6 @@ is -- line and a polyhedron. Points of intersection and zones -- of tangence. - generic class InterferencePolyhedron; - ---Purpose: Compute the interference between two polyhedron. Points - -- of intersection , polylines of intersection and zones of - -- tangence. - --- Package Methods : -- diff --git a/src/MAT/MAT.cdl b/src/MAT/MAT.cdl index 5ac9214a60..0680ad8e25 100644 --- a/src/MAT/MAT.cdl +++ b/src/MAT/MAT.cdl @@ -23,11 +23,6 @@ uses is - generic class Mat; - --- Purpose: The Algorithm of Computation of the Map of - -- bisecting locus. - - -------------------------------------------------- -- Classes of exploration of the Bisecting Locus. -------------------------------------------------- diff --git a/src/MAT2d/MAT2d.cdl b/src/MAT2d/MAT2d.cdl index 8a1e88a523..94d57936b5 100644 --- a/src/MAT2d/MAT2d.cdl +++ b/src/MAT2d/MAT2d.cdl @@ -36,17 +36,16 @@ is deferred class SketchExplorer; ---Purpose: SletchExplorer contains an iterator on a set of geometrys -- from Geom2d. It's use by BisectingLocus. - - generic class BisectingLocus; - ---Purpose: Constuction of the map of the bisector locus on a - -- set of geometrys from Geom2d. + class Tool2d; ---Purpose: Tool2d contains the geometrys of the map. Tool2d -- contains the set of the geometric's methode used for -- the map's computation. - class Mat2d instantiates Mat from MAT (Tool2d); + class Mat2d; + --- Purpose: The Algorithm of Computation of the Map of + -- bisecting locus. class Connexion; ---Purpose: a Connexion links two lines. diff --git a/src/MAT/MAT_Mat.cdl b/src/MAT2d/MAT2d_Mat2d.cdl similarity index 90% rename from src/MAT/MAT_Mat.cdl rename to src/MAT2d/MAT2d_Mat2d.cdl index 37de320fdb..f6cb5f69e4 100644 --- a/src/MAT/MAT_Mat.cdl +++ b/src/MAT2d/MAT2d_Mat2d.cdl @@ -14,7 +14,7 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class Mat from MAT (Tool as any) +class Mat2d from MAT2d ---Purpose: this class contains the generic algoritm of -- computation of the bisecting locus. @@ -22,20 +22,21 @@ generic class Mat from MAT (Tool as any) uses Side from MAT, Bisector from MAT, - ListOfEdge from MAT, - ListOfBisector from MAT, + ListOfEdge from MAT, + ListOfBisector from MAT, DataMapOfIntegerBisector from MAT, - DataMapOfIntegerInteger from TColStd + DataMapOfIntegerInteger from TColStd, + Tool2d from MAT2d is Create ---Purpose: Empty construtor. - returns Mat from MAT; + returns Mat2d from MAT2d; --- Category : Computation. - CreateMat(me : in out ; aTool : in out Tool) + CreateMat(me : in out ; aTool : in out Tool2d from MAT2d) ---Purpose: Algoritm of computation of the bisecting locus. is static; @@ -55,7 +56,7 @@ is Intersect( me : in out ; - atool : in out Tool ; + atool : in out Tool2d from MAT2d; aside : Integer ; noofbisectorstoremove: in out Integer ; bisector1 : mutable Bisector from MAT; @@ -105,4 +106,4 @@ fields thecurrentindex : Integer; isDone : Boolean; -end Mat; +end Mat2d; diff --git a/src/MAT/MAT_Mat.gxx b/src/MAT2d/MAT2d_Mat2d.cxx similarity index 98% rename from src/MAT/MAT_Mat.gxx rename to src/MAT2d/MAT2d_Mat2d.cxx index 5347f24db4..cd2db7b60f 100644 --- a/src/MAT/MAT_Mat.gxx +++ b/src/MAT2d/MAT2d_Mat2d.cxx @@ -14,6 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include #include @@ -22,13 +24,14 @@ #include #include #include +#include //======================================================================== -// function : MAT_Mat +// function : MAT2d_Mat2d // purpose : //======================================================================== -MAT_Mat::MAT_Mat() +MAT2d_Mat2d::MAT2d_Mat2d() { thenumberofbisectors = 0; thenumberofedges = 0; @@ -117,7 +120,7 @@ MAT_Mat::MAT_Mat() // dans la boucle. // //======================================================================== -void MAT_Mat::CreateMat(Tool& atool) +void MAT2d_Mat2d::CreateMat(MAT2d_Tool2d& atool) { #ifdef ICONTINUE @@ -775,7 +778,7 @@ void MAT_Mat::CreateMat(Tool& atool) // function : LoadBisectorsToRemove // purpose : Chargement des bisectrices a effacer. //======================================================================== -void MAT_Mat::LoadBisectorsToRemove +void MAT2d_Mat2d::LoadBisectorsToRemove ( Standard_Integer& noofbisectorstoremove, const Standard_Real distance1, const Standard_Real distance2, @@ -842,7 +845,7 @@ void MAT_Mat::LoadBisectorsToRemove // Si Intersection de avec ses // descendants les plus a gauche et les plus a droite. //========================================================================v -void MAT_Mat::Intersect( Tool& atool, +void MAT2d_Mat2d::Intersect( MAT2d_Tool2d& atool, const Standard_Integer aside, Standard_Integer& noofbisectortoremove, const Handle(MAT_Bisector)& firstbisector, @@ -933,7 +936,7 @@ void MAT_Mat::Intersect( Tool& atool, // function : Init // purpose : //======================================================================== -void MAT_Mat::Init() +void MAT2d_Mat2d::Init() { roots->First(); } @@ -942,7 +945,7 @@ void MAT_Mat::Init() // function : More // purpose : //======================================================================== -Standard_Boolean MAT_Mat::More() const +Standard_Boolean MAT2d_Mat2d::More() const { return roots->More(); } @@ -951,7 +954,7 @@ Standard_Boolean MAT_Mat::More() const // function : Next // purpose : //======================================================================== -void MAT_Mat::Next() +void MAT2d_Mat2d::Next() { roots->Next(); } @@ -960,7 +963,7 @@ void MAT_Mat::Next() // function : Bisector // purpose : //======================================================================== -Handle(MAT_Bisector) MAT_Mat::Bisector() const +Handle(MAT_Bisector) MAT2d_Mat2d::Bisector() const { return roots->Current(); } @@ -969,7 +972,7 @@ Handle(MAT_Bisector) MAT_Mat::Bisector() const // function : NumberOfBisectors // purpose : //======================================================================== -Standard_Integer MAT_Mat::NumberOfBisectors() const +Standard_Integer MAT2d_Mat2d::NumberOfBisectors() const { return thenumberofbisectors; } @@ -978,7 +981,7 @@ Standard_Integer MAT_Mat::NumberOfBisectors() const // function : SemiInfinite // purpose : //======================================================================== -Standard_Boolean MAT_Mat::SemiInfinite() const +Standard_Boolean MAT2d_Mat2d::SemiInfinite() const { return semiInfinite; } @@ -987,7 +990,7 @@ Standard_Boolean MAT_Mat::SemiInfinite() const // function : IsDone // purpose : //======================================================================== -Standard_Boolean MAT_Mat::IsDone() const +Standard_Boolean MAT2d_Mat2d::IsDone() const { return isDone; } diff --git a/src/MoniTool/MoniTool.cdl b/src/MoniTool/MoniTool.cdl index bdb70182a9..5f4fea81bc 100644 --- a/src/MoniTool/MoniTool.cdl +++ b/src/MoniTool/MoniTool.cdl @@ -32,9 +32,7 @@ is -- Element, generic Elem, and instance for Transient class DataInfo; -- used in Elem : this one is for Transient deferred class Element; - generic class Elem; - class TransientElem instantiates Elem - (Transient, MapTransientHasher from TColStd, DataInfo); + class TransientElem; class ElemHasher; diff --git a/src/MoniTool/MoniTool_Elem.cdl b/src/MoniTool/MoniTool_TransientElem.cdl similarity index 70% rename from src/MoniTool/MoniTool_Elem.cdl rename to src/MoniTool/MoniTool_TransientElem.cdl index d714ee4d34..c520d20d7c 100644 --- a/src/MoniTool/MoniTool_Elem.cdl +++ b/src/MoniTool/MoniTool_TransientElem.cdl @@ -14,31 +14,30 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class Elem from MoniTool - (TheKey as any; - TheHasher as any; - TheInfo as any) - inherits Element +class TransientElem from MoniTool inherits Element - ---Purpose : an Elem defines an Element for a specific input class + ---Purpose : an TransientElem defines an Element for a specific input class -- its definition includes the value of the Key to be mapped, -- and the HashCoder associated to the class of the Key -- - -- TheKey defines the class to be keyed - -- TheHasher is the associated Hasher - -- TheInfo is an additionnal class which helps to provide + -- Transient from Standard defines the class to be keyed + -- MapTransientHasher from TColStd is the associated Hasher + -- DataInfo from MoniTool is an additionnal class which helps to provide -- informations on the value (template : see DataInfo) -uses CString +uses CString, + Transient from Standard, + MapTransientHasher from TColStd, + DataInfo from MoniTool is - Create (akey : any TheKey) returns mutable Elem; - ---Purpose : Creates a Elem with a Value. This Value can then not be + Create (akey : any Transient from Standard) returns mutable TransientElem; + ---Purpose : Creates a TransientElem with a Value. This Value can then not be -- changed. It is used by the Hasher to compute the HashCode, -- which will then be stored for an immediate reading. - Value (me) returns any TheKey is static; + Value (me) returns any Transient from Standard is static; ---Purpose : Returns the contained value ---C++ : return const & @@ -57,6 +56,6 @@ is fields - theval : TheKey; + theval : Transient from Standard; -end Elem; +end TransientElem; diff --git a/src/MoniTool/MoniTool_Elem.gxx b/src/MoniTool/MoniTool_TransientElem.cxx similarity index 53% rename from src/MoniTool/MoniTool_Elem.gxx rename to src/MoniTool/MoniTool_TransientElem.cxx index ecd6a964ff..7000b1f3dd 100644 --- a/src/MoniTool/MoniTool_Elem.gxx +++ b/src/MoniTool/MoniTool_TransientElem.cxx @@ -11,31 +11,35 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//#include +#include + #include +#include +#include +#include -MoniTool_Elem::MoniTool_Elem (const TheKey& akey) +MoniTool_TransientElem::MoniTool_TransientElem (const Handle(Standard_Transient)& akey) : theval (akey) -{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); } +{ SetHashCode ( TColStd_MapTransientHasher::HashCode (akey, IntegerLast() ) ); } - const TheKey& MoniTool_Elem::Value () const + const Handle_Standard_Transient& MoniTool_TransientElem::Value () const { return theval; } - Standard_Boolean MoniTool_Elem::Equates + Standard_Boolean MoniTool_TransientElem::Equates (const Handle(MoniTool_Element)& other) const { if (other.IsNull()) return Standard_False; if (GetHashCode() != other->GetHashCode()) return Standard_False; if (other->DynamicType() != DynamicType()) return Standard_False; - Handle(MoniTool_Elem) another = Handle(MoniTool_Elem)::DownCast(other); + Handle(MoniTool_TransientElem) another = Handle(MoniTool_TransientElem)::DownCast(other); // return (theval == another->Value()); - return TheHasher::IsEqual (theval,another->Value()); + return TColStd_MapTransientHasher::IsEqual (theval,another->Value()); } - Handle(Standard_Type) MoniTool_Elem::ValueType () const - { return TheInfo::Type(theval); } + Handle(Standard_Type) MoniTool_TransientElem::ValueType () const + { return MoniTool_DataInfo::Type(theval); } - Standard_CString MoniTool_Elem::ValueTypeName () const - { return TheInfo::TypeName(theval); } + Standard_CString MoniTool_TransientElem::ValueTypeName () const + { return MoniTool_DataInfo::TypeName(theval); } diff --git a/src/Transfer/Transfer.cdl b/src/Transfer/Transfer.cdl index 0971b5450f..ebe7492dd3 100644 --- a/src/Transfer/Transfer.cdl +++ b/src/Transfer/Transfer.cdl @@ -35,7 +35,6 @@ is deferred class Binder; class VoidBinder; - generic class SimpleBinder; class SimpleBinderOfTransient; class BinderOfTransientInteger; class TransientListBinder; diff --git a/src/Transfer/Transfer_SimpleBinder.gxx b/src/Transfer/Transfer_SimpleBinder.gxx deleted file mode 100644 index 2502f84cb4..0000000000 --- a/src/Transfer/Transfer_SimpleBinder.gxx +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -//#include classe generique - - -// "TheResult" identifie la classe donnee en parametre du Resultat - - -Transfer_SimpleBinder::Transfer_SimpleBinder () { } - - Transfer_SimpleBinder::Transfer_SimpleBinder (const TheResult& res) - : theres (res) - { SetResultPresent(); } - - -// Standard_Boolean Transfer_SimpleBinder::IsMultiple() const -// { return Standard_False; } - - - Handle(Standard_Type) Transfer_SimpleBinder::ResultType () const - { return TheInfo::Type (theres); } // correspond a "STANDARD_TYPE(TheResult)" - - Standard_CString Transfer_SimpleBinder::ResultTypeName () const - { return TheInfo::TypeName (theres); } // correspond a "STANDARD_TYPE(TheResult)" - - - void Transfer_SimpleBinder::SetResult (const TheResult& res) -{ - SetResultPresent(); - theres = res; -} - - const TheResult& Transfer_SimpleBinder::Result () const - { return theres; } - - TheResult& Transfer_SimpleBinder::CResult () - { SetResultPresent(); return theres; } diff --git a/src/TransferBRep/TransferBRep.cdl b/src/TransferBRep/TransferBRep.cdl index 05e5220946..a9b34cbfc1 100644 --- a/src/TransferBRep/TransferBRep.cdl +++ b/src/TransferBRep/TransferBRep.cdl @@ -29,8 +29,7 @@ is -- class Analyzer; class ShapeInfo; - class BinderOfShape instantiates SimpleBinder from Transfer - (Shape from TopoDS, ShapeInfo); + class BinderOfShape; class ShapeBinder; class ShapeListBinder; diff --git a/src/Transfer/Transfer_SimpleBinder.cdl b/src/TransferBRep/TransferBRep_BinderOfShape.cdl similarity index 75% rename from src/Transfer/Transfer_SimpleBinder.cdl rename to src/TransferBRep/TransferBRep_BinderOfShape.cdl index 8397915522..fa9fd280f4 100644 --- a/src/Transfer/Transfer_SimpleBinder.cdl +++ b/src/TransferBRep/TransferBRep_BinderOfShape.cdl @@ -14,34 +14,32 @@ -- Alternatively, this file may be used under the terms of Open CASCADE -- commercial license or contractual agreement. -generic class SimpleBinder from Transfer - - (TheResult as any; -- any : avoid Transient classes - TheInfo as any) -- template : DataInfo - - inherits Binder +class BinderOfShape from TransferBRep inherits Binder from Transfer ---Purpose : Allows direct binding between a starting Object and the Result -- of its transfer when it is Unique. - -- The Result itself is defined as a formal parameter - -- Warning : While it is possible to instantiate SimpleBinder with any Type + -- The Result itself is defined as a formal parameter + -- Warning : While it is possible to instantiate BinderOfShape with any Type -- for the Result, it is not advisable to instantiate it with -- Transient Classes, because such Results are directly known and -- managed by TransferProcess & Co, through -- SimpleBinderOfTransient : this class looks like instantiation - -- of SimpleBinder, but its method ResultType + -- of BinderOfShape, but its method ResultType -- is adapted (reads DynamicType of the Result) -uses CString, Type +uses CString, + Type, + Shape from TopoDS, + ShapeInfo from TransferBRep raises TransferFailure is - Create returns mutable SimpleBinder; - ---Purpose : normal standard constructor, creates an empty SimpleBinder + Create returns mutable BinderOfShape; + ---Purpose : normal standard constructor, creates an empty BinderOfShape - Create (res : any TheResult) returns mutable SimpleBinder; + Create (res : any Shape from TopoDS) returns mutable BinderOfShape; ---Purpose : constructor which in the same time defines the result -- IsMultiple (me) returns Boolean; @@ -51,23 +49,23 @@ is ResultType (me) returns Type; ---Purpose : Returns the Type permitted for the Result, i.e. the Type - -- of the Parameter Class (statically defined) + -- of the Parameter Class (statically defined) ResultTypeName (me) returns CString; ---Purpose : Returns the Type Name computed for the Result (dynamic) - SetResult (me : mutable; res : any TheResult) + SetResult (me : mutable; res : any Shape from TopoDS) ---Purpose : Defines the Result raises TransferFailure; -- Error if the Result is already used (see class Binder) - Result (me) returns any TheResult + Result (me) returns any Shape from TopoDS ---Purpose : Returns the defined Result, if there is one raises TransferFailure; -- Error if the Result is not defined (see class Binder) ---C++ : return const & - CResult (me : mutable) returns any TheResult; + CResult (me : mutable) returns any Shape from TopoDS; ---Purpose : Returns the defined Result, if there is one, and allows to -- change it (avoids Result + SetResult). -- Admits that Result can be not yet defined @@ -76,6 +74,6 @@ is fields - theres : TheResult; + theres : Shape from TopoDS; -end SimpleBinder; +end BinderOfShape; diff --git a/src/TransferBRep/TransferBRep_BinderOfShape.cxx b/src/TransferBRep/TransferBRep_BinderOfShape.cxx new file mode 100644 index 0000000000..1b8948d0c3 --- /dev/null +++ b/src/TransferBRep/TransferBRep_BinderOfShape.cxx @@ -0,0 +1,47 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + + +TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (){ } + +TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (const TopoDS_Shape& res) +: theres (res) +{ SetResultPresent(); } + + +// Standard_Boolean TransferBRep_BinderOfShape::IsMultiple() const +// { return Standard_False; } + + +Handle(Standard_Type) TransferBRep_BinderOfShape::ResultType () const +{ return TransferBRep_ShapeInfo::Type (theres); } // correspond a "STANDARD_TYPE(TopoDS_Shape)" + +Standard_CString TransferBRep_BinderOfShape::ResultTypeName () const +{ return TransferBRep_ShapeInfo::TypeName (theres); } // correspond a "STANDARD_TYPE(TopoDS_Shape)" + + +void TransferBRep_BinderOfShape::SetResult (const TopoDS_Shape& res) +{ + SetResultPresent(); + theres = res; +} + +const TopoDS_Shape& TransferBRep_BinderOfShape::Result () const +{ return theres; } + +TopoDS_Shape& TransferBRep_BinderOfShape::CResult () +{ SetResultPresent(); return theres; } -- 2.20.1