Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/IntImp_ZerCSParFunc.gxx is written in an unsupported language. File is not indexed.

0001 // Copyright (c) 1995-1999 Matra Datavision
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #include <gp_Pnt.hxx>
0016 #include <gp_Vec.hxx>
0017 
0018 #ifndef OCCT_DEBUG
0019 #define No_Standard_RangeError
0020 #define No_Standard_OutOfRange
0021 #endif
0022 
0023 
0024 IntImp_ZerCSParFunc::IntImp_ZerCSParFunc(const ThePSurface& S,
0025                                          const TheCurve& C) {
0026   surface = S;
0027   curve = C;
0028   p = gp_Pnt(0.0,0.0,0.0);
0029   f = 0.0;
0030 }
0031 
0032 Standard_Integer IntImp_ZerCSParFunc::NbVariables()const { return 3;}
0033 
0034 Standard_Integer IntImp_ZerCSParFunc::NbEquations()const { return 3;}
0035 
0036 Standard_Boolean IntImp_ZerCSParFunc::Value(const math_Vector& X,
0037                                             math_Vector& F){
0038 
0039   gp_Pnt Psurf = ThePSurfaceTool::Value(surface,X(1),X(2));
0040   gp_Pnt Pcurv = TheCurveTool::Value(curve,X(3));
0041   Standard_Real f1,f2,f3;
0042   F(1) = f1 = Psurf.X()-Pcurv.X();
0043   F(2) = f2 = Psurf.Y()-Pcurv.Y();
0044   F(3) = f3 = Psurf.Z()-Pcurv.Z();
0045   f = f1*f1 + f2*f2 + f3*f3;
0046   p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5);
0047   return Standard_True;
0048 }
0049 
0050 Standard_Boolean IntImp_ZerCSParFunc::Derivatives ( const math_Vector& X,
0051                                                     math_Matrix& D) {
0052   gp_Pnt Psurf,Pcurv;
0053   gp_Vec D1u,D1v,D1w;
0054   ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v);
0055   TheCurveTool::D1(curve,X(3),Pcurv,D1w);
0056   D(1,1) =  D1u.X();
0057   D(1,2) =  D1v.X();
0058   D(1,3) = -D1w.X();
0059   D(2,1) =  D1u.Y();
0060   D(2,2) =  D1v.Y();
0061   D(2,3) = -D1w.Y();
0062   D(3,1) =  D1u.Z();
0063   D(3,2) =  D1v.Z();
0064   D(3,3) = -D1w.Z();
0065   return Standard_True;
0066 } 
0067 
0068 Standard_Boolean IntImp_ZerCSParFunc::Values( const math_Vector& X,
0069                                               math_Vector& F,
0070                                               math_Matrix& D) {
0071   gp_Pnt Psurf,Pcurv;
0072   gp_Vec D1u,D1v,D1w;
0073   ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v);
0074   TheCurveTool::D1(curve,X(3),Pcurv,D1w);
0075   D(1,1) =  D1u.X();
0076   D(1,2) =  D1v.X();
0077   D(1,3) = -D1w.X();
0078   D(2,1) =  D1u.Y();
0079   D(2,2) =  D1v.Y();
0080   D(2,3) = -D1w.Y();
0081   D(3,1) =  D1u.Z();
0082   D(3,2) =  D1v.Z();
0083   D(3,3) = -D1w.Z();
0084 
0085   Standard_Real f1,f2,f3;
0086   F(1) = f1 = Psurf.X()-Pcurv.X();
0087   F(2) = f2 = Psurf.Y()-Pcurv.Y();
0088   F(3) = f3 = Psurf.Z()-Pcurv.Z();
0089   f = f1*f1 + f2*f2 + f3*f3;
0090   p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5);
0091   return Standard_True;
0092 }
0093 
0094 const gp_Pnt& IntImp_ZerCSParFunc::Point() const { return p;}
0095 
0096 Standard_Real IntImp_ZerCSParFunc::Root() const { return f;}
0097 
0098 const ThePSurface& IntImp_ZerCSParFunc::AuxillarSurface() const { 
0099   return surface;}
0100 
0101 const TheCurve& IntImp_ZerCSParFunc::AuxillarCurve() const { 
0102   return curve;}