1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
20 #ifndef BOPDS_Interf_HeaderFile
21 #define BOPDS_Interf_HeaderFile
23 #ifndef _Standard_HeaderFile
24 #include <Standard.hxx>
26 #ifndef _Standard_Macro_HeaderFile
27 #include <Standard_Macro.hxx>
30 #ifndef _Standard_Integer_HeaderFile
31 #include <Standard_Integer.hxx>
34 #ifndef _IntTools_CommonPrt_HeaderFile
35 #include <IntTools_CommonPrt.hxx>
38 #include <NCollection_BaseAllocator.hxx>
39 #include <BOPDS_VectorOfCurve.hxx>
40 #include <BOPDS_VectorOfPoint.hxx>
42 * The class BOPDS_Interf is is to store the information about
43 * the interference between two shapes.
44 * The class BOPDS_Interf is root class
47 //=======================================================================
48 //function : BOPDS_Interf
50 //=======================================================================
55 * Sets the indices of interferred shapes
57 * index of the first shape
59 * index of the second shape
61 void SetIndices(const Standard_Integer theIndex1,
62 const Standard_Integer theIndex2) {
68 * Returns the indices of interferred shapes
70 * index of the first shape
72 * index of the second shape
74 void Indices(Standard_Integer& theIndex1,
75 Standard_Integer& theIndex2) const {
81 * Sets the index of the first interferred shape
83 * index of the first shape
85 void SetIndex1(const Standard_Integer theIndex) {
90 * Sets the index of the second interferred shape
92 * index of the second shape
94 void SetIndex2(const Standard_Integer theIndex) {
99 * Returns the index of the first interferred shape
101 * index of the first shape
103 Standard_Integer Index1() const {
108 * Returns the index of the second interferred shape
110 * index of the second shape
112 Standard_Integer Index2() const {
117 * Returns the index of that are opposite to the given index
121 * index of opposite shape
123 Standard_Integer OppositeIndex(const Standard_Integer theI) const {
124 if (theI==myIndex1) {
127 else if(theI==myIndex2) {
136 * Returns true if the interference contains given index
140 * true if the interference contains given index
142 Standard_Boolean Contains(const Standard_Integer theIndex)const {
143 return (myIndex1==theIndex || myIndex2==theIndex);
147 * Sets the index of new shape
151 void SetIndexNew(const Standard_Integer theIndex) {
157 * Returns the index of new shape
159 * the index of new shape
161 Standard_Integer IndexNew() const {
166 * Returns true if the interference has index of new shape
167 * that is equal to the given index
170 * @return true if the interference has index of new shape
171 * that is equal to the given index
173 Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const {
175 return (myIndexNew>=0);
179 * Returns true if the interference has index of new shape
181 * @return true if the interference has index of new shape
183 Standard_Boolean HasIndexNew() const {
184 return (myIndexNew>=0);
192 myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
195 BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
199 myAllocator(theAllocator) {
202 virtual ~BOPDS_Interf() {
206 Standard_Integer myIndex1;
207 Standard_Integer myIndex2;
208 Standard_Integer myIndexNew;
209 Handle(NCollection_BaseAllocator) myAllocator;
212 * The class BOPDS_InterfVV is is to store the information about
213 * the interference of the type vertex/vertex.
215 //=======================================================================
216 //function : BOPDS_InterfVV
218 //=======================================================================
219 class BOPDS_InterfVV : public BOPDS_Interf {
225 BOPDS_InterfVV() : BOPDS_Interf() {
230 * @param theAllocator
231 * allocator to manage the memory
233 BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator)
234 : BOPDS_Interf(theAllocator) {
240 virtual ~BOPDS_InterfVV() {
245 * The class BOPDS_InterfVE is is to store the information about
246 * the interference of the type vertex/edge.
248 //=======================================================================
249 //function : BOPDS_InterfVE
251 //=======================================================================
252 class BOPDS_InterfVE : public BOPDS_Interf {
266 * @param theAllocator
267 * allocator to manage the memory
269 BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator)
271 BOPDS_Interf(theAllocator),
278 virtual ~BOPDS_InterfVE() {
283 * Sets the value of parameter
284 * of the point of the vertex
285 * on the curve of the edge
289 void SetParameter(const Standard_Real theT) {
295 * Returrns the value of parameter
296 * of the point of the vertex
297 * on the curve of the edge
301 Standard_Real Parameter() const {
306 Standard_Real myParameter;
310 * The class BOPDS_InterfVF is is to store the information about
311 * the interference of the type vertex/face
313 //=======================================================================
314 //function : BOPDS_InterfVF
316 //=======================================================================
317 class BOPDS_InterfVF : public BOPDS_Interf {
331 * @param theAllocator
332 * allocator to manage the memory
334 BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator)
335 : BOPDS_Interf(theAllocator),
343 virtual ~BOPDS_InterfVF() {
348 * Sets the value of parameters
349 * of the point of the vertex
350 * on the surface of of the face
352 * value of U parameter
354 * value of U parameter
356 void SetUV(const Standard_Real theU,
357 const Standard_Real theV) {
364 * Returns the value of parameters
365 * of the point of the vertex
366 * on the surface of of the face
368 * value of U parameter
370 * value of U parameter
372 void UV(Standard_Real& theU,Standard_Real& theV) const {
383 * The class BOPDS_InterfEE is is to store the information about
384 * the interference of the type edge/edge.
386 //=======================================================================
387 //function : BOPDS_InterfEE
389 //=======================================================================
390 class BOPDS_InterfEE : public BOPDS_Interf {
396 BOPDS_InterfEE() : BOPDS_Interf() {
401 * @param theAllocator
402 * allocator to manage the memory
404 BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
405 : BOPDS_Interf(theAllocator) {
411 virtual ~BOPDS_InterfEE() {
416 * Sets the info of common part
420 void SetCommonPart(const IntTools_CommonPrt& theCP) {
426 * Returns the info of common part
430 const IntTools_CommonPrt& CommonPart() const {
435 IntTools_CommonPrt myCommonPart;
438 * The class BOPDS_InterfEF is is to store the information about
439 * the interference of the type edge/face.
441 //=======================================================================
442 //function : BOPDS_InterfEF
444 //=======================================================================
445 class BOPDS_InterfEF : public BOPDS_Interf {
451 BOPDS_InterfEF(): BOPDS_Interf() {
456 * @param theAllocator
457 * allocator to manage the memory
461 * @param theAllocator
462 * allocator to manage the memory
464 BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
465 : BOPDS_Interf(theAllocator) {
471 virtual ~BOPDS_InterfEF() {
476 * Sets the info of common part
480 void SetCommonPart(const IntTools_CommonPrt& theCP){
486 * Returns the info of common part
490 const IntTools_CommonPrt& CommonPart() const {
495 IntTools_CommonPrt myCommonPart;
498 * The class BOPDS_InterfFF is is to store the information about
499 * the interference of the type face/face.
501 //=======================================================================
502 //function : BOPDS_InterfFF
504 //=======================================================================
505 class BOPDS_InterfFF : public BOPDS_Interf {
514 myTangentFaces(Standard_False),
517 myCurves(myAllocator),
518 myPoints(myAllocator) {
523 * @param theAllocator
524 * allocator to manage the memory
527 BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
529 BOPDS_Interf(theAllocator),
530 myTangentFaces(Standard_False),
533 myCurves(myAllocator),
534 myPoints(myAllocator) {
540 virtual ~BOPDS_InterfFF() {
546 * number of intersection curves
548 * number of intersection points
550 void Init(const Standard_Integer theNbCurves,
551 const Standard_Integer theNbPoints) {
553 myCurves.SetStartSize(theNbCurves);
554 myCurves.SetIncrement(theNbCurves);
558 myPoints.SetStartSize(theNbPoints);
559 myPoints.SetIncrement(theNbPoints);
565 * Sets the flag of whether the faces are tangent
569 void SetTangentFaces(const Standard_Boolean theFlag) {
570 myTangentFaces=theFlag;
574 * Returns the flag whether the faces are tangent
578 Standard_Boolean TangentFaces()const {
579 return myTangentFaces;
583 * Sets the value of 3D tolerance
587 void SetTolR3D(const Standard_Real theTol) {
593 * Returns the value of 3D tolerance
597 Standard_Real TolR3D()const {
603 * Sets the value of 2D tolerance
607 void SetTolR2D(const Standard_Real theTol) {
613 * Returns the value of 2D tolerance
617 Standard_Real TolR2D()const {
623 * Returns the intersection curves
625 * intersection curves
627 const BOPDS_VectorOfCurve& Curves()const{
633 * Returns the intersection curves
635 * intersection curves
637 BOPDS_VectorOfCurve& ChangeCurves(){
643 * Returns the intersection points
645 * intersection points
647 const BOPDS_VectorOfPoint& Points()const{
653 * Returns the intersection points
655 * intersection points
657 BOPDS_VectorOfPoint& ChangePoints(){
662 Standard_Boolean myTangentFaces;
663 Standard_Real myTolR3D;
664 Standard_Real myTolR2D;
665 BOPDS_VectorOfCurve myCurves;
666 BOPDS_VectorOfPoint myPoints;