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