0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / Intf / Intf_SectionPoint.cxx
CommitLineData
b311480e 1// Created on: 1991-06-24
2// Created by: Didier PIFFAULT
3// Copyright (c) 1991-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
42cf5bc1 18#include <gp_Pnt.hxx>
19#include <gp_Pnt2d.hxx>
20#include <Intf_SectionPoint.hxx>
7fd59977 21
22#define DEBUG_INTFSECTIONPOINT 0
23
24
25//=======================================================================
26//function : Pnt
27//purpose :
28//=======================================================================
29
30const gp_Pnt& Intf_SectionPoint::Pnt () const {return myPnt;}
31
32
33//=======================================================================
34//function : GetElemO
35//purpose :
36//=======================================================================
37
38void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
39 Standard_Integer& Add1,
40 Standard_Integer& Add2,
41 Standard_Real& Param) const
42{
43 Dim =DimenObje;
44 Add1=IndexO1;
45 Add2=IndexO2;
46 Param=ParamObje;
47}
48
49//=======================================================================
50//function : GetElemO
51//purpose :
52//=======================================================================
53
54void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
55 Standard_Integer& Add,
56 Standard_Real& Param) const
57{
58 Dim =DimenObje;
59 Add=IndexO2;
60 Param=ParamObje;
61}
62
63
64//=======================================================================
65//function : GetElemT
66//purpose :
67//=======================================================================
68
69void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
70 Standard_Integer& Add1,
71 Standard_Integer& Add2,
72 Standard_Real& Param) const
73{
74 Dim =DimenTool;
75 Add1=IndexT1;
76 Add2=IndexT2;
77 Param=ParamTool;
78}
79
80//=======================================================================
81//function : GetElemT
82//purpose :
83//=======================================================================
84
85void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
86 Standard_Integer& Add,
87 Standard_Real& Param) const
88{
89 Dim =DimenTool;
90 Add=IndexT2;
91 Param=ParamTool;
92}
93
94//=======================================================================
95//function : GetIncidence
96//purpose :
97//=======================================================================
98
99Standard_Real Intf_SectionPoint::Incidence () const
100{return Incide;}
101
102
103//=======================================================================
104//function : IsOnSameEdge
105//purpose :
106//=======================================================================
107
108Standard_Boolean Intf_SectionPoint::IsOnSameEdge
109 (const Intf_SectionPoint& Other) const
110{
111 Standard_Boolean isOn=Standard_False;
112 if (DimenObje==Intf_EDGE) {
113 if (Other.DimenObje==Intf_EDGE) {
114 isOn=(IndexO1==Other.IndexO1 && IndexO2==Other.IndexO2);
115 }
116 else if (Other.DimenObje==Intf_VERTEX) {
117 isOn=(IndexO1==Other.IndexO1 || IndexO2==Other.IndexO1);
118 }
119 }
120 else if (DimenObje == Intf_VERTEX) {
121 if (Other.DimenObje==Intf_EDGE) {
122 isOn=(IndexO1==Other.IndexO1 || IndexO1==Other.IndexO2);
123 }
124 else if (Other.DimenObje==Intf_VERTEX) {
125#if DEBUG_INTFSECTIONPOINT
04232180 126 std::cout << " IsOnSameEdge on Intersection VERTEX VERTEX Obje !" << std::endl;
7fd59977 127#endif
128 isOn=(IndexT1==Other.IndexT1);
129 }
130 }
131 if (!isOn) {
132 if (DimenTool==Intf_EDGE) {
133 if (Other.DimenTool==Intf_EDGE) {
134 isOn=(IndexT1==Other.IndexT1 && IndexT2==Other.IndexT2);
135 }
136 else if (Other.DimenTool==Intf_VERTEX) {
137 isOn=(IndexT1==Other.IndexT1 || IndexT2==Other.IndexT1);
138 }
139 }
140 else if (DimenTool == Intf_VERTEX) {
141 if (Other.DimenTool==Intf_EDGE) {
142 isOn=(IndexT1==Other.IndexT1 || IndexT1==Other.IndexT2);
143 }
144 else if (Other.DimenTool==Intf_VERTEX) {
145#if DEBUG_INTFSECTIONPOINT
04232180 146 std::cout << " IsOnSameEdge on Intersection VERTEX VERTEX Tool !" << std::endl;
7fd59977 147#endif
148 isOn=(IndexT1==Other.IndexT1);
149 }
150 }
151 }
152 return isOn;
153}
154
155//=======================================================================
156//function : Intf_SectionPoint
157//purpose :
158//=======================================================================
159
160Intf_SectionPoint::Intf_SectionPoint ()
161 : myPnt(0.,0.,0.),
162 DimenObje(Intf_EXTERNAL), IndexO1(0), IndexO2(0), ParamObje(0.),
163 DimenTool(Intf_EXTERNAL), IndexT1(0), IndexT2(0), ParamTool(0.),
164 Incide(0.)
165{
166}
167
168//=======================================================================
169//function : Intf_SectionPoint
170//purpose :
171//=======================================================================
172
173Intf_SectionPoint::Intf_SectionPoint (const gp_Pnt& Where,
174 const Intf_PIType Dim1,
175 const Standard_Integer Addr1,
176 const Standard_Integer Addr2,
177 const Standard_Real Param1,
178 const Intf_PIType Dim2,
179 const Standard_Integer Addr3,
180 const Standard_Integer Addr4,
181 const Standard_Real Param2,
182 const Standard_Real Incid)
183 : myPnt(Where),
184 DimenObje(Dim1), IndexO1(Addr1), IndexO2(Addr2), ParamObje(Param1),
185 DimenTool(Dim2), IndexT1(Addr3), IndexT2(Addr4), ParamTool(Param2),
186 Incide(Incid)
187{
188}
189
190//=======================================================================
191//function : Intf_SectionPoint
192//purpose :
193//=======================================================================
194
195Intf_SectionPoint::Intf_SectionPoint (const gp_Pnt2d& Where,
196 const Intf_PIType Dim1,
197 const Standard_Integer Addr1,
198 const Standard_Real Param1,
199 const Intf_PIType Dim2,
200 const Standard_Integer Addr2,
201 const Standard_Real Param2,
202 const Standard_Real Incid)
203 : myPnt(Where.X(),Where.Y(),0.),
204 DimenObje(Dim1), IndexO1(0), IndexO2(Addr1), ParamObje(Param1),
205 DimenTool(Dim2), IndexT1(0), IndexT2(Addr2), ParamTool(Param2),
206 Incide(Incid)
207{
208}
209
210
211//=======================================================================
212//function : Merge
213//purpose :
214//=======================================================================
215
216void Intf_SectionPoint::Merge (Intf_SectionPoint& Other) {
217 Other.myPnt=myPnt;
218 if (DimenObje >= Other.DimenObje) {
219 Other.DimenObje=DimenObje;
220 Other.IndexO1=IndexO1;
221 Other.IndexO2=IndexO2;
222 Other.ParamObje=ParamObje;
223 }
224 else {
225 DimenObje=Other.DimenObje;
226 IndexO1=Other.IndexO1;
227 IndexO2=Other.IndexO2;
228 ParamObje=Other.ParamObje;
229 }
230 if (DimenTool >= Other.DimenTool) {
231 Other.DimenTool=DimenTool;
232 Other.IndexT1=IndexT1;
233 Other.IndexT2=IndexT2;
234 Other.ParamTool=ParamTool;
235 }
236 else {
237 DimenTool=Other.DimenTool;
238 IndexT1=Other.IndexT1;
239 IndexT2=Other.IndexT2;
240 ParamTool=Other.ParamTool;
241 }
242}
243
244//=======================================================================
245//function : Dump
246//purpose :
247//=======================================================================
248
249void Intf_SectionPoint::Dump (const Standard_Integer
250#if DEBUG_INTFSECTIONPOINT
251 Indent
252#endif
253 ) const
254{
255#if DEBUG_INTFSECTIONPOINT
04232180 256 for (Standard_Integer id=0; id<Indent; id++) std::cout << " ";
7fd59977 257
04232180 258 std::cout << "PIType(" << DimenObje << "," << DimenTool << ") entre("
7fd59977 259 << IndexO1 << "," << IndexO2 << ") par(" << ParamObje
260 << ") et ("
261 << IndexT1 << "," << IndexT2 << ") par(" << ParamTool
04232180 262 << ")" << std::endl;
7fd59977 263
04232180 264 for (id=0; id<Indent; id++) std::cout << " ";
7fd59977 265
04232180 266 std::cout << " Lieu(" << myPnt.X() << ","
7fd59977 267 << myPnt.Y() << ","
268 << myPnt.Z() <<
04232180 269 ") Incidence(" << Incide << ")" << std::endl;
7fd59977 270#endif
271}