0025618: Avoid classes with an assignment operator and not implementing both a destru...
[occt.git] / src / IntPolyh / IntPolyh_StartPoint.cxx
1 // Created on: 1999-04-06
2 // Created by: Fabrice SERVANT
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <IntPolyh_StartPoint.hxx>
19 #include <IntPolyh_Triangle.hxx>
20
21 #include <stdio.h>
22 //#include <Precision.hxx>
23 #define MyConfusionPrecision 10.0e-12
24
25 IntPolyh_StartPoint::IntPolyh_StartPoint() : x(0),y(0),z(0),u1(0),v1(0),u2(0),v2(0),
26 lambda1(-1.0),lambda2(-1.0),angle(-2.0),t1(-1),e1(-2),t2(-1),e2(-2),
27 chainlist(-1) {
28 }
29
30 IntPolyh_StartPoint::IntPolyh_StartPoint(const Standard_Real _x,
31                                          const Standard_Real _y,
32                                          const Standard_Real _z,
33                                          const Standard_Real _u1,
34                                          const Standard_Real _v1,
35                                          const Standard_Real _u2,
36                                          const Standard_Real _v2,
37                                          const Standard_Integer _t1,
38                                          const Standard_Integer _e1,
39                                          const Standard_Real _lambda1,
40                                          const Standard_Integer _t2,
41                                          const Standard_Integer _e2,
42                                          const Standard_Real _lambda2,
43                                          const Standard_Integer _chainlist):angle(-2.0) { 
44   x=_x; y=_y; z=_z; 
45   u1=_u1; v1=_v1; 
46   u2=_u2; v2=_v2; 
47   t1=_t1; e1=_e1; lambda1=_lambda1; 
48   t2=_t2; e2=_e2; lambda2=_lambda2; 
49   chainlist=_chainlist;
50 }
51
52 Standard_Real IntPolyh_StartPoint::X() const { return(x); } 
53 Standard_Real IntPolyh_StartPoint::Y() const { return(y); }  
54 Standard_Real IntPolyh_StartPoint::Z() const { return(z); } 
55 Standard_Real IntPolyh_StartPoint::U1() const { return(u1); } 
56 Standard_Real IntPolyh_StartPoint::V1() const { return(v1); }
57 Standard_Real IntPolyh_StartPoint::U2() const { return(u2); } 
58 Standard_Real IntPolyh_StartPoint::V2() const { return(v2); }
59 Standard_Integer IntPolyh_StartPoint::T1() const { return(t1); }
60 Standard_Integer IntPolyh_StartPoint::E1() const { return(e1); }
61 Standard_Real IntPolyh_StartPoint::Lambda1() const { return(lambda1); }
62 Standard_Integer IntPolyh_StartPoint::T2() const { return(t2); }
63 Standard_Integer IntPolyh_StartPoint::E2() const { return(e2); }
64 Standard_Real IntPolyh_StartPoint::Lambda2() const { return(lambda2); }
65 Standard_Integer IntPolyh_StartPoint::ChainList() const { return(chainlist); }
66 Standard_Real IntPolyh_StartPoint::GetAngle() const { return(angle); }
67
68 Standard_Integer IntPolyh_StartPoint::GetEdgePoints(const IntPolyh_Triangle &Triangle,
69                                                     Standard_Integer &FirstEdgePoint, 
70                                                     Standard_Integer &SecondEdgePoint,
71                                                     Standard_Integer &LastPoint) const {
72  Standard_Integer SurfID;
73  if(e1!=-1) {
74    if(e1==1)      { FirstEdgePoint = Triangle.FirstPoint();  SecondEdgePoint = Triangle.SecondPoint(); 
75                     LastPoint = Triangle.ThirdPoint();  }
76    else if(e1==2) { FirstEdgePoint = Triangle.SecondPoint(); SecondEdgePoint = Triangle.ThirdPoint();  
77                     LastPoint = Triangle.FirstPoint();  }
78    else if(e1==3) { FirstEdgePoint = Triangle.ThirdPoint();  SecondEdgePoint = Triangle.FirstPoint();
79                     LastPoint = Triangle.SecondPoint();}
80    SurfID=1;
81  }
82  else if(e2!=-1) {
83    if(e2==1)      { FirstEdgePoint = Triangle.FirstPoint();  SecondEdgePoint = Triangle.SecondPoint();
84                     LastPoint = Triangle.ThirdPoint();}
85    else if(e2==2) { FirstEdgePoint = Triangle.SecondPoint(); SecondEdgePoint = Triangle.ThirdPoint();
86                     LastPoint = Triangle.FirstPoint();}
87    else if(e2==3) { FirstEdgePoint = Triangle.ThirdPoint();  SecondEdgePoint = Triangle.FirstPoint();
88                     LastPoint = Triangle.SecondPoint();}
89    SurfID=2;
90  }
91  else SurfID=0;
92  return(SurfID) ;
93 }
94
95 void IntPolyh_StartPoint::SetXYZ(const Standard_Real XX,
96                                  const Standard_Real YY,
97                                  const Standard_Real ZZ) {
98   x=XX; y=YY; z=ZZ;
99 }
100
101 void IntPolyh_StartPoint::SetUV1(const Standard_Real UU1,
102                                  const Standard_Real VV1) {
103   u1=UU1; v1=VV1;
104 }
105
106 void IntPolyh_StartPoint::SetUV2(const Standard_Real UU2,
107                                  const Standard_Real VV2) {
108   u2=UU2; v2=VV2;
109 }
110
111 void IntPolyh_StartPoint::SetEdge1(const Standard_Integer IE1) {
112   e1=IE1;
113 }
114
115 void IntPolyh_StartPoint::SetLambda1(const Standard_Real LAM1) {
116   lambda1=LAM1;
117 }
118
119 void IntPolyh_StartPoint::SetEdge2(const Standard_Integer IE2) {
120   e2=IE2;
121 }
122
123 void IntPolyh_StartPoint::SetLambda2(const Standard_Real LAM2) {
124   lambda2=LAM2;
125 }
126
127 void IntPolyh_StartPoint::SetCoupleValue(const Standard_Integer IT1,
128                                           const Standard_Integer IT2) {
129   t1=IT1;
130   t2=IT2;
131 }
132
133 void IntPolyh_StartPoint::SetAngle(const Standard_Real Ang) {
134   angle=Ang;
135 }
136
137 void IntPolyh_StartPoint::SetChainList(const Standard_Integer ChList) {
138   chainlist=ChList;
139 }
140
141 Standard_Integer IntPolyh_StartPoint::CheckSameSP(const IntPolyh_StartPoint & SP) const {
142 ///Renvoit 1 si monSP==SP
143   Standard_Integer Test=0;
144   if( ( (e1>=-1)&&(e1==SP.e1))||((e2>=-1)&&(e2==SP.e2)) ) {
145     ///Les edges sont definis
146
147       if( ( (lambda1>-MyConfusionPrecision)&&(Abs(lambda1-SP.lambda1)<MyConfusionPrecision) ) //lambda1!=-1 && lambda1==SP.lambda2
148         ||( (lambda2>-MyConfusionPrecision)&&(Abs(lambda2-SP.lambda2)<MyConfusionPrecision) ) )
149         Test=1;
150       //if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
151         //Test=1;
152
153     }
154   if( (Test==0) && ((e1==-1)||(e2==-1)) ) {
155     ///monSP est un sommet
156       if( (Abs(SP.u1-u1)<MyConfusionPrecision)&&(Abs(SP.v1-v1)<MyConfusionPrecision) )
157         Test=1;
158     }
159   else if( (e1==-2)&&(e2==-2) ) {
160     Dump(00200);
161     SP.Dump(00201);
162     printf("e1==-2 & e2==-2 Can't Check\n");
163   }
164   /*  if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
165       Test=1;*/
166   return(Test);
167 }
168
169 void IntPolyh_StartPoint::Dump() const{ 
170   printf("\nPoint : x=%+8.3eg y=%+8.3eg z=%+8.3eg u1=%+8.3eg v1=%+8.3eg u2=%+8.3eg v2=%+8.3eg\n",
171          x,y,z,u1,v1,u2,v2);
172   printf("Triangle S1:%d Edge S1:%d Lambda1:%f Triangle S2:%d Edge S2:%d Lambda2:%f\n",t1,e1,lambda1,t2,e2,lambda2);
173   printf("Angle: %f List Number: %d\n",angle,chainlist);
174 }
175
176 void IntPolyh_StartPoint::Dump(const Standard_Integer i) const{
177   printf("\nPoint(%d) : x=%+8.3eg y=%+8.3eg z=%+8.3eg u1=%+8.3eg v1=%+8.3eg u2=%+8.3eg v2=%+8.3eg\n",
178          i,x,y,z,u1,v1,u2,v2);
179   printf("Triangle S1:%d Edge S1:%d Lambda1:%f Triangle S2:%d Edge S2:%d Lambda2:%f\n",t1,e1,lambda1,t2,e2,lambda2);
180   printf("Angle: %f List Number: %d\n",angle,chainlist);
181 }
182
183