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

Method EvaluateGradient

Common/DataModel/vtkSpheres.cxx:97–129  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Evaluate spheres gradient.

Source from the content-addressed store, hash-verified

95//------------------------------------------------------------------------------
96// Evaluate spheres gradient.
97void vtkSpheres::EvaluateGradient(double x[3], double n[3])
98{
99 int numSpheres, i;
100 double val, minVal;
101 double rTemp[1];
102 double cTemp[3];
103
104 if (!this->Centers || !this->Radii)
105 {
106 vtkErrorMacro(<< "Please define centers and radii!");
107 return;
108 }
109
110 if ((numSpheres = this->Centers->GetNumberOfPoints()) != this->Radii->GetNumberOfTuples())
111 {
112 vtkErrorMacro(<< "Number of radii/centersinconsistent!");
113 return;
114 }
115
116 for (minVal = VTK_DOUBLE_MAX, i = 0; i < numSpheres; i++)
117 {
118 this->Radii->GetTuple(i, rTemp);
119 this->Centers->GetPoint(i, cTemp);
120 val = vtkSphere::Evaluate(cTemp, rTemp[0], x);
121 if (val < minVal)
122 {
123 minVal = val;
124 n[0] = x[0] - cTemp[0];
125 n[1] = x[1] - cTemp[1];
126 n[2] = x[2] - cTemp[2];
127 }
128 }
129}
130
131//------------------------------------------------------------------------------
132int vtkSpheres::GetNumberOfSpheres()

Callers

nothing calls this directly

Calls 5

EvaluateFunction · 0.70
GetNumberOfPointsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetTupleMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected