------------------------------------------------------------------------------ Evaluate gradient of the implicit function. Use a numerical scheme: evaluate the function at four points (O,O+dx,O+dy,O+dz) and approximate the gradient. It's damn slow.
| 136 | // the function at four points (O,O+dx,O+dy,O+dz) and approximate the gradient. |
| 137 | // It's damn slow. |
| 138 | void vtkImplicitSelectionLoop::EvaluateGradient(double x[3], double n[3]) |
| 139 | { |
| 140 | double xp[3], yp[3], zp[3], g0, gx, gy, gz; |
| 141 | int i; |
| 142 | |
| 143 | g0 = this->EvaluateFunction(x); // side-effect is to compute DeltaX, Y, and Z |
| 144 | |
| 145 | for (i = 0; i < 3; i++) |
| 146 | { |
| 147 | xp[i] = yp[i] = zp[i] = x[i]; |
| 148 | } |
| 149 | xp[0] += this->DeltaX; |
| 150 | yp[1] += this->DeltaY; |
| 151 | zp[2] += this->DeltaZ; |
| 152 | |
| 153 | gx = this->EvaluateFunction(xp); |
| 154 | gy = this->EvaluateFunction(yp); |
| 155 | gz = this->EvaluateFunction(zp); |
| 156 | |
| 157 | n[0] = (gx - g0) / this->DeltaX; |
| 158 | n[1] = (gy - g0) / this->DeltaY; |
| 159 | n[2] = (gz - g0) / this->DeltaZ; |
| 160 | } |
| 161 | |
| 162 | //------------------------------------------------------------------------------ |
| 163 | vtkMTimeType vtkImplicitSelectionLoop::GetMTime() |
nothing calls this directly
no test coverage detected