1 // Created on: 1991-06-24
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <Intf_SectionPoint.ixx>
25 #define DEBUG_INTFSECTIONPOINT 0
28 //=======================================================================
31 //=======================================================================
33 const gp_Pnt& Intf_SectionPoint::Pnt () const {return myPnt;}
36 //=======================================================================
39 //=======================================================================
41 void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
42 Standard_Integer& Add1,
43 Standard_Integer& Add2,
44 Standard_Real& Param) const
52 //=======================================================================
55 //=======================================================================
57 void Intf_SectionPoint::InfoFirst (Intf_PIType& Dim,
58 Standard_Integer& Add,
59 Standard_Real& Param) const
67 //=======================================================================
70 //=======================================================================
72 void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
73 Standard_Integer& Add1,
74 Standard_Integer& Add2,
75 Standard_Real& Param) const
83 //=======================================================================
86 //=======================================================================
88 void Intf_SectionPoint::InfoSecond (Intf_PIType& Dim,
89 Standard_Integer& Add,
90 Standard_Real& Param) const
97 //=======================================================================
98 //function : GetIncidence
100 //=======================================================================
102 Standard_Real Intf_SectionPoint::Incidence () const
106 //=======================================================================
107 //function : IsOnSameEdge
109 //=======================================================================
111 Standard_Boolean Intf_SectionPoint::IsOnSameEdge
112 (const Intf_SectionPoint& Other) const
114 Standard_Boolean isOn=Standard_False;
115 if (DimenObje==Intf_EDGE) {
116 if (Other.DimenObje==Intf_EDGE) {
117 isOn=(IndexO1==Other.IndexO1 && IndexO2==Other.IndexO2);
119 else if (Other.DimenObje==Intf_VERTEX) {
120 isOn=(IndexO1==Other.IndexO1 || IndexO2==Other.IndexO1);
123 else if (DimenObje == Intf_VERTEX) {
124 if (Other.DimenObje==Intf_EDGE) {
125 isOn=(IndexO1==Other.IndexO1 || IndexO1==Other.IndexO2);
127 else if (Other.DimenObje==Intf_VERTEX) {
128 #if DEBUG_INTFSECTIONPOINT
129 cout << " IsOnSameEdge on Intersection VERTEX VERTEX Obje !" << endl;
131 isOn=(IndexT1==Other.IndexT1);
135 if (DimenTool==Intf_EDGE) {
136 if (Other.DimenTool==Intf_EDGE) {
137 isOn=(IndexT1==Other.IndexT1 && IndexT2==Other.IndexT2);
139 else if (Other.DimenTool==Intf_VERTEX) {
140 isOn=(IndexT1==Other.IndexT1 || IndexT2==Other.IndexT1);
143 else if (DimenTool == Intf_VERTEX) {
144 if (Other.DimenTool==Intf_EDGE) {
145 isOn=(IndexT1==Other.IndexT1 || IndexT1==Other.IndexT2);
147 else if (Other.DimenTool==Intf_VERTEX) {
148 #if DEBUG_INTFSECTIONPOINT
149 cout << " IsOnSameEdge on Intersection VERTEX VERTEX Tool !" << endl;
151 isOn=(IndexT1==Other.IndexT1);
158 //=======================================================================
159 //function : Intf_SectionPoint
161 //=======================================================================
163 Intf_SectionPoint::Intf_SectionPoint ()
165 DimenObje(Intf_EXTERNAL), IndexO1(0), IndexO2(0), ParamObje(0.),
166 DimenTool(Intf_EXTERNAL), IndexT1(0), IndexT2(0), ParamTool(0.),
171 //=======================================================================
172 //function : Intf_SectionPoint
174 //=======================================================================
176 Intf_SectionPoint::Intf_SectionPoint (const gp_Pnt& Where,
177 const Intf_PIType Dim1,
178 const Standard_Integer Addr1,
179 const Standard_Integer Addr2,
180 const Standard_Real Param1,
181 const Intf_PIType Dim2,
182 const Standard_Integer Addr3,
183 const Standard_Integer Addr4,
184 const Standard_Real Param2,
185 const Standard_Real Incid)
187 DimenObje(Dim1), IndexO1(Addr1), IndexO2(Addr2), ParamObje(Param1),
188 DimenTool(Dim2), IndexT1(Addr3), IndexT2(Addr4), ParamTool(Param2),
193 //=======================================================================
194 //function : Intf_SectionPoint
196 //=======================================================================
198 Intf_SectionPoint::Intf_SectionPoint (const gp_Pnt2d& Where,
199 const Intf_PIType Dim1,
200 const Standard_Integer Addr1,
201 const Standard_Real Param1,
202 const Intf_PIType Dim2,
203 const Standard_Integer Addr2,
204 const Standard_Real Param2,
205 const Standard_Real Incid)
206 : myPnt(Where.X(),Where.Y(),0.),
207 DimenObje(Dim1), IndexO1(0), IndexO2(Addr1), ParamObje(Param1),
208 DimenTool(Dim2), IndexT1(0), IndexT2(Addr2), ParamTool(Param2),
214 //=======================================================================
217 //=======================================================================
219 void Intf_SectionPoint::Merge (Intf_SectionPoint& Other) {
221 if (DimenObje >= Other.DimenObje) {
222 Other.DimenObje=DimenObje;
223 Other.IndexO1=IndexO1;
224 Other.IndexO2=IndexO2;
225 Other.ParamObje=ParamObje;
228 DimenObje=Other.DimenObje;
229 IndexO1=Other.IndexO1;
230 IndexO2=Other.IndexO2;
231 ParamObje=Other.ParamObje;
233 if (DimenTool >= Other.DimenTool) {
234 Other.DimenTool=DimenTool;
235 Other.IndexT1=IndexT1;
236 Other.IndexT2=IndexT2;
237 Other.ParamTool=ParamTool;
240 DimenTool=Other.DimenTool;
241 IndexT1=Other.IndexT1;
242 IndexT2=Other.IndexT2;
243 ParamTool=Other.ParamTool;
247 //=======================================================================
250 //=======================================================================
252 void Intf_SectionPoint::Dump (const Standard_Integer
253 #if DEBUG_INTFSECTIONPOINT
258 #if DEBUG_INTFSECTIONPOINT
259 for (Standard_Integer id=0; id<Indent; id++) cout << " ";
261 cout << "PIType(" << DimenObje << "," << DimenTool << ") entre("
262 << IndexO1 << "," << IndexO2 << ") par(" << ParamObje
264 << IndexT1 << "," << IndexT2 << ") par(" << ParamTool
267 for (id=0; id<Indent; id++) cout << " ";
269 cout << " Lieu(" << myPnt.X() << ","
272 ") Incidence(" << Incide << ")" << endl;