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

Method InterpolateTuple

Common/Core/vtkDataArray_InterpolateTuple_time.cxx:55–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53} // end anon namespace
54
55VTK_ABI_NAMESPACE_BEGIN
56//------------------------------------------------------------------------------
57// Interpolate value from the two values, p1 and p2, and an
58// interpolation factor, t. The interpolation factor ranges from (0,1),
59// with t=0 located at p1. This method assumes that the three arrays are of
60// the same type. p1 is value at index id1 in fromArray1, while, p2 is
61// value at index id2 in fromArray2.
62void vtkDataArray::InterpolateTuple(vtkIdType dstTuple, vtkIdType srcTuple1,
63 vtkAbstractArray* source1, vtkIdType srcTuple2, vtkAbstractArray* source2, double t)
64{
65 int type = this->GetDataType();
66
67 if (!vtkDataTypesCompare(type, source1->GetDataType()) ||
68 !vtkDataTypesCompare(type, source2->GetDataType()))
69 {
70 vtkErrorMacro("All arrays to InterpolateValue must be of same type.");
71 return;
72 }
73
74 if (srcTuple1 >= source1->GetNumberOfTuples())
75 {
76 vtkErrorMacro("Tuple 1 out of range for provided array. "
77 "Requested tuple: "
78 << srcTuple1
79 << " "
80 "Tuples: "
81 << source1->GetNumberOfTuples());
82 return;
83 }
84
85 if (srcTuple2 >= source2->GetNumberOfTuples())
86 {
87 vtkErrorMacro("Tuple 2 out of range for provided array. "
88 "Requested tuple: "
89 << srcTuple2
90 << " "
91 "Tuples: "
92 << source2->GetNumberOfTuples());
93 return;
94 }
95
96 vtkDataArray* src1DA = vtkDataArray::FastDownCast(source1);
97 vtkDataArray* src2DA = vtkDataArray::FastDownCast(source2);
98 if (!src1DA || !src2DA)
99 {
100 vtkErrorMacro("Both arrays must be vtkDataArray subclasses.");
101 return;
102 }
103
104 bool fallback = type == VTK_BIT;
105
106 if (!fallback)
107 {
108 InterpolateTupleWorker worker(srcTuple1, srcTuple2, dstTuple, t);
109 // Use fallback if dispatch fails:
110 fallback = !vtkArrayDispatch::Dispatch3SameValueType::Execute(src1DA, src2DA, this, worker);
111 }
112

Callers

nothing calls this directly

Calls 12

GetDataTypeMinMethod · 0.95
GetDataTypeMaxMethod · 0.95
InsertComponentMethod · 0.95
FastDownCastFunction · 0.70
ExecuteFunction · 0.50
maxFunction · 0.50
minFunction · 0.50
floorFunction · 0.50
GetDataTypeMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetComponentMethod · 0.45

Tested by

no test coverage detected