0023548: Boolean operation between two faces fails
[occt.git] / src / IntPolyh / IntPolyh_ArrayOfTangentZones.cxx
1 // Created on: 1999-04-06
2 // Created by: Fabrice SERVANT
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
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.
10 //
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.
13 //
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.
20
21
22
23 #include <IntPolyh_StartPoint.ixx>
24 #include <IntPolyh_ArrayOfTangentZones.ixx>
25 #include <stdio.h>
26
27 IntPolyh_ArrayOfTangentZones::IntPolyh_ArrayOfTangentZones() : n(0),nbtangentzones(0),ptr(0) { }
28
29 IntPolyh_ArrayOfTangentZones::IntPolyh_ArrayOfTangentZones(const Standard_Integer N) : nbtangentzones(0){ 
30   Init(N);
31 }
32
33 void IntPolyh_ArrayOfTangentZones::Init(const Standard_Integer N) { 
34   Destroy();
35   ptr = (void*) (new IntPolyh_StartPoint [N]);
36   n=N;
37 }
38
39 Standard_Integer IntPolyh_ArrayOfTangentZones::GetN() const { 
40   return(n); 
41 }
42
43 Standard_Integer IntPolyh_ArrayOfTangentZones::NbTangentZones() const { 
44   return(nbtangentzones); 
45 }
46
47 void IntPolyh_ArrayOfTangentZones::IncrementNbTangentZones() { 
48   nbtangentzones++; 
49 }
50
51 # ifdef DEB
52   # define BORNES1
53 # endif
54 const IntPolyh_StartPoint& IntPolyh_ArrayOfTangentZones::Value(const Standard_Integer Index) const { 
55   IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
56 #if BORNES
57   if(Index<0 || Index>=n) { 
58     cerr<<" Erreur1 "<<endl;
59     printf("Value() from IntPolyh_ArrayOfTangentZones :ERROR value out of array\n");
60   } 
61 #endif
62   return(ptrstpoint[Index]); 
63 }
64
65 IntPolyh_StartPoint& IntPolyh_ArrayOfTangentZones::ChangeValue(const Standard_Integer Index) { 
66   IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
67 #if BORNES
68     if(Index<0 || Index>=n) { 
69       cerr<<" Erreur1 "<<endl; 
70       printf("Value() from IntPolyh_ArrayOfTangentZones :ERROR value out of array\n");
71     } 
72 #endif
73     return(ptrstpoint[Index]); 
74 }
75   
76 void IntPolyh_ArrayOfTangentZones::Destroy() { 
77   if(n) { 
78     if(ptr) { 
79       IntPolyh_StartPoint *ptrstpoint = (IntPolyh_StartPoint *)ptr;
80       delete [] ptrstpoint;
81       ptrstpoint=0;
82       ptr=0;
83       n=0;
84       }
85   }
86 }
87   
88 IntPolyh_ArrayOfTangentZones & IntPolyh_ArrayOfTangentZones::Copy(const IntPolyh_ArrayOfTangentZones& Other) { 
89   if(ptr==Other.ptr) return(*this);
90   Destroy();
91   n=Other.n;
92   ptr = (void *) (new IntPolyh_StartPoint[n]);
93   for(Standard_Integer i=0;i<=n;i++) { 
94     (*this)[i]=Other[i];
95   }
96   return(*this);
97 }
98
99 void IntPolyh_ArrayOfTangentZones::Dump() const{ 
100   printf("\n ArrayOfTangentZones 0-> %d",nbtangentzones-1);
101   for(Standard_Integer i=0;i<nbtangentzones;i++) { 
102     (*this)[i].Dump(i);
103   }
104   printf("\n");
105 }
106
107
108