1 // Created on: 1999-03-08
2 // Created by: Fabrice SERVANT
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Adaptor3d_Surface.hxx>
19 #include <IntPolyh_Point.hxx>
23 //=======================================================================
26 //=======================================================================
27 void IntPolyh_Point::Middle(const Handle(Adaptor3d_Surface)& MySurface,
28 const IntPolyh_Point & Point1,
29 const IntPolyh_Point & Point2){
30 myU = (Point1.U()+Point2.U())*0.5;
31 myV = (Point1.V()+Point2.V())*0.5;
33 gp_Pnt PtXYZ = (MySurface)->Value(myU, myV);
39 //=======================================================================
42 //=======================================================================
43 IntPolyh_Point IntPolyh_Point::Add(const IntPolyh_Point &P1)const
55 //=======================================================================
58 //=======================================================================
59 IntPolyh_Point IntPolyh_Point::Sub(const IntPolyh_Point &P1)const
70 //=======================================================================
73 //=======================================================================
74 IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const
78 if (Abs(RR)>10.0e-20) {
86 printf("Division par zero RR=%f\n",RR);
90 //=======================================================================
91 //function : Multiplication
93 //=======================================================================
94 IntPolyh_Point IntPolyh_Point::Multiplication(const Standard_Real RR)const
105 //=======================================================================
106 //function : SquareModulus
108 //=======================================================================
109 Standard_Real IntPolyh_Point::SquareModulus()const
111 Standard_Real res=myX*myX+myY*myY+myZ*myZ;
115 //=======================================================================
116 //function : SquareDistance
118 //=======================================================================
119 Standard_Real IntPolyh_Point::SquareDistance(const IntPolyh_Point &P2)const
121 Standard_Real res=(myX-P2.myX)*(myX-P2.myX)+(myY-P2.myY)*(myY-P2.myY)+(myZ-P2.myZ)*(myZ-P2.myZ);
124 //=======================================================================
127 //=======================================================================
128 Standard_Real IntPolyh_Point::Dot(const IntPolyh_Point &b ) const
130 Standard_Real t=myX*b.myX+myY*b.myY+myZ*b.myZ;
133 //=======================================================================
136 //=======================================================================
137 void IntPolyh_Point::Cross(const IntPolyh_Point &a,const IntPolyh_Point &b){
138 myX=a.myY*b.myZ-a.myZ*b.myY;
139 myY=a.myZ*b.myX-a.myX*b.myZ;
140 myZ=a.myX*b.myY-a.myY*b.myX;
142 //=======================================================================
145 //=======================================================================
146 void IntPolyh_Point::Dump() const
148 printf("\nPoint : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg\n",myX,myY,myZ,myU,myV);
150 //=======================================================================
153 //=======================================================================
154 void IntPolyh_Point::Dump(const Standard_Integer i) const
156 printf("\nPoint(%3d) : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg poc=%3d\n",
157 i,myX,myY,myZ,myU,myV,myPOC);