| 53 | } // end anon namespace |
| 54 | |
| 55 | VTK_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. |
| 62 | void 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 |
nothing calls this directly
no test coverage detected