1 // Created on: 2001-02-15
2 // Created by: Peter KURNEV
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <BOPTools_PaveBlock.ixx>
24 //=======================================================================
25 // function: BOPTools_PaveBlock::BOPTools_PaveBlock
27 //=======================================================================
28 BOPTools_PaveBlock::BOPTools_PaveBlock()
35 //=======================================================================
36 // function: BOPTools_PaveBlock::BOPTools_PaveBlock
38 //=======================================================================
39 BOPTools_PaveBlock::BOPTools_PaveBlock(const Standard_Integer theEdge,
40 const BOPTools_Pave& thePave1,
41 const BOPTools_Pave& thePave2)
43 myOriginalEdge=theEdge;
50 //=======================================================================
53 //=======================================================================
54 void BOPTools_PaveBlock::SetCurve(const IntTools_Curve& aC)
58 //=======================================================================
61 //=======================================================================
62 void BOPTools_PaveBlock::SetFace1(const Standard_Integer theFace1)
66 //=======================================================================
69 //=======================================================================
70 void BOPTools_PaveBlock::SetFace2(const Standard_Integer theFace2)
75 //=======================================================================
78 //=======================================================================
79 Standard_Integer BOPTools_PaveBlock::Face1() const
83 //=======================================================================
86 //=======================================================================
87 Standard_Integer BOPTools_PaveBlock::Face2() const
91 //=======================================================================
94 //=======================================================================
95 const IntTools_Curve& BOPTools_PaveBlock::Curve() const
100 //=======================================================================
103 //=======================================================================
104 void BOPTools_PaveBlock::SetEdge(const Standard_Integer theEdge)
108 //=======================================================================
109 // function: SetOriginalEdge
111 //=======================================================================
112 void BOPTools_PaveBlock::SetOriginalEdge(const Standard_Integer theEdge)
114 myOriginalEdge=theEdge;
117 //=======================================================================
118 // function: SetPave1
120 //=======================================================================
121 void BOPTools_PaveBlock::SetPave1(const BOPTools_Pave& thePave1)
126 //=======================================================================
127 // function: SetPave2
129 //=======================================================================
130 void BOPTools_PaveBlock::SetPave2(const BOPTools_Pave& thePave2)
135 //=======================================================================
136 // function: SetShrunkRange
138 //=======================================================================
139 void BOPTools_PaveBlock::SetShrunkRange(const IntTools_ShrunkRange& theSR)
144 //=======================================================================
145 // function: SetPointBetween
147 //=======================================================================
148 void BOPTools_PaveBlock::SetPointBetween (const BOPTools_PointBetween& thePB)
150 myPointBetween=thePB;
153 //=======================================================================
154 // function: PointBetween
156 //=======================================================================
157 const BOPTools_PointBetween& BOPTools_PaveBlock::PointBetween ()const
159 return myPointBetween;
162 //=======================================================================
165 //=======================================================================
166 const BOPTools_Pave& BOPTools_PaveBlock::Pave1() const
168 Standard_Real t1, t2;
178 //=======================================================================
181 //=======================================================================
182 const BOPTools_Pave& BOPTools_PaveBlock::Pave2() const
184 Standard_Real t1, t2;
195 //=======================================================================
198 //=======================================================================
199 Standard_Integer BOPTools_PaveBlock::Edge() const
204 //=======================================================================
205 // function: OriginalEdge
207 //=======================================================================
208 Standard_Integer BOPTools_PaveBlock::OriginalEdge() const
210 return myOriginalEdge;
213 //=======================================================================
216 //=======================================================================
217 Standard_Boolean BOPTools_PaveBlock::IsValid() const
219 Standard_Integer anInd1, anInd2;
220 anInd1=myPave1.Index();
221 anInd2=myPave2.Index();
223 return (anInd1 && anInd2);
225 //=======================================================================
228 //=======================================================================
229 Standard_Boolean BOPTools_PaveBlock::IsEqual(const BOPTools_PaveBlock& Other) const
231 if (myOriginalEdge==Other.myOriginalEdge) {
233 const BOPTools_Pave& aP11=Pave1();
234 const BOPTools_Pave& aP12=Pave2();
235 const BOPTools_Pave& aP21=Other.Pave1();
236 const BOPTools_Pave& aP22=Other.Pave2();
238 if (aP11.IsEqual(aP21)) {
239 if (aP12.IsEqual(aP22)) {
240 return Standard_True;
244 return Standard_False;
246 //=======================================================================
247 // function: Parameters
249 //=======================================================================
250 void BOPTools_PaveBlock::Parameters(Standard_Real& aT1,
251 Standard_Real& aT2) const
253 Standard_Real t1, t2;
256 aT1= (t1<t2) ? t1 : t2;
257 aT2= (t1>t2) ? t1 : t2;
259 //=======================================================================
262 //=======================================================================
263 const IntTools_Range& BOPTools_PaveBlock::Range() const
265 Standard_Real t1, t2;
269 IntTools_Range* pRange=(IntTools_Range*) &myRange;
272 pRange->SetFirst (t1);
273 pRange->SetLast (t2);
276 pRange->SetFirst (t2);
277 pRange->SetLast (t1);
282 //=======================================================================
283 // function: ShrunkRange
285 //=======================================================================
286 const IntTools_ShrunkRange& BOPTools_PaveBlock::ShrunkRange()const
288 return myShrunkRange;
290 //=======================================================================
291 // function: IsInBlock
293 //=======================================================================
294 Standard_Boolean BOPTools_PaveBlock::IsInBlock(const BOPTools_Pave& thePaveX) const
296 Standard_Boolean bIsInBlock;
297 Standard_Real aT1, aT2, aTx;
299 aTx=thePaveX.Param();
300 Parameters(aT1, aT2);
301 bIsInBlock=(aTx > aT1 && aTx < aT2);