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

Method InterpolateTuple

Common/Core/vtkVariantArray.cxx:553–585  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

551
552//------------------------------------------------------------------------------
553void vtkVariantArray::InterpolateTuple(
554 vtkIdType i, vtkIdList* ptIndices, vtkAbstractArray* source, double* weights)
555{
556 // Note: Something much more fancy could be done here, allowing
557 // the source array be any data type.
558 if (this->GetDataType() != source->GetDataType())
559 {
560 vtkErrorMacro("Cannot CopyValue from array of type " << source->GetDataTypeAsString());
561 return;
562 }
563
564 if (ptIndices->GetNumberOfIds() == 0)
565 {
566 // nothing to do.
567 return;
568 }
569
570 // We use nearest neighbour for interpolating variants.
571 // First determine which is the nearest neighbour using the weights-
572 // it's the index with maximum weight.
573 vtkIdType nearest = ptIndices->GetId(0);
574 double max_weight = weights[0];
575 for (int k = 1; k < ptIndices->GetNumberOfIds(); k++)
576 {
577 if (weights[k] > max_weight)
578 {
579 nearest = k;
580 }
581 }
582
583 this->InsertTuple(i, nearest, source);
584 this->DataChanged();
585}
586
587//------------------------------------------------------------------------------
588void vtkVariantArray::InterpolateTuple(vtkIdType i, vtkIdType id1, vtkAbstractArray* source1,

Callers

nothing calls this directly

Calls 5

GetDataTypeMethod · 0.95
InsertTupleMethod · 0.95
DataChangedMethod · 0.95
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected