b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | #include <gp_Pnt.hxx> |
16 | #include <gp_Vec.hxx> |
17 | |
0797d9d3 |
18 | #ifndef OCCT_DEBUG |
7fd59977 |
19 | #define No_Standard_RangeError |
20 | #define No_Standard_OutOfRange |
21 | #endif |
22 | |
23 | |
24 | IntImp_ZerCSParFunc::IntImp_ZerCSParFunc(const ThePSurface& S, |
25 | const TheCurve& C) { |
26 | surface = S; |
27 | curve = C; |
28 | p = gp_Pnt(0.0,0.0,0.0); |
29 | f = 0.0; |
30 | } |
31 | |
32 | Standard_Integer IntImp_ZerCSParFunc::NbVariables()const { return 3;} |
33 | |
34 | Standard_Integer IntImp_ZerCSParFunc::NbEquations()const { return 3;} |
35 | |
36 | Standard_Boolean IntImp_ZerCSParFunc::Value(const math_Vector& X, |
37 | math_Vector& F){ |
38 | |
39 | gp_Pnt Psurf = ThePSurfaceTool::Value(surface,X(1),X(2)); |
40 | gp_Pnt Pcurv = TheCurveTool::Value(curve,X(3)); |
41 | Standard_Real f1,f2,f3; |
42 | F(1) = f1 = Psurf.X()-Pcurv.X(); |
43 | F(2) = f2 = Psurf.Y()-Pcurv.Y(); |
44 | F(3) = f3 = Psurf.Z()-Pcurv.Z(); |
45 | f = f1*f1 + f2*f2 + f3*f3; |
46 | p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5); |
47 | return Standard_True; |
48 | } |
49 | |
50 | Standard_Boolean IntImp_ZerCSParFunc::Derivatives ( const math_Vector& X, |
51 | math_Matrix& D) { |
52 | gp_Pnt Psurf,Pcurv; |
53 | gp_Vec D1u,D1v,D1w; |
54 | ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v); |
55 | TheCurveTool::D1(curve,X(3),Pcurv,D1w); |
56 | D(1,1) = D1u.X(); |
57 | D(1,2) = D1v.X(); |
58 | D(1,3) = -D1w.X(); |
59 | D(2,1) = D1u.Y(); |
60 | D(2,2) = D1v.Y(); |
61 | D(2,3) = -D1w.Y(); |
62 | D(3,1) = D1u.Z(); |
63 | D(3,2) = D1v.Z(); |
64 | D(3,3) = -D1w.Z(); |
65 | return Standard_True; |
66 | } |
67 | |
68 | Standard_Boolean IntImp_ZerCSParFunc::Values( const math_Vector& X, |
69 | math_Vector& F, |
70 | math_Matrix& D) { |
71 | gp_Pnt Psurf,Pcurv; |
72 | gp_Vec D1u,D1v,D1w; |
73 | ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v); |
74 | TheCurveTool::D1(curve,X(3),Pcurv,D1w); |
75 | D(1,1) = D1u.X(); |
76 | D(1,2) = D1v.X(); |
77 | D(1,3) = -D1w.X(); |
78 | D(2,1) = D1u.Y(); |
79 | D(2,2) = D1v.Y(); |
80 | D(2,3) = -D1w.Y(); |
81 | D(3,1) = D1u.Z(); |
82 | D(3,2) = D1v.Z(); |
83 | D(3,3) = -D1w.Z(); |
84 | |
85 | Standard_Real f1,f2,f3; |
86 | F(1) = f1 = Psurf.X()-Pcurv.X(); |
87 | F(2) = f2 = Psurf.Y()-Pcurv.Y(); |
88 | F(3) = f3 = Psurf.Z()-Pcurv.Z(); |
89 | f = f1*f1 + f2*f2 + f3*f3; |
90 | p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5); |
91 | return Standard_True; |
92 | } |
93 | |
94 | const gp_Pnt& IntImp_ZerCSParFunc::Point() const { return p;} |
95 | |
96 | Standard_Real IntImp_ZerCSParFunc::Root() const { return f;} |
97 | |
98 | const ThePSurface& IntImp_ZerCSParFunc::AuxillarSurface() const { |
99 | return surface;} |
100 | |
101 | const TheCurve& IntImp_ZerCSParFunc::AuxillarCurve() const { |
102 | return curve;} |