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.
20 #include <HLRBRep_EdgeIList.ixx>
22 #include <TopCnx_EdgeFaceTransition.hxx>
23 #include <HLRAlgo_ListIteratorOfInterferenceList.hxx>
25 //=======================================================================
26 //function : AddInterference
27 //purpose : insert an interference in a sorted list
28 //=======================================================================
30 void HLRBRep_EdgeIList::
31 AddInterference(HLRAlgo_InterferenceList& IL,
32 const HLRAlgo_Interference& I,
33 const HLRBRep_EdgeInterferenceTool& T)
35 HLRAlgo_ListIteratorOfInterferenceList It(IL);
36 Standard_Real p = T.ParameterOfInterference(I);
38 if (p < T.ParameterOfInterference(It.Value())) {
39 IL.InsertBefore(I,It);
47 //=======================================================================
48 //function : ProcessComplex
50 //=======================================================================
52 static Standard_Boolean SimilarInterference(const HLRAlgo_Interference& I1,
53 const HLRAlgo_Interference& I2)
56 Standard_Real eps = 1.e-7;
57 TopAbs_Orientation or1, or2;
58 //Standard_Integer l1, l2; //levels
60 p1 = I1.Intersection().Parameter();
61 //l1 = I1.Intersection().Level();
62 or1 = I1.Transition();
64 p2 = I2.Intersection().Parameter();
65 //l2 = I2.Intersection().Level();
66 or2 = I2.Transition();
68 Standard_Boolean IsSimilar = Abs(p1-p2) <= eps && or1 == or2;
73 void HLRBRep_EdgeIList::
74 ProcessComplex(HLRAlgo_InterferenceList& IL,
75 const HLRBRep_EdgeInterferenceTool& T)
77 TopCnx_EdgeFaceTransition transTool;
78 gp_Dir TgtE, NormE, TgtI, NormI;
79 const Standard_Real TolAng = 0.0001;
80 Standard_Real CurvE, CurvI;
81 HLRAlgo_ListIteratorOfInterferenceList It1(IL);
84 HLRAlgo_ListIteratorOfInterferenceList It2(It1);
87 if (T.SameInterferences(It1.Value(),It2.Value())
89 || SimilarInterference(It1.Value(),It2.Value())
93 T.EdgeGeometry(T.ParameterOfInterference(It1.Value()),
95 transTool.Reset(TgtE,NormE,CurvE);
96 T.InterferenceBoundaryGeometry(It1.Value(),TgtI,NormI,CurvI);
97 transTool.AddInterference(TolAng,
99 It1.Value().Orientation(),
100 It1.Value().Transition(),
101 It1.Value().BoundaryTransition());
104 if (!(T.SameInterferences(It1.Value(),It2.Value())
106 || SimilarInterference(It1.Value(),It2.Value())
110 T.InterferenceBoundaryGeometry(It2.Value(),TgtI,NormI,CurvI);
111 transTool.AddInterference(TolAng,
113 It2.Value().Orientation(),
114 It2.Value().Transition(),
115 It2.Value().BoundaryTransition());
118 // get the cumulated results
119 It1.Value().Transition(transTool.Transition());
120 It1.Value().BoundaryTransition(transTool.BoundaryTransition());
127 //Removing "coinciding" interference
129 Standard_Real p1, p2;
130 Standard_Real eps = 1.e-7;
131 HLRAlgo_InterferenceList ILNew;
132 HLRAlgo_Interference I1, I2;
133 TopAbs_Orientation or1, or2;
134 Standard_Integer l1, l2; //levels
139 p1 = I1.Intersection().Parameter();
140 l1 = I1.Intersection().Level();
141 or1 = I1.Transition();
144 HLRAlgo_ListIteratorOfInterferenceList It2(ILNew);
150 p2 = I2.Intersection().Parameter();
151 l2 = I2.Intersection().Level();
152 or2 = I2.Transition();
154 if(p2 - p1 <= eps && or1 == or2) {
167 if(It2.More()) It2.Next();