MCPcopy Create free account
hub / github.com/Kitware/VTK / EvaluateGradient

Method EvaluateGradient

Common/DataModel/vtkImplicitBoolean.cxx:136–220  ·  view source on GitHub ↗

Evaluate gradient of boolean combination.

Source from the content-addressed store, hash-verified

134
135// Evaluate gradient of boolean combination.
136void vtkImplicitBoolean::EvaluateGradient(double x[3], double g[3])
137{
138 double value = 0;
139 double v;
140 vtkImplicitFunction* f;
141 vtkCollectionSimpleIterator sit;
142
143 if (this->FunctionList->GetNumberOfItems() == 0)
144 {
145 g[0] = 0;
146 g[1] = 0;
147 g[2] = 0;
148 return;
149 }
150
151 if (this->OperationType == VTK_UNION)
152 { // take minimum value
153 for (value = VTK_DOUBLE_MAX, this->FunctionList->InitTraversal(sit);
154 (f = this->FunctionList->GetNextImplicitFunction(sit));)
155 {
156 if ((v = f->FunctionValue(x)) < value)
157 {
158 value = v;
159 f->FunctionGradient(x, g);
160 }
161 }
162 }
163
164 else if (this->OperationType == VTK_INTERSECTION)
165 { // take maximum value
166 for (value = -VTK_DOUBLE_MAX, this->FunctionList->InitTraversal(sit);
167 (f = this->FunctionList->GetNextImplicitFunction(sit));)
168 {
169 if ((v = f->FunctionValue(x)) > value)
170 {
171 value = v;
172 f->FunctionGradient(x, g);
173 }
174 }
175 }
176
177 if (this->OperationType == VTK_UNION_OF_MAGNITUDES)
178 { // take minimum value
179 for (value = VTK_DOUBLE_MAX, this->FunctionList->InitTraversal(sit);
180 (f = this->FunctionList->GetNextImplicitFunction(sit));)
181 {
182 if ((v = fabs(f->FunctionValue(x))) < value)
183 {
184 value = v;
185 f->FunctionGradient(x, g);
186 }
187 }
188 }
189
190 else // difference
191 {
192 double gTemp[3];
193 vtkImplicitFunction* firstF;

Callers

nothing calls this directly

Calls 4

FunctionValueMethod · 0.80
FunctionGradientMethod · 0.80
GetNumberOfItemsMethod · 0.45
InitTraversalMethod · 0.45

Tested by

no test coverage detected