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

Method InterpolatePoint

Common/DataModel/vtkDataSetAttributes.cxx:1050–1080  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Interpolate data from points and interpolation weights. Make sure that the method InterpolateAllocate() has been invoked before using this method.

Source from the content-addressed store, hash-verified

1048// Interpolate data from points and interpolation weights. Make sure that the
1049// method InterpolateAllocate() has been invoked before using this method.
1050void vtkDataSetAttributes::InterpolatePoint(
1051 vtkDataSetAttributes* fromPd, vtkIdType toId, vtkIdList* ptIds, double* weights)
1052{
1053 for (const auto& i : this->RequiredArrays)
1054 {
1055 vtkAbstractArray* fromArray = fromPd->Data[i];
1056 vtkAbstractArray* toArray = this->Data[this->TargetIndices[i]];
1057
1058 // check if the destination array needs nearest neighbor interpolation
1059 int attributeIndex = this->IsArrayAnAttribute(this->TargetIndices[i]);
1060 if (attributeIndex != -1 && this->CopyAttributeFlags[INTERPOLATE][attributeIndex] == 2)
1061 {
1062 vtkIdType numIds = ptIds->GetNumberOfIds();
1063 vtkIdType maxId = ptIds->GetId(0);
1064 double maxWeight = 0;
1065 for (int j = 0; j < numIds; ++j)
1066 {
1067 if (weights[j] > maxWeight)
1068 {
1069 maxWeight = weights[j];
1070 maxId = ptIds->GetId(j);
1071 }
1072 }
1073 toArray->InsertTuple(toId, maxId, fromArray);
1074 }
1075 else
1076 {
1077 toArray->InterpolateTuple(toId, ptIds, fromArray, weights);
1078 }
1079 } // for all arrays to interpolate
1080}
1081
1082//------------------------------------------------------------------------------
1083// Interpolate data from the two points p1,p2 (forming an edge) and an

Callers 6

SubdivideMethod · 0.45
SubdivideMethod · 0.45
SubdivideMethod · 0.45
InterpolateAttributesMethod · 0.45
SubdivideMethod · 0.45

Calls 5

IsArrayAnAttributeMethod · 0.95
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45
InsertTupleMethod · 0.45
InterpolateTupleMethod · 0.45

Tested by

no test coverage detected