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

Method InterpolatePoint

Common/DataModel/vtkDataSetAttributesFieldList.cxx:681–722  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

679
680//------------------------------------------------------------------------------
681void 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//------------------------------------------------------------------------------
725void vtkDataSetAttributesFieldList::TransformData(int inputIndex, vtkFieldData* input,

Callers

nothing calls this directly

Calls 8

GetAbstractArrayMethod · 0.80
IsArrayAnAttributeMethod · 0.80
GetCopyAttributeMethod · 0.80
sizeMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45
InsertTupleMethod · 0.45
InterpolateTupleMethod · 0.45

Tested by

no test coverage detected