b311480e |
1 | // Created on: 1998-10-29 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Adaptor3d_HCurve.hxx> |
19 | #include <GeomFill_PlanFunc.hxx> |
20 | #include <gp_Pnt.hxx> |
21 | #include <gp_Vec.hxx> |
7fd59977 |
22 | |
75259fc5 |
23 | GeomFill_PlanFunc::GeomFill_PlanFunc(const gp_Pnt& theP, |
24 | const gp_Vec& theV, |
25 | const Handle(Adaptor3d_HCurve)& theC) : |
26 | myCurve(theC) |
7fd59977 |
27 | { |
75259fc5 |
28 | myPnt = theP.XYZ(); |
29 | myVec = theV.XYZ(); |
7fd59977 |
30 | } |
31 | |
32 | |
33 | Standard_Boolean GeomFill_PlanFunc::Value(const Standard_Real X, |
34 | Standard_Real& F) |
35 | { |
36 | myCurve->D0(X, G); |
37 | V.SetLinearForm(-1, myPnt, G.XYZ()); |
38 | F = myVec.Dot(V); |
39 | return Standard_True; |
40 | } |
41 | |
42 | Standard_Boolean GeomFill_PlanFunc::Derivative(const Standard_Real X, |
43 | Standard_Real& D) |
44 | { |
45 | gp_Vec dg; |
46 | myCurve->D1(X, G, dg); |
47 | D = myVec.Dot(dg.XYZ()); |
48 | |
49 | return Standard_True; |
50 | } |
51 | |
52 | Standard_Boolean GeomFill_PlanFunc::Values(const Standard_Real X, |
53 | Standard_Real& F, |
54 | Standard_Real& D) |
55 | { |
56 | gp_Vec dg; |
57 | myCurve->D1(X, G, dg); |
58 | V.SetLinearForm(-1, myPnt, G.XYZ()); |
59 | F = myVec.Dot(V); |
60 | D = myVec.Dot(dg.XYZ()); |
61 | |
62 | return Standard_True; |
63 | } |
64 | |
65 | //void GeomFill_PlanFunc::D2(const Standard_Real X, |
66 | // Standard_Real& F, |
67 | // Standard_Real& D1, |
68 | // Standard_Real& D2) |
69 | void GeomFill_PlanFunc::D2(const Standard_Real , |
70 | Standard_Real& , |
71 | Standard_Real& , |
72 | Standard_Real& ) |
73 | { |
74 | } |
75 | |
76 | |
77 | void GeomFill_PlanFunc::DEDT(const Standard_Real X, |
78 | const gp_Vec& DPnt, |
79 | const gp_Vec& DVec, |
80 | Standard_Real& DFDT) |
81 | { |
82 | myCurve->D0(X, G); |
83 | V.SetLinearForm(-1, myPnt, G.XYZ()); |
84 | DFDT = DVec.Dot(V) - myVec.Dot(DPnt.XYZ()); |
85 | |
86 | } |
87 | |
88 | |
89 | void GeomFill_PlanFunc::D2E(const Standard_Real X, |
90 | const gp_Vec& DP, |
91 | // const gp_Vec& D2P, |
92 | const gp_Vec& , |
93 | const gp_Vec& DV, |
94 | // const gp_Vec& D2V, |
95 | const gp_Vec& , |
96 | Standard_Real& DFDT, |
97 | // Standard_Real& , |
35e08fe8 |
98 | Standard_Real& /*D2FDT2*/, |
7fd59977 |
99 | // Standard_Real& D2FDTDX) |
100 | Standard_Real& ) |
101 | { |
102 | gp_Vec dg; |
103 | myCurve->D1(X, G, dg); |
104 | gp_XYZ DVDT; |
105 | V.SetLinearForm(-1, myPnt, G.XYZ()); |
106 | DVDT.SetLinearForm(-1, DP.XYZ(), G.XYZ()); |
107 | DFDT = DV.Dot(V) + myVec.Dot(DVDT); |
108 | |
109 | } |