1 // Created on: 1997-04-17
2 // Created by: Christophe MARION
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
23 #include <HLRAlgo_Interference.hxx>
24 #include <HLRAlgo_Intersection.hxx>
25 #include <HLRBRep_Data.hxx>
26 #include <HLRBRep_EdgeInterferenceTool.hxx>
28 //=======================================================================
29 //function : HLRBRep_EdgeInterferenceTool
31 //=======================================================================
32 HLRBRep_EdgeInterferenceTool::HLRBRep_EdgeInterferenceTool
33 (const Handle(HLRBRep_Data)& DS) : myDS(DS)
37 //=======================================================================
40 //=======================================================================
42 void HLRBRep_EdgeInterferenceTool::LoadEdge()
45 Standard_ShortReal t1,t2;
46 HLRBRep_Array1OfEData& ED = myDS->EDataArray();
47 HLRBRep_EdgeData& ed = ED(myDS->Edge());
48 ed.Status().Bounds(p1,t1,p2,t2);
49 inter[0].Parameter(p1);
50 inter[0].Tolerance(t1);
51 inter[0].Index(ed.VSta());
52 inter[1].Parameter(p2);
53 inter[1].Tolerance(t2);
54 inter[1].Index(ed.VEnd());
57 //=======================================================================
58 //function : EdgeGeometry
60 //=======================================================================
62 void HLRBRep_EdgeInterferenceTool::EdgeGeometry
63 (const Standard_Real Param,
66 Standard_Real& CrLE) const
69 myDS->LocalLEGeometry2D(Param,TgLE,NmLE,CrLE);
70 Tgt.SetCoord(TgLE.X(),TgLE.Y(),0);
71 Nrm.SetCoord(NmLE.X(),NmLE.Y(),0);
74 //=======================================================================
75 //function : SameInterferences
77 //=======================================================================
79 Standard_Boolean HLRBRep_EdgeInterferenceTool::SameInterferences
80 (const HLRAlgo_Interference& I1,
81 const HLRAlgo_Interference& I2) const
83 Standard_Integer ind1 = I1.Intersection().Index();
84 Standard_Integer ind2 = I2.Intersection().Index();
85 if ( ind1 != 0 && ind2 != 0 ) return ind1 == ind2;
86 return Standard_False;
89 //=======================================================================
90 //function : SameVertexAndInterference
92 //=======================================================================
94 Standard_Boolean HLRBRep_EdgeInterferenceTool::SameVertexAndInterference
95 (const HLRAlgo_Interference& I) const
97 if (I.Intersection().Index() == inter[cur].Index())
99 return I.Intersection().Orientation() ==
100 ((cur == 0) ? TopAbs_FORWARD : TopAbs_REVERSED);
103 //=======================================================================
104 //function : InterferenceBoundaryGeometry
106 //=======================================================================
108 void HLRBRep_EdgeInterferenceTool::InterferenceBoundaryGeometry
109 (const HLRAlgo_Interference& I,
112 Standard_Real& CrFE) const
117 I.Boundary().Value2D(FE,Param);
118 myDS->LocalFEGeometry2D(FE,Param,TgFE,NmFE,CrFE);
119 Tang.SetCoord(TgFE.X(),TgFE.Y(),0);
120 Norm.SetCoord(NmFE.X(),NmFE.Y(),0);