1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
17 #include <gp_Pnt2d.hxx>
18 #include <gp_Vec2d.hxx>
21 #define No_Standard_RangeError
22 #define No_Standard_OutOfRange
26 #define SURFACE1 (*((ThePSurface *)(surface1)))
27 #define SURFACE2 (*((ThePSurface *)(surface2)))
28 #define CURVE (*((TheCurveOnSurf *)(curve)))
30 IntImp_ZerCOnSSParFunc::IntImp_ZerCOnSSParFunc(const ThePSurface& S1,
31 const TheCurveOnSurf& C,
32 const ThePSurface& S2)
34 surface1 = (Standard_Address)(&S1);
35 surface2 = (Standard_Address)(&S2);
36 curve = (Standard_Address)(&C);
39 Standard_Integer IntImp_ZerCOnSSParFunc::NbVariables()const { return 3;}
41 Standard_Integer IntImp_ZerCOnSSParFunc::NbEquations()const { return 3;}
43 Standard_Boolean IntImp_ZerCOnSSParFunc::Value(const math_Vector& X,
46 gp_Pnt Psurf(ThePSurfaceTool::Value(SURFACE1,X(1),X(2)));
47 gp_Pnt2d p2d(TheCurveTool::Value(CURVE,X(3)));
48 gp_Pnt Pcurv(ThePSurfaceTool::Value(SURFACE2,p2d.X(),p2d.Y()));
50 F(1) = Psurf.X()-Pcurv.X();
51 F(2) = Psurf.Y()-Pcurv.Y();
52 F(3) = Psurf.Z()-Pcurv.Z();
53 f = F(1)*F(1)+ F(2)*F(2)+ F(3)*F(3);
54 p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())/2.);
58 Standard_Boolean IntImp_ZerCOnSSParFunc::Derivatives ( const math_Vector& X,
66 ThePSurfaceTool::D1(SURFACE1,X(1),X(2),Psurf,D1u,D1v);
67 TheCurveTool::D1(CURVE,X(3),p2d,d2d);
68 ThePSurfaceTool::D1(SURFACE2,p2d.X(),p2d.Y(),Pcurv,d1u,d1v);
69 D1w.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
83 Standard_Boolean IntImp_ZerCOnSSParFunc::Values( const math_Vector& X,
93 ThePSurfaceTool::D1(SURFACE1,X(1),X(2),Psurf,D1u,D1v);
94 TheCurveTool::D1(CURVE,X(3),p2d,d2d);
95 ThePSurfaceTool::D1(SURFACE2,p2d.X(),p2d.Y(),Pcurv,d1u,d1v);
96 D1w.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
107 F(1) = Psurf.X()-Pcurv.X();
108 F(2) = Psurf.Y()-Pcurv.Y();
109 F(3) = Psurf.Z()-Pcurv.Z();
110 f = F(1)*F(1)+ F(2)*F(2)+ F(3)*F(3);
111 p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())/2.);
112 return Standard_True;
115 const gp_Pnt& IntImp_ZerCOnSSParFunc::Point() const { return p;}
117 Standard_Real IntImp_ZerCOnSSParFunc::Root() const { return f;}
119 const ThePSurface& IntImp_ZerCOnSSParFunc::AuxillarSurface() const {
122 const TheCurveOnSurf& IntImp_ZerCOnSSParFunc::AuxillarCurve() const {