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
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.
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.
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.
23 #include <IntPolyh_StartPoint.ixx>
24 //#include <Precision.hxx>
27 #define MyConfusionPrecision 10.0e-12
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),
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) {
51 t1=_t1; e1=_e1; lambda1=_lambda1;
52 t2=_t2; e2=_e2; lambda2=_lambda2;
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); }
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;
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();}
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();}
99 void IntPolyh_StartPoint::Equal(const IntPolyh_StartPoint &StPt) {
109 lambda1 = StPt.lambda1;
112 lambda2 = StPt.lambda2;
114 chainlist = StPt.chainlist;
117 void IntPolyh_StartPoint::SetXYZ(const Standard_Real XX,
118 const Standard_Real YY,
119 const Standard_Real ZZ) {
123 void IntPolyh_StartPoint::SetUV1(const Standard_Real UU1,
124 const Standard_Real VV1) {
128 void IntPolyh_StartPoint::SetUV2(const Standard_Real UU2,
129 const Standard_Real VV2) {
133 void IntPolyh_StartPoint::SetEdge1(const Standard_Integer IE1) {
137 void IntPolyh_StartPoint::SetLambda1(const Standard_Real LAM1) {
141 void IntPolyh_StartPoint::SetEdge2(const Standard_Integer IE2) {
145 void IntPolyh_StartPoint::SetLambda2(const Standard_Real LAM2) {
149 void IntPolyh_StartPoint::SetCoupleValue(const Standard_Integer IT1,
150 const Standard_Integer IT2) {
155 void IntPolyh_StartPoint::SetAngle(const Standard_Real Ang) {
159 void IntPolyh_StartPoint::SetChainList(const Standard_Integer ChList) {
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
169 if( ( (lambda1>-MyConfusionPrecision)&&(Abs(lambda1-SP.lambda1)<MyConfusionPrecision) ) //lambda1!=-1 && lambda1==SP.lambda2
170 ||( (lambda2>-MyConfusionPrecision)&&(Abs(lambda2-SP.lambda2)<MyConfusionPrecision) ) )
172 //if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
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) )
181 else if( (e1==-2)&&(e2==-2) ) {
184 printf("e1==-2 & e2==-2 Can't Check\n");
186 /* if( (Abs(u1-SP.u1)<MyConfusionPrecision)&&(Abs(v1-SP.v1)<MyConfusionPrecision) )
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",
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);
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);