1 // Created on: 1997-04-17
2 // Created by: Christophe MARION
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
25 #include <HLRBRep_EdgeIList.ixx>
27 #include <TopCnx_EdgeFaceTransition.hxx>
28 #include <HLRAlgo_ListIteratorOfInterferenceList.hxx>
30 //=======================================================================
31 //function : AddInterference
32 //purpose : insert an interference in a sorted list
33 //=======================================================================
35 void HLRBRep_EdgeIList::
36 AddInterference(HLRAlgo_InterferenceList& IL,
37 const HLRAlgo_Interference& I,
38 const HLRBRep_EdgeInterferenceTool& T)
40 HLRAlgo_ListIteratorOfInterferenceList It(IL);
41 Standard_Real p = T.ParameterOfInterference(I);
43 if (p < T.ParameterOfInterference(It.Value())) {
44 IL.InsertBefore(I,It);
52 //=======================================================================
53 //function : ProcessComplex
55 //=======================================================================
56 static Standard_Boolean SimilarInterference(const HLRAlgo_Interference& I1,
57 const HLRAlgo_Interference& I2)
60 Standard_Real eps = 1.e-7;
61 TopAbs_Orientation or1, or2;
62 //Standard_Integer l1, l2; //levels
64 p1 = I1.Intersection().Parameter();
65 //l1 = I1.Intersection().Level();
66 or1 = I1.Transition();
68 p2 = I2.Intersection().Parameter();
69 //l2 = I2.Intersection().Level();
70 or2 = I2.Transition();
72 Standard_Boolean IsSimilar = Abs(p1-p2) <= eps && or1 == or2;
76 void HLRBRep_EdgeIList::
77 ProcessComplex(HLRAlgo_InterferenceList& IL,
78 const HLRBRep_EdgeInterferenceTool& T)
80 TopCnx_EdgeFaceTransition transTool;
81 gp_Dir TgtE, NormE, TgtI, NormI;
82 const Standard_Real TolAng = 0.0001;
83 Standard_Real CurvE, CurvI;
84 HLRAlgo_ListIteratorOfInterferenceList It1(IL);
87 HLRAlgo_ListIteratorOfInterferenceList It2(It1);
90 if (T.SameInterferences(It1.Value(),It2.Value())/* ||
91 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())/* ||
105 SimilarInterference(It1.Value(),It2.Value())*/)) break;
107 T.InterferenceBoundaryGeometry(It2.Value(),TgtI,NormI,CurvI);
108 transTool.AddInterference(TolAng,
110 It2.Value().Orientation(),
111 It2.Value().Transition(),
112 It2.Value().BoundaryTransition());
115 // get the cumulated results
116 It1.Value().Transition(transTool.Transition());
117 It1.Value().BoundaryTransition(transTool.BoundaryTransition());
124 //Removing "coinciding" interference
126 Standard_Real p1, p2;
127 Standard_Real eps = 1.e-7;
128 HLRAlgo_InterferenceList ILNew;
129 HLRAlgo_Interference I1, I2;
130 TopAbs_Orientation or1, or2;
131 Standard_Integer l1, l2; //levels
136 p1 = I1.Intersection().Parameter();
137 l1 = I1.Intersection().Level();
138 or1 = I1.Transition();
141 HLRAlgo_ListIteratorOfInterferenceList It2(ILNew);
147 p2 = I2.Intersection().Parameter();
148 l2 = I2.Intersection().Level();
149 or2 = I2.Transition();
151 if(p2 - p1 <= eps && or1 == or2) {
164 if(It2.More()) It2.Next();