------------------------------------------------------------------------------ Evaluate the ImplicitVolume. This returns the interpolated scalar value at x[3].
| 44 | // Evaluate the ImplicitVolume. This returns the interpolated scalar value |
| 45 | // at x[3]. |
| 46 | double vtkImplicitVolume::EvaluateFunction(double x[3]) |
| 47 | { |
| 48 | vtkDataArray* scalars; |
| 49 | int ijk[3]; |
| 50 | vtkIdType numPts, i; |
| 51 | double pcoords[3], weights[8], s; |
| 52 | |
| 53 | // See if a volume is defined |
| 54 | if (!this->Volume || !(scalars = this->Volume->GetPointData()->GetScalars())) |
| 55 | { |
| 56 | vtkErrorMacro( |
| 57 | << "Can't evaluate function: either volume is missing or volume has no point data"); |
| 58 | return this->OutValue; |
| 59 | } |
| 60 | |
| 61 | // Find the cell that contains xyz and get it |
| 62 | if (this->Volume->ComputeStructuredCoordinates(x, ijk, pcoords)) |
| 63 | { |
| 64 | this->Volume->GetCellPoints(this->Volume->ComputeCellId(ijk), this->PointIds); |
| 65 | vtkVoxel::InterpolationFunctions(pcoords, weights); |
| 66 | |
| 67 | numPts = this->PointIds->GetNumberOfIds(); |
| 68 | for (s = 0.0, i = 0; i < numPts; i++) |
| 69 | { |
| 70 | s += scalars->GetComponent(this->PointIds->GetId(i), 0) * weights[i]; |
| 71 | } |
| 72 | return s; |
| 73 | } |
| 74 | else |
| 75 | { |
| 76 | return this->OutValue; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | //------------------------------------------------------------------------------ |
| 81 | vtkMTimeType vtkImplicitVolume::GetMTime() |
nothing calls this directly
no test coverage detected