b311480e |
1 | // Created on: 1998-02-02 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1998-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <GeomFill_LocFunction.ixx> |
24 | |
25 | #include <gp_Mat.hxx> |
26 | #include <gp_Vec.hxx> |
27 | #include <TColgp_Array1OfPnt2d.hxx> |
28 | #include <TColgp_Array1OfVec2d.hxx> |
29 | |
30 | GeomFill_LocFunction::GeomFill_LocFunction(const Handle(GeomFill_LocationLaw)& Law) |
31 | :V(1,4), DV(1,4), D2V(1,4) |
32 | |
33 | { |
34 | myLaw = Law; |
35 | } |
36 | |
37 | Standard_Boolean GeomFill_LocFunction::D0(const Standard_Real Param, |
38 | // const Standard_Real First, |
39 | const Standard_Real , |
40 | // const Standard_Real Last) |
41 | const Standard_Real ) |
42 | { |
75259fc5 |
43 | gp_Mat aM; |
7fd59977 |
44 | Standard_Boolean B; |
75259fc5 |
45 | B = myLaw->D0(Param, aM, V.ChangeValue(1)); |
46 | V(2).SetXYZ(aM.Column(1)); |
47 | V(3).SetXYZ(aM.Column(2)); |
48 | V(4).SetXYZ(aM.Column(3)); |
7fd59977 |
49 | return B; |
50 | } |
51 | |
52 | Standard_Boolean GeomFill_LocFunction::D1(const Standard_Real Param, |
53 | // const Standard_Real First, |
54 | const Standard_Real , |
55 | // const Standard_Real Last) |
56 | const Standard_Real ) |
57 | { |
58 | TColgp_Array1OfPnt2d T1(1,1); |
59 | TColgp_Array1OfVec2d T2(1,1); |
75259fc5 |
60 | gp_Mat aM, aDM; |
7fd59977 |
61 | Standard_Boolean B; |
75259fc5 |
62 | B = myLaw->D1(Param, aM, V.ChangeValue(1), |
63 | aDM, DV.ChangeValue(1), |
7fd59977 |
64 | T1, T2); |
65 | |
75259fc5 |
66 | V(2).SetXYZ(aM.Column(1)); |
67 | V(3).SetXYZ(aM.Column(2)); |
68 | V(4).SetXYZ(aM.Column(3)); |
7fd59977 |
69 | |
75259fc5 |
70 | DV(2).SetXYZ(aDM.Column(1)); |
71 | DV(3).SetXYZ(aDM.Column(2)); |
72 | DV(4).SetXYZ(aDM.Column(3)); |
7fd59977 |
73 | return B; |
74 | } |
75 | |
76 | Standard_Boolean GeomFill_LocFunction::D2(const Standard_Real Param, |
77 | // const Standard_Real First, |
78 | const Standard_Real , |
79 | // const Standard_Real Last) |
80 | const Standard_Real ) |
81 | { |
82 | TColgp_Array1OfPnt2d T1(1,1); |
83 | TColgp_Array1OfVec2d T2(1,1), T3(1,1); |
75259fc5 |
84 | gp_Mat aM, aDM, aD2M; |
7fd59977 |
85 | Standard_Boolean B; |
75259fc5 |
86 | B = myLaw->D2(Param, aM, V.ChangeValue(1), |
87 | aDM, DV.ChangeValue(1), |
88 | aD2M, D2V.ChangeValue(1), |
7fd59977 |
89 | T1, T2, T3); |
75259fc5 |
90 | V(2).SetXYZ(aM.Column(1)); |
91 | V(3).SetXYZ(aM.Column(2)); |
92 | V(4).SetXYZ(aM.Column(3)); |
7fd59977 |
93 | |
75259fc5 |
94 | DV(2).SetXYZ(aDM.Column(1)); |
95 | DV(3).SetXYZ(aDM.Column(2)); |
96 | DV(4).SetXYZ(aDM.Column(3)); |
7fd59977 |
97 | |
98 | |
75259fc5 |
99 | D2V(2).SetXYZ(aD2M.Column(1)); |
100 | D2V(3).SetXYZ(aD2M.Column(2)); |
101 | D2V(4).SetXYZ(aD2M.Column(3)); |
7fd59977 |
102 | |
103 | return B; |
104 | } |
105 | |
106 | void GeomFill_LocFunction::DN(const Standard_Real Param, |
107 | const Standard_Real First, |
108 | const Standard_Real Last, |
109 | const Standard_Integer Order, |
110 | Standard_Real& Result, |
111 | Standard_Integer& Ier) |
112 | { |
113 | Standard_Boolean B; |
114 | Standard_Real * AddrResult = &Result; |
115 | const Standard_Real * LocalResult=NULL; |
116 | |
117 | Ier = 0; |
118 | switch (Order) { |
119 | case 0: |
120 | { |
121 | B = D0(Param, First, Last); |
122 | LocalResult = (Standard_Real*)(&V(1)); |
123 | break; |
124 | } |
125 | case 1: |
126 | { |
127 | B = D1(Param, First, Last); |
128 | LocalResult = (Standard_Real*)(&DV(1)); |
129 | break; |
130 | } |
131 | case 2: |
132 | { |
133 | B = D2(Param, First, Last); |
134 | LocalResult = (Standard_Real*)(&D2V(1)); |
135 | break; |
136 | } |
137 | default : |
138 | { |
139 | B = Standard_False; |
140 | } |
141 | } |
142 | if (!B) { |
143 | Ier = Order+1; |
144 | } |
145 | for (Standard_Integer ii=0; ii<=11; ii++) { |
146 | AddrResult[ii] = LocalResult[ii]; |
147 | } |
148 | } |