0024171: Eliminate CLang compiler warning -Wreorder
[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-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 <Precision.hxx>
25 #include <stdio.h>
26
27 #define MyConfusionPrecision 10.0e-12
28
29 IntPolyh_StartPoint::IntPolyh_StartPoint() : x(0),y(0),z(0),u1(0),v1(0),u2(0),v2(0),
30 lambda1(-1.0),lambda2(-1.0),angle(-2.0),t1(-1),e1(-2),t2(-1),e2(-2),
31 chainlist(-1) {
32 }
33
34 IntPolyh_StartPoint::IntPolyh_StartPoint(const Standard_Real _x,
35                                          const Standard_Real _y,
36                                          const Standard_Real _z,
37                                          const Standard_Real _u1,
38                                          const Standard_Real _v1,
39                                          const Standard_Real _u2,
40                                          const Standard_Real _v2,
41                                          const Standard_Integer _t1,
42                                          const Standard_Integer _e1,
43                                          const Standard_Real _lambda1,
44                                          const Standard_Integer _t2,
45                                          const Standard_Integer _e2,
46                                          const Standard_Real _lambda2,
47                                          const Standard_Integer _chainlist):angle(-2.0) { 
48   x=_x; y=_y; z=_z; 
49   u1=_u1; v1=_v1; 
50   u2=_u2; v2=_v2; 
51   t1=_t1; e1=_e1; lambda1=_lambda1; 
52   t2=_t2; e2=_e2; lambda2=_lambda2; 
53   chainlist=_chainlist;
54 }
55
56 Standard_Real IntPolyh_StartPoint::X() const { return(x); } 
57 Standard_Real IntPolyh_StartPoint::Y() const { return(y); }  
58 Standard_Real IntPolyh_StartPoint::Z() const { return(z); } 
59 Standard_Real IntPolyh_StartPoint::U1() const { return(u1); } 
60 Standard_Real IntPolyh_StartPoint::V1() const { return(v1); }
61 Standard_Real IntPolyh_StartPoint::U2() const { return(u2); } 
62 Standard_Real IntPolyh_StartPoint::V2() const { return(v2); }
63 Standard_Integer IntPolyh_StartPoint::T1() const { return(t1); }
64 Standard_Integer IntPolyh_StartPoint::E1() const { return(e1); }
65 Standard_Real IntPolyh_StartPoint::Lambda1() const { return(lambda1); }
66 Standard_Integer IntPolyh_StartPoint::T2() const { return(t2); }
67 Standard_Integer IntPolyh_StartPoint::E2() const { return(e2); }
68 Standard_Real IntPolyh_StartPoint::Lambda2() const { return(lambda2); }
69 Standard_Integer IntPolyh_StartPoint::ChainList() const { return(chainlist); }
70 Standard_Real IntPolyh_StartPoint::GetAngle() const { return(angle); }
71
72 Standard_Integer IntPolyh_StartPoint::GetEdgePoints(const IntPolyh_Triangle &Triangle,
73                                                     Standard_Integer &FirstEdgePoint, 
74                                                     Standard_Integer &SecondEdgePoint,
75                                                     Standard_Integer &LastPoint) const {
76  Standard_Integer SurfID;
77  if(e1!=-1) {
78    if(e1==1)      { FirstEdgePoint = Triangle.FirstPoint();  SecondEdgePoint = Triangle.SecondPoint(); 
79                     LastPoint = Triangle.ThirdPoint();  }
80    else if(e1==2) { FirstEdgePoint = Triangle.SecondPoint(); SecondEdgePoint = Triangle.ThirdPoint();  
81                     LastPoint = Triangle.FirstPoint();  }
82    else if(e1==3) { FirstEdgePoint = Triangle.ThirdPoint();  SecondEdgePoint = Triangle.FirstPoint();
83                     LastPoint = Triangle.SecondPoint();}
84    SurfID=1;
85  }
86  else if(e2!=-1) {
87    if(e2==1)      { FirstEdgePoint = Triangle.FirstPoint();  SecondEdgePoint = Triangle.SecondPoint();
88                     LastPoint = Triangle.ThirdPoint();}
89    else if(e2==2) { FirstEdgePoint = Triangle.SecondPoint(); SecondEdgePoint = Triangle.ThirdPoint();
90                     LastPoint = Triangle.FirstPoint();}
91    else if(e2==3) { FirstEdgePoint = Triangle.ThirdPoint();  SecondEdgePoint = Triangle.FirstPoint();
92                     LastPoint = Triangle.SecondPoint();}
93    SurfID=2;
94  }
95  else SurfID=0;
96  return(SurfID) ;
97 }
98
99 void IntPolyh_StartPoint::Equal(const IntPolyh_StartPoint &StPt) {
100   x         = StPt.x;
101   y         = StPt.y;
102   z         = StPt.z;
103   u1        = StPt.u1;
104   v1        = StPt.v1;
105   u2        = StPt.u2;
106   v2        = StPt.v2;
107   t1        = StPt.t1;
108   e1        = StPt.e1;
109   lambda1   = StPt.lambda1;
110   t2        = StPt.t2;
111   e2        = StPt.e2;
112   lambda2   = StPt.lambda2;
113   angle     = StPt.angle;
114   chainlist = StPt.chainlist;
115 }
116
117 void IntPolyh_StartPoint::SetXYZ(const Standard_Real XX,
118                                  const Standard_Real YY,
119                                  const Standard_Real ZZ) {
120   x=XX; y=YY; z=ZZ;
121 }
122
123 void IntPolyh_StartPoint::SetUV1(const Standard_Real UU1,
124                                  const Standard_Real VV1) {
125   u1=UU1; v1=VV1;
126 }
127
128 void IntPolyh_StartPoint::SetUV2(const Standard_Real UU2,
129                                  const Standard_Real VV2) {
130   u2=UU2; v2=VV2;
131 }
132
133 void IntPolyh_StartPoint::SetEdge1(const Standard_Integer IE1) {
134   e1=IE1;
135 }
136
137 void IntPolyh_StartPoint::SetLambda1(const Standard_Real LAM1) {
138   lambda1=LAM1;
139 }
140
141 void IntPolyh_StartPoint::SetEdge2(const Standard_Integer IE2) {
142   e2=IE2;
143 }
144
145 void IntPolyh_StartPoint::SetLambda2(const Standard_Real LAM2) {
146   lambda2=LAM2;
147 }
148
149 void IntPolyh_StartPoint::SetCoupleValue(const Standard_Integer IT1,
150                                           const Standard_Integer IT2) {
151   t1=IT1;
152   t2=IT2;
153 }
154
155 void IntPolyh_StartPoint::SetAngle(const Standard_Real Ang) {
156   angle=Ang;
157 }
158
159 void IntPolyh_StartPoint::SetChainList(const Standard_Integer ChList) {
160   chainlist=ChList;
161 }
162
163 Standard_Integer IntPolyh_StartPoint::CheckSameSP(const IntPolyh_StartPoint & SP) const {
164 ///Renvoit 1 si monSP==SP
165   Standard_Integer Test=0;
166   if( ( (e1>=-1)&&(e1==SP.e1))||((e2>=-1)&&(e2==SP.e2)) ) {
167     ///Les edges sont definis
168
169       if( ( (lambda1>-MyConfusionPrecision)&&(Abs(lambda1-SP.lambda1)<MyConfusionPrecision) ) //lambda1!=-1 && lambda1==SP.lambda2
170         ||( (lambda2>-MyConfusionPrecision)&&(Abs(lambda2-SP.lambda2)<MyConfusionPrecision) ) )
171         Test=1;
172       //if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
173         //Test=1;
174
175     }
176   if( (Test==0) && ((e1==-1)||(e2==-1)) ) {
177     ///monSP est un sommet
178       if( (Abs(SP.u1-u1)<MyConfusionPrecision)&&(Abs(SP.v1-v1)<MyConfusionPrecision) )
179         Test=1;
180     }
181   else if( (e1==-2)&&(e2==-2) ) {
182     Dump(00200);
183     SP.Dump(00201);
184     printf("e1==-2 & e2==-2 Can't Check\n");
185   }
186   /*  if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
187       Test=1;*/
188   return(Test);
189 }
190
191 void IntPolyh_StartPoint::Dump() const{ 
192   printf("\nPoint : x=%+8.3eg y=%+8.3eg z=%+8.3eg u1=%+8.3eg v1=%+8.3eg u2=%+8.3eg v2=%+8.3eg\n",
193          x,y,z,u1,v1,u2,v2);
194   printf("Triangle S1:%d Edge S1:%d Lambda1:%f Triangle S2:%d Edge S2:%d Lambda2:%f\n",t1,e1,lambda1,t2,e2,lambda2);
195   printf("Angle: %f List Number: %d\n",angle,chainlist);
196 }
197
198 void IntPolyh_StartPoint::Dump(const Standard_Integer i) const{
199   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",
200          i,x,y,z,u1,v1,u2,v2);
201   printf("Triangle S1:%d Edge S1:%d Lambda1:%f Triangle S2:%d Edge S2:%d Lambda2:%f\n",t1,e1,lambda1,t2,e2,lambda2);
202   printf("Angle: %f List Number: %d\n",angle,chainlist);
203 }
204
205