------------------------------------------------------------------------------
| 679 | |
| 680 | //------------------------------------------------------------------------------ |
| 681 | void vtkDataSetAttributesFieldList::InterpolatePoint(int inputIndex, vtkDataSetAttributes* input, |
| 682 | vtkIdList* inputIds, double* weights, vtkDataSetAttributes* output, vtkIdType toId) const |
| 683 | { |
| 684 | auto& internals = *this->Internals; |
| 685 | for (auto& pair : internals.Fields) |
| 686 | { |
| 687 | auto& fieldInfo = pair.second; |
| 688 | if (inputIndex < 0 || inputIndex > static_cast<int>(fieldInfo.Location.size())) |
| 689 | { |
| 690 | vtkGenericWarningMacro("Incorrect/unknown inputIndex specified : " << inputIndex); |
| 691 | return; |
| 692 | } |
| 693 | else if (fieldInfo.OutputLocation != -1 && fieldInfo.Location[inputIndex] != -1) |
| 694 | { |
| 695 | auto fromArray = input->GetAbstractArray(fieldInfo.Location[inputIndex]); |
| 696 | auto toArray = output->GetAbstractArray(fieldInfo.OutputLocation); |
| 697 | |
| 698 | // check if the destination array needs nearest neighbor interpolation. |
| 699 | int attrIndex = input->IsArrayAnAttribute(fieldInfo.Location[inputIndex]); |
| 700 | if (attrIndex != -1 && |
| 701 | output->GetCopyAttribute(attrIndex, vtkDataSetAttributes::INTERPOLATE) == 2) |
| 702 | { |
| 703 | vtkIdType numIds = inputIds->GetNumberOfIds(); |
| 704 | vtkIdType maxId = inputIds->GetId(0); |
| 705 | double maxWeight = 0.; |
| 706 | for (int j = 0; j < numIds; j++) |
| 707 | { |
| 708 | if (weights[j] > maxWeight) |
| 709 | { |
| 710 | maxWeight = weights[j]; |
| 711 | maxId = inputIds->GetId(j); |
| 712 | } |
| 713 | } |
| 714 | toArray->InsertTuple(toId, maxId, fromArray); |
| 715 | } |
| 716 | else |
| 717 | { |
| 718 | toArray->InterpolateTuple(toId, inputIds, fromArray, weights); |
| 719 | } |
| 720 | } |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | //------------------------------------------------------------------------------ |
| 725 | void vtkDataSetAttributesFieldList::TransformData(int inputIndex, vtkFieldData* input, |
nothing calls this directly
no test coverage detected