0032402: Coding Rules - eliminate msvc warning C4668 (symbol is not defined as a...
[occt.git] / src / GeomFill / GeomFill_TgtOnCoons.cxx
CommitLineData
b311480e 1// Created on: 1995-12-04
2// Created by: Laurent BOURESCHE
3// Copyright (c) 1995-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
42cf5bc1 17
7fd59977 18#include <GeomFill_Boundary.hxx>
42cf5bc1 19#include <GeomFill_CoonsAlgPatch.hxx>
20#include <GeomFill_TgtOnCoons.hxx>
21#include <gp_Vec.hxx>
22#include <Standard_Type.hxx>
7fd59977 23
92efcf78 24IMPLEMENT_STANDARD_RTTIEXT(GeomFill_TgtOnCoons,GeomFill_TgtField)
25
7fd59977 26//=======================================================================
27//function : GeomFill_TgtOnCoons
28//purpose :
29//=======================================================================
7fd59977 30GeomFill_TgtOnCoons::GeomFill_TgtOnCoons
31(const Handle(GeomFill_CoonsAlgPatch)& K,
32 const Standard_Integer I) : myK(K), ibound(I)
33{
34}
35
36
37//=======================================================================
38//function : Value
39//purpose :
40//=======================================================================
41
42gp_Vec GeomFill_TgtOnCoons::Value(const Standard_Real W) const
43{
1d47d8d0 44 Standard_Real U = 0.,V = 0.,bid = 0.;
7fd59977 45 switch (ibound){
46 case 0 :
47 myK->Bound(1)->Bounds(V,bid);
48 break;
49 case 1 :
50 myK->Bound(0)->Bounds(bid,U);
51 break;
52 case 2 :
53 myK->Bound(1)->Bounds(bid,V);
54 break;
55 case 3 :
56 myK->Bound(0)->Bounds(U,bid);
57 break;
58 }
59
60 gp_Vec tgk;
61
62 switch (ibound){
63 case 0 :
64 case 2 :
65 U = W;
66 tgk = myK->D1V(U,V);
67 break;
68 case 1 :
69 case 3 :
70 V = W;
71 tgk = myK->D1U(U,V);
72 break;
73 }
74
75 gp_Vec n = myK->Bound(ibound)->Norm(W);
76 Standard_Real scal = tgk.Dot(n);
77 n.Multiply(-scal);
78 tgk.Add(n);
79 return tgk;
80}
81
82
83//=======================================================================
84//function : D1
85//purpose :
86//=======================================================================
87
88gp_Vec GeomFill_TgtOnCoons::D1(const Standard_Real W) const
89{
1d47d8d0 90 Standard_Real U = 0.,V = 0.,bid = 0.;
7fd59977 91 switch (ibound){
92 case 0 :
93 myK->Bound(1)->Bounds(V,bid);
94 break;
95 case 1 :
96 myK->Bound(0)->Bounds(bid,U);
97 break;
98 case 2 :
99 myK->Bound(1)->Bounds(bid,V);
100 break;
101 case 3 :
102 myK->Bound(0)->Bounds(U,bid);
103 break;
104 }
105
106 gp_Vec tgsc,dtgsc;
107
108 switch (ibound){
109 case 0 :
110 case 2 :
111 U = W;
112 tgsc = myK->D1V(U,V);
113 break;
114 case 1 :
115 case 3 :
116 V = W;
117 tgsc = myK->D1U(U,V);
118 break;
119 }
120 dtgsc = myK->DUV(U,V);
121
122 gp_Vec n, dn;
123 myK->Bound(ibound)->D1Norm(W,n,dn);
124
125 Standard_Real scal = tgsc.Dot(n);
126 gp_Vec scaln = n.Multiplied(-scal);
0be7dbe1 127 tgsc.Add(scaln);
7fd59977 128
129 gp_Vec scaldn = dn.Multiplied(-scal);
130
131 Standard_Real scal2 = -dtgsc.Dot(n) - tgsc.Dot(dn);
132 gp_Vec temp = n.Multiplied(scal2);
133
134 temp.Add(scaldn);
135 gp_Vec dtpur = dtgsc.Added(temp);
136
137 return dtpur;
138}
139
140
141//=======================================================================
142//function : D1
143//purpose :
144//=======================================================================
145
146void GeomFill_TgtOnCoons::D1(const Standard_Real W, gp_Vec& T, gp_Vec& DT) const
147{
1d47d8d0 148 Standard_Real U = 0.,V = 0.,bid = 0.;
7fd59977 149 switch (ibound){
150 case 0 :
151 myK->Bound(1)->Bounds(V,bid);
152 break;
153 case 1 :
154 myK->Bound(0)->Bounds(bid,U);
155 break;
156 case 2 :
157 myK->Bound(1)->Bounds(bid,V);
158 break;
159 case 3 :
160 myK->Bound(0)->Bounds(U,bid);
161 break;
162 }
163
164 gp_Vec tgsc,dtgsc;
165
166 switch (ibound){
167 case 0 :
168 case 2 :
169 U = W;
170 tgsc = myK->D1V(U,V);
171 break;
172 case 1 :
173 case 3 :
174 V = W;
175 tgsc = myK->D1U(U,V);
176 break;
177 }
178 dtgsc = myK->DUV(U,V);
179
180 gp_Vec n, dn;
181 myK->Bound(ibound)->D1Norm(W,n,dn);
182
183 Standard_Real scal = tgsc.Dot(n);
184 gp_Vec scaln = n.Multiplied(-scal);
185 T = tgsc.Added(scaln);
186
187 gp_Vec scaldn = dn.Multiplied(-scal);
188
189 Standard_Real scal2 = -dtgsc.Dot(n) - tgsc.Dot(dn);
190 gp_Vec temp = n.Multiplied(scal2);
191
192 temp.Add(scaldn);
193 DT = dtgsc.Added(temp);
194}