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

Method EvaluateFunction

Common/DataModel/vtkImplicitBoolean.cxx:62–133  ·  view source on GitHub ↗

Evaluate boolean combinations of implicit function using current operator.

Source from the content-addressed store, hash-verified

60
61// Evaluate boolean combinations of implicit function using current operator.
62double vtkImplicitBoolean::EvaluateFunction(double x[3])
63{
64 double value = 0;
65 double v;
66 vtkImplicitFunction* f;
67
68 if (this->FunctionList->GetNumberOfItems() == 0)
69 {
70 return value;
71 }
72
73 vtkCollectionSimpleIterator sit;
74 if (this->OperationType == VTK_UNION)
75 { // take minimum value
76 for (value = VTK_DOUBLE_MAX, this->FunctionList->InitTraversal(sit);
77 (f = this->FunctionList->GetNextImplicitFunction(sit));)
78 {
79 if ((v = f->FunctionValue(x)) < value)
80 {
81 value = v;
82 }
83 }
84 }
85
86 else if (this->OperationType == VTK_INTERSECTION)
87 { // take maximum value
88 for (value = -VTK_DOUBLE_MAX, this->FunctionList->InitTraversal(sit);
89 (f = this->FunctionList->GetNextImplicitFunction(sit));)
90 {
91 if ((v = f->FunctionValue(x)) > value)
92 {
93 value = v;
94 }
95 }
96 }
97
98 else if (this->OperationType == VTK_UNION_OF_MAGNITUDES)
99 { // take minimum absolute value
100 for (value = VTK_DOUBLE_MAX, this->FunctionList->InitTraversal(sit);
101 (f = this->FunctionList->GetNextImplicitFunction(sit));)
102 {
103 if ((v = fabs(f->FunctionValue(x))) < value)
104 {
105 value = v;
106 }
107 }
108 }
109
110 else // difference
111 {
112 vtkImplicitFunction* firstF;
113 this->FunctionList->InitTraversal(sit);
114 if ((firstF = this->FunctionList->GetNextImplicitFunction(sit)) != nullptr)
115 {
116 value = firstF->FunctionValue(x);
117 }
118
119 for (this->FunctionList->InitTraversal(sit);

Callers

nothing calls this directly

Calls 3

FunctionValueMethod · 0.80
GetNumberOfItemsMethod · 0.45
InitTraversalMethod · 0.45

Tested by

no test coverage detected