b311480e |
1 | // Created on: 1992-05-06 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
c22b52d6 |
18 | #include <Adaptor2d_Curve2d.hxx> |
42cf5bc1 |
19 | #include <Adaptor3d_HVertex.hxx> |
20 | #include <gp_Pnt.hxx> |
21 | #include <IntPatch_Point.hxx> |
22 | #include <IntSurf_PntOn2S.hxx> |
23 | #include <IntSurf_Transition.hxx> |
7fd59977 |
24 | #include <Standard_DomainError.hxx> |
7fd59977 |
25 | |
42cf5bc1 |
26 | #include <stdio.h> |
7fd59977 |
27 | void IntPatch_Point::SetValue (const gp_Pnt& Pt, |
28 | const Standard_Real Tol, |
29 | const Standard_Boolean Tangent) |
30 | { |
31 | onS1 = Standard_False; |
32 | onS2 = Standard_False; |
33 | vtxonS1 = Standard_False; |
34 | vtxonS2 = Standard_False; |
35 | mult = Standard_False; |
36 | tgt = Tangent; |
37 | pt.SetValue(Pt); |
38 | tol = Tol; |
39 | } |
40 | |
41 | void IntPatch_Point::SetVertex(const Standard_Boolean OnFirst, const Handle(Adaptor3d_HVertex)& V) |
42 | { |
43 | if (OnFirst) { |
44 | onS1 = Standard_True; |
45 | vtxonS1 = Standard_True; |
46 | vS1 = V; |
47 | } |
48 | else { |
49 | onS2 = Standard_True; |
50 | vtxonS2 = Standard_True; |
51 | vS2 = V; |
52 | } |
53 | } |
54 | |
55 | void IntPatch_Point::SetArc (const Standard_Boolean OnFirst, |
c22b52d6 |
56 | const Handle(Adaptor2d_Curve2d)& A, |
7fd59977 |
57 | const Standard_Real Param, |
58 | const IntSurf_Transition& TLine, |
59 | const IntSurf_Transition& TArc) |
60 | { |
61 | if (OnFirst) { |
62 | onS1 = Standard_True; |
63 | arcS1 = A; |
64 | traline1 = TLine; |
65 | tra1 = TArc; |
66 | prm1 = Param; |
67 | } |
68 | else { |
69 | onS2 = Standard_True; |
70 | arcS2 = A; |
71 | traline2 = TLine; |
72 | tra2 = TArc; |
73 | prm2 = Param; |
74 | } |
75 | } |
76 | |
77 | void IntPatch_Point::ReverseTransition() |
78 | { |
79 | if(onS1) |
80 | { |
81 | IntSurf_Transition TLine; |
82 | switch (traline1.TransitionType()) |
83 | { |
566f8441 |
84 | case IntSurf_In: TLine.SetValue(Standard_False,IntSurf_Out); break; |
85 | case IntSurf_Out: TLine.SetValue(Standard_False,IntSurf_In); break; |
86 | default: |
87 | break; |
88 | } |
7fd59977 |
89 | traline1=TLine; |
90 | IntSurf_Transition TArc; |
91 | switch (tra1.TransitionType()) |
92 | { |
566f8441 |
93 | case IntSurf_In: TArc.SetValue(Standard_False,IntSurf_Out); break; |
94 | case IntSurf_Out: TArc.SetValue(Standard_False,IntSurf_In); break; |
95 | default: |
96 | break; |
97 | } |
7fd59977 |
98 | tra1=TArc; |
99 | } |
100 | if(onS2) |
101 | { |
102 | IntSurf_Transition TLine; |
103 | switch (traline2.TransitionType()) |
104 | { |
566f8441 |
105 | case IntSurf_In: TLine.SetValue(Standard_False,IntSurf_Out); break; |
106 | case IntSurf_Out: TLine.SetValue(Standard_False,IntSurf_In); break; |
107 | default: |
108 | break; |
109 | } |
7fd59977 |
110 | traline2=TLine; |
111 | IntSurf_Transition TArc; |
112 | switch (tra2.TransitionType()) |
113 | { |
566f8441 |
114 | case IntSurf_In: TArc.SetValue(Standard_False,IntSurf_Out); break; |
115 | case IntSurf_Out: TArc.SetValue(Standard_False,IntSurf_In); break; |
116 | default: |
117 | break; |
118 | } |
7fd59977 |
119 | tra2=TArc; |
120 | } |
121 | } |
122 | |
123 | |
124 | #include <IntSurf_Situation.hxx> |
125 | #include <IntSurf_Transition.hxx> |
126 | #include <IntSurf_TypeTrans.hxx> |
127 | |
128 | static void DumpTransition(const IntSurf_Transition& T) |
129 | { |
130 | IntSurf_TypeTrans typetrans = T.TransitionType(); |
04232180 |
131 | if(typetrans == IntSurf_In) std::cout<<" In "; |
132 | else if(typetrans == IntSurf_Out) std::cout<<" Out "; |
133 | else if(typetrans == IntSurf_Undecided) std::cout<<" Und."; |
7fd59977 |
134 | else if(typetrans == IntSurf_Touch) { |
04232180 |
135 | std::cout<<" Touch "; |
136 | if(T.Situation() == IntSurf_Inside) std::cout<<" Inside "; |
137 | else if(T.Situation() == IntSurf_Outside) std::cout<<" Outside"; |
138 | else std::cout<<" Unknown"; |
139 | if(T.IsOpposite()) std::cout<<" Opposite "; |
140 | else std::cout<<" Non_Opposite "; |
7fd59977 |
141 | } |
142 | |
143 | if(typetrans != IntSurf_Undecided) { |
04232180 |
144 | if(T.IsTangent()) std::cout<<" Tangent "; |
145 | else std::cout<<" Non_Tangent"; |
7fd59977 |
146 | } |
147 | } |
148 | |
149 | #include <Standard_Transient.hxx> |
150 | |
151 | void IntPatch_Point::Dump() const { |
04232180 |
152 | std::cout<<"----------- IntPatch_Point : "<<std::endl; |
7fd59977 |
153 | Standard_Real u1,v1,u2,v2; |
154 | pt.Parameters(u1,v1,u2,v2); |
7fd59977 |
155 | |
3306fdd9 |
156 | printf("P(%+10.20f,%+10.20f,%+10.20f) UV1(%+10.20f,%+10.20f) UV2(%+10.20f,%+10.20f) (Para:%+10.20f)\n", |
7fd59977 |
157 | (double)(pt.Value().X()), |
158 | (double)(pt.Value().Y()), |
159 | (double)(pt.Value().Z()), |
160 | (double)u1,(double)v1,(double)u2,(double)v2,(double)para); |
fd03ee4b |
161 | if(onS1) |
3306fdd9 |
162 | printf("*OnS1* par=%+10.20f arc1=%10p", (double)prm1, (void*)arcS1.operator->()); |
fd03ee4b |
163 | if(vtxonS1) |
164 | printf(" *Vtx1* vtx1=%10p", (void*)vS1.operator->()); |
7fd59977 |
165 | if(onS1 || vtxonS1) printf("\n"); |
fd03ee4b |
166 | if(onS2) |
3306fdd9 |
167 | printf("*OnS2* par=%+10.20f arc2=%10p", (double)prm2, (void*)arcS2.operator->()); |
fd03ee4b |
168 | if(vtxonS2) |
f1a5afa2 |
169 | printf(" *Vtx2* vtx2=%10p", (void*)vS2.operator->()); |
fd03ee4b |
170 | |
171 | if(onS2 || vtxonS2) |
172 | printf("\n"); |
7fd59977 |
173 | fflush(stdout); |
fd03ee4b |
174 | |
7fd59977 |
175 | if(onS1 || onS2) { |
04232180 |
176 | std::cout<<" tgt:"<<((tgt)? 1 : 0) <<" mult:"<<((mult)? 1 :0); |
7fd59977 |
177 | if(onS1) { |
04232180 |
178 | std::cout<<"\n-traline1 : "; DumpTransition(traline1); |
179 | std::cout<<" -tra1 : "; DumpTransition(tra1); |
7fd59977 |
180 | } |
181 | if(onS2) { |
04232180 |
182 | std::cout<<"\n-traline2 : "; DumpTransition(traline2); |
183 | std::cout<<" -tra2 : "; DumpTransition(tra2); |
7fd59977 |
184 | } |
04232180 |
185 | std::cout<<std::endl; |
7fd59977 |
186 | } |
04232180 |
187 | std::cout << "\nToler = " << Tolerance(); |
188 | std::cout << std::endl; |
7fd59977 |
189 | } |