1 // Created on: 1991-06-24
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 #include <gp_Pnt2d.hxx>
20 #include <Intf_SectionPoint.hxx>
22 #define DEBUG_INTFSECTIONPOINT 0
25 //=======================================================================
28 //=======================================================================
30 const gp_Pnt& Intf_SectionPoint::Pnt () const {return myPnt;}
33 //=======================================================================
36 //=======================================================================
38 void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
39 Standard_Integer& Add1,
40 Standard_Integer& Add2,
41 Standard_Real& Param) const
49 //=======================================================================
52 //=======================================================================
54 void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
55 Standard_Integer& Add,
56 Standard_Real& Param) const
64 //=======================================================================
67 //=======================================================================
69 void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
70 Standard_Integer& Add1,
71 Standard_Integer& Add2,
72 Standard_Real& Param) const
80 //=======================================================================
83 //=======================================================================
85 void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
86 Standard_Integer& Add,
87 Standard_Real& Param) const
94 //=======================================================================
95 //function : GetIncidence
97 //=======================================================================
99 Standard_Real Intf_SectionPoint::Incidence () const
103 //=======================================================================
104 //function : IsOnSameEdge
106 //=======================================================================
108 Standard_Boolean Intf_SectionPoint::IsOnSameEdge
109 (const Intf_SectionPoint& Other) const
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);
116 else if (Other.DimenObje==Intf_VERTEX) {
117 isOn=(IndexO1==Other.IndexO1 || IndexO2==Other.IndexO1);
120 else if (DimenObje == Intf_VERTEX) {
121 if (Other.DimenObje==Intf_EDGE) {
122 isOn=(IndexO1==Other.IndexO1 || IndexO1==Other.IndexO2);
124 else if (Other.DimenObje==Intf_VERTEX) {
125 #if DEBUG_INTFSECTIONPOINT
126 cout << " IsOnSameEdge on Intersection VERTEX VERTEX Obje !" << endl;
128 isOn=(IndexT1==Other.IndexT1);
132 if (DimenTool==Intf_EDGE) {
133 if (Other.DimenTool==Intf_EDGE) {
134 isOn=(IndexT1==Other.IndexT1 && IndexT2==Other.IndexT2);
136 else if (Other.DimenTool==Intf_VERTEX) {
137 isOn=(IndexT1==Other.IndexT1 || IndexT2==Other.IndexT1);
140 else if (DimenTool == Intf_VERTEX) {
141 if (Other.DimenTool==Intf_EDGE) {
142 isOn=(IndexT1==Other.IndexT1 || IndexT1==Other.IndexT2);
144 else if (Other.DimenTool==Intf_VERTEX) {
145 #if DEBUG_INTFSECTIONPOINT
146 cout << " IsOnSameEdge on Intersection VERTEX VERTEX Tool !" << endl;
148 isOn=(IndexT1==Other.IndexT1);
155 //=======================================================================
156 //function : Intf_SectionPoint
158 //=======================================================================
160 Intf_SectionPoint::Intf_SectionPoint ()
162 DimenObje(Intf_EXTERNAL), IndexO1(0), IndexO2(0), ParamObje(0.),
163 DimenTool(Intf_EXTERNAL), IndexT1(0), IndexT2(0), ParamTool(0.),
168 //=======================================================================
169 //function : Intf_SectionPoint
171 //=======================================================================
173 Intf_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)
184 DimenObje(Dim1), IndexO1(Addr1), IndexO2(Addr2), ParamObje(Param1),
185 DimenTool(Dim2), IndexT1(Addr3), IndexT2(Addr4), ParamTool(Param2),
190 //=======================================================================
191 //function : Intf_SectionPoint
193 //=======================================================================
195 Intf_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),
211 //=======================================================================
214 //=======================================================================
216 void Intf_SectionPoint::Merge (Intf_SectionPoint& Other) {
218 if (DimenObje >= Other.DimenObje) {
219 Other.DimenObje=DimenObje;
220 Other.IndexO1=IndexO1;
221 Other.IndexO2=IndexO2;
222 Other.ParamObje=ParamObje;
225 DimenObje=Other.DimenObje;
226 IndexO1=Other.IndexO1;
227 IndexO2=Other.IndexO2;
228 ParamObje=Other.ParamObje;
230 if (DimenTool >= Other.DimenTool) {
231 Other.DimenTool=DimenTool;
232 Other.IndexT1=IndexT1;
233 Other.IndexT2=IndexT2;
234 Other.ParamTool=ParamTool;
237 DimenTool=Other.DimenTool;
238 IndexT1=Other.IndexT1;
239 IndexT2=Other.IndexT2;
240 ParamTool=Other.ParamTool;
244 //=======================================================================
247 //=======================================================================
249 void Intf_SectionPoint::Dump (const Standard_Integer
250 #if DEBUG_INTFSECTIONPOINT
255 #if DEBUG_INTFSECTIONPOINT
256 for (Standard_Integer id=0; id<Indent; id++) cout << " ";
258 cout << "PIType(" << DimenObje << "," << DimenTool << ") entre("
259 << IndexO1 << "," << IndexO2 << ") par(" << ParamObje
261 << IndexT1 << "," << IndexT2 << ") par(" << ParamTool
264 for (id=0; id<Indent; id++) cout << " ";
266 cout << " Lieu(" << myPnt.X() << ","
269 ") Incidence(" << Incide << ")" << endl;