Integration of OCCT 6.5.0 from SVN
[occt.git] / src / IntPatch / IntPatch_Point.cxx
CommitLineData
7fd59977 1// File: IntPatch_Point.cxx
2// Created: Wed May 6 14:01:12 1992
3// Author: Jacques GOUSSARD
4// Copyright: OPEN CASCADE 1992
5
6#include <IntPatch_Point.ixx>
7
8#include <Standard_DomainError.hxx>
9#include <stdio.h>
10
11
12void IntPatch_Point::SetValue (const gp_Pnt& Pt,
13 const Standard_Real Tol,
14 const Standard_Boolean Tangent)
15{
16 onS1 = Standard_False;
17 onS2 = Standard_False;
18 vtxonS1 = Standard_False;
19 vtxonS2 = Standard_False;
20 mult = Standard_False;
21 tgt = Tangent;
22 pt.SetValue(Pt);
23 tol = Tol;
24}
25
26void IntPatch_Point::SetVertex(const Standard_Boolean OnFirst, const Handle(Adaptor3d_HVertex)& V)
27{
28 if (OnFirst) {
29 onS1 = Standard_True;
30 vtxonS1 = Standard_True;
31 vS1 = V;
32 }
33 else {
34 onS2 = Standard_True;
35 vtxonS2 = Standard_True;
36 vS2 = V;
37 }
38}
39
40void IntPatch_Point::SetArc (const Standard_Boolean OnFirst,
41 const Handle(Adaptor2d_HCurve2d)& A,
42 const Standard_Real Param,
43 const IntSurf_Transition& TLine,
44 const IntSurf_Transition& TArc)
45{
46 if (OnFirst) {
47 onS1 = Standard_True;
48 arcS1 = A;
49 traline1 = TLine;
50 tra1 = TArc;
51 prm1 = Param;
52 }
53 else {
54 onS2 = Standard_True;
55 arcS2 = A;
56 traline2 = TLine;
57 tra2 = TArc;
58 prm2 = Param;
59 }
60}
61
62void IntPatch_Point::ReverseTransition()
63{
64 if(onS1)
65 {
66 IntSurf_Transition TLine;
67 switch (traline1.TransitionType())
68 {
69 case IntSurf_In: TLine.SetValue(Standard_False,IntSurf_Out); break;
70 case IntSurf_Out: TLine.SetValue(Standard_False,IntSurf_In); break;
71 }
72 traline1=TLine;
73 IntSurf_Transition TArc;
74 switch (tra1.TransitionType())
75 {
76 case IntSurf_In: TArc.SetValue(Standard_False,IntSurf_Out); break;
77 case IntSurf_Out: TArc.SetValue(Standard_False,IntSurf_In); break;
78 }
79 tra1=TArc;
80 }
81 if(onS2)
82 {
83 IntSurf_Transition TLine;
84 switch (traline2.TransitionType())
85 {
86 case IntSurf_In: TLine.SetValue(Standard_False,IntSurf_Out); break;
87 case IntSurf_Out: TLine.SetValue(Standard_False,IntSurf_In); break;
88 }
89 traline2=TLine;
90 IntSurf_Transition TArc;
91 switch (tra2.TransitionType())
92 {
93 case IntSurf_In: TArc.SetValue(Standard_False,IntSurf_Out); break;
94 case IntSurf_Out: TArc.SetValue(Standard_False,IntSurf_In); break;
95 }
96 tra2=TArc;
97 }
98}
99
100
101#include <IntSurf_Situation.hxx>
102#include <IntSurf_Transition.hxx>
103#include <IntSurf_TypeTrans.hxx>
104
105static void DumpTransition(const IntSurf_Transition& T)
106{
107 IntSurf_TypeTrans typetrans = T.TransitionType();
108 if(typetrans == IntSurf_In) cout<<" In ";
109 else if(typetrans == IntSurf_Out) cout<<" Out ";
110 else if(typetrans == IntSurf_Undecided) cout<<" Und.";
111 else if(typetrans == IntSurf_Touch) {
112 cout<<" Touch ";
113 if(T.Situation() == IntSurf_Inside) cout<<" Inside ";
114 else if(T.Situation() == IntSurf_Outside) cout<<" Outside";
115 else cout<<" Unknown";
116 if(T.IsOpposite()) cout<<" Opposite ";
117 else cout<<" Non_Opposite ";
118 }
119
120 if(typetrans != IntSurf_Undecided) {
121 if(T.IsTangent()) cout<<" Tangent ";
122 else cout<<" Non_Tangent";
123 }
124}
125
126#include <Standard_Transient.hxx>
127
128void IntPatch_Point::Dump() const {
129 cout<<"----------- IntPatch_Point : "<<endl;
130 Standard_Real u1,v1,u2,v2;
131 pt.Parameters(u1,v1,u2,v2);
132#if 0
133 cout<<"IntSurf_PntOn2S : Pnt ("<<pt.Value().X()
134 <<","<<pt.Value().Y()<<","<<pt.Value().Z()<<")"<<endl;
135 cout<<" u1:"<<u1; cout<<" u2:"<<u2;
136 cout<<" v1:"<<v1;
137 cout<<" v2:"<<v2<<endl;
138 cout<<" para("<<para<<")";
139 cout<<" mult("<<mult<<")";
140 cout<<" OnS1("<<onS1<<")";
141 cout<<" VtxOnS1("<<vtxonS1<<")"<<endl;
142 cout<<" OnS2("<<onS2<<")";
143 cout<<" VtxOnS2("<<vtxonS2<<")";
144 cout<<" prm1("<<prm1<<")";
145 cout<<" prm2("<<prm2<<")";
146#else
147
148#ifndef DEB // for porting on linux
149 printf("P(%15.10f,%15.10f,%15.10f) UV1(%15.10f,%15.10f) UV2(%15.10f,%15.10f) (Para:%15.10f)\n",
150 (double)(pt.Value().X()),
151 (double)(pt.Value().Y()),
152 (double)(pt.Value().Z()),
153 (double)u1,(double)v1,(double)u2,(double)v2,(double)para);
154 if(onS1) { printf("*OnS1* par=%15.10f arc1=%10lu",(double)prm1,
155 *((long unsigned *)(((Handle_Standard_Transient *)(&arcS1))))
156 ); }
157 if(vtxonS1) { printf(" *Vtx1* vtx1=%10lu",
158 *((long unsigned *)(((Handle_Standard_Transient *)(&vS1))))); }
159 if(onS1 || vtxonS1) printf("\n");
160 if(onS2) { printf("*OnS2* par=%15.10f arc2=%10lu",(double)prm2,
161 *((long unsigned *)(((Handle_Standard_Transient *)(&arcS2))))); }
162 if(vtxonS2) { printf(" *Vtx2* vtx2=%10lu",
163 *((long unsigned *)(((Handle_Standard_Transient *)(&vS2))))); }
164
165#else // debug mode
166 printf("P(%15.10lf,%15.10lf,%15.10lf) UV1(%15.10lf,%15.10lf) UV2(%15.10lf,%15.10lf) (Para:%15.10lf)\n",
167 (double)(pt.Value().X()),
168 (double)(pt.Value().Y()),
169 (double)(pt.Value().Z()),
170 (double)u1,(double)v1,(double)u2,(double)v2,(double)para);
171 if(onS1) { printf("*OnS1* par=%15.10lf arc1=%10lu",(double)prm1,
172 *((long unsigned *)(((Handle_Standard_Transient *)(&arcS1))))
173 ); }
174 if(vtxonS1) { printf(" *Vtx1* vtx1=%10lu",
175 *((long unsigned *)(((Handle_Standard_Transient *)(&vS1))))); }
176 if(onS1 || vtxonS1) printf("\n");
177 if(onS2) { printf("*OnS2* par=%15.10lf arc2=%10lu",(double)prm2,
178 *((long unsigned *)(((Handle_Standard_Transient *)(&arcS2))))); }
179 if(vtxonS2) { printf(" *Vtx2* vtx2=%10lu",
180 *((long unsigned *)(((Handle_Standard_Transient *)(&vS2))))); }
181
182#endif
183 if(onS2 || vtxonS2) printf("\n");
184 fflush(stdout);
185
186#endif
187 if(onS1 || onS2) {
188 cout<<" tgt:"<<((tgt)? 1 : 0) <<" mult:"<<((mult)? 1 :0);
189 if(onS1) {
190 cout<<"\n-traline1 : "; DumpTransition(traline1);
191 cout<<" -tra1 : "; DumpTransition(tra1);
192 }
193 if(onS2) {
194 cout<<"\n-traline2 : "; DumpTransition(traline2);
195 cout<<" -tra2 : "; DumpTransition(tra2);
196 }
197 cout<<endl;
198 }
199}