1 // File: HLRBRep_EdgeIList.cxx
2 // Created: Thu Apr 17 21:26:59 1997
3 // Author: Christophe MARION
4 // Copyright: OPEN CASCADE 2000
9 #include <HLRBRep_EdgeIList.ixx>
11 #include <TopCnx_EdgeFaceTransition.hxx>
12 #include <HLRAlgo_ListIteratorOfInterferenceList.hxx>
14 //=======================================================================
15 //function : AddInterference
16 //purpose : insert an interference in a sorted list
17 //=======================================================================
19 void HLRBRep_EdgeIList::
20 AddInterference(HLRAlgo_InterferenceList& IL,
21 const HLRAlgo_Interference& I,
22 const HLRBRep_EdgeInterferenceTool& T)
24 HLRAlgo_ListIteratorOfInterferenceList It(IL);
25 Standard_Real p = T.ParameterOfInterference(I);
27 if (p < T.ParameterOfInterference(It.Value())) {
28 IL.InsertBefore(I,It);
36 //=======================================================================
37 //function : ProcessComplex
39 //=======================================================================
40 static Standard_Boolean SimilarInterference(const HLRAlgo_Interference& I1,
41 const HLRAlgo_Interference& I2)
44 Standard_Real eps = 1.e-7;
45 TopAbs_Orientation or1, or2;
46 //Standard_Integer l1, l2; //levels
48 p1 = I1.Intersection().Parameter();
49 //l1 = I1.Intersection().Level();
50 or1 = I1.Transition();
52 p2 = I2.Intersection().Parameter();
53 //l2 = I2.Intersection().Level();
54 or2 = I2.Transition();
56 Standard_Boolean IsSimilar = Abs(p1-p2) <= eps && or1 == or2;
60 void HLRBRep_EdgeIList::
61 ProcessComplex(HLRAlgo_InterferenceList& IL,
62 const HLRBRep_EdgeInterferenceTool& T)
64 TopCnx_EdgeFaceTransition transTool;
65 gp_Dir TgtE, NormE, TgtI, NormI;
66 const Standard_Real TolAng = 0.0001;
67 Standard_Real CurvE, CurvI;
68 HLRAlgo_ListIteratorOfInterferenceList It1(IL);
71 HLRAlgo_ListIteratorOfInterferenceList It2(It1);
74 if (T.SameInterferences(It1.Value(),It2.Value())/* ||
75 SimilarInterference(It1.Value(),It2.Value())*/) {
77 T.EdgeGeometry(T.ParameterOfInterference(It1.Value()),
79 transTool.Reset(TgtE,NormE,CurvE);
80 T.InterferenceBoundaryGeometry(It1.Value(),TgtI,NormI,CurvI);
81 transTool.AddInterference(TolAng,
83 It1.Value().Orientation(),
84 It1.Value().Transition(),
85 It1.Value().BoundaryTransition());
88 if (!(T.SameInterferences(It1.Value(),It2.Value())/* ||
89 SimilarInterference(It1.Value(),It2.Value())*/)) break;
91 T.InterferenceBoundaryGeometry(It2.Value(),TgtI,NormI,CurvI);
92 transTool.AddInterference(TolAng,
94 It2.Value().Orientation(),
95 It2.Value().Transition(),
96 It2.Value().BoundaryTransition());
99 // get the cumulated results
100 It1.Value().Transition(transTool.Transition());
101 It1.Value().BoundaryTransition(transTool.BoundaryTransition());
108 //Removing "coinciding" interference
110 Standard_Real p1, p2;
111 Standard_Real eps = 1.e-7;
112 HLRAlgo_InterferenceList ILNew;
113 HLRAlgo_Interference I1, I2;
114 TopAbs_Orientation or1, or2;
115 Standard_Integer l1, l2; //levels
120 p1 = I1.Intersection().Parameter();
121 l1 = I1.Intersection().Level();
122 or1 = I1.Transition();
125 HLRAlgo_ListIteratorOfInterferenceList It2(ILNew);
131 p2 = I2.Intersection().Parameter();
132 l2 = I2.Intersection().Level();
133 or2 = I2.Transition();
135 if(p2 - p1 <= eps && or1 == or2) {
148 if(It2.More()) It2.Next();