\brief Populate the linear segment returned by GetApprox() with point-data from one voxel-like * intervals of this cell. * * Ensure that you have called GetOrder() before calling this method * so that this->Order is up to date. This method does no checking * before using it to map connectivity-array offsets. */
| 51 | * before using it to map connectivity-array offsets. |
| 52 | */ |
| 53 | vtkLine* vtkBezierCurve::GetApproximateLine( |
| 54 | int subId, vtkDataArray* scalarsIn, vtkDataArray* scalarsOut) |
| 55 | { |
| 56 | vtkLine* approx = this->GetApprox(); |
| 57 | bool doScalars = (scalarsIn && scalarsOut); |
| 58 | if (doScalars) |
| 59 | { |
| 60 | scalarsOut->SetNumberOfTuples(2); |
| 61 | } |
| 62 | int i; |
| 63 | if (!this->SubCellCoordinatesFromId(i, subId)) |
| 64 | { |
| 65 | vtkErrorMacro("Invalid subId " << subId); |
| 66 | return nullptr; |
| 67 | } |
| 68 | // Get the point ids (and optionally scalars) for each of the 2 corners |
| 69 | // in the approximating line spanned by (i, i+1): |
| 70 | for (vtkIdType ic = 0; ic < 2; ++ic) |
| 71 | { |
| 72 | const vtkIdType corner = this->PointIndexFromIJK(i + ic, 0, 0); |
| 73 | vtkVector3d cp; |
| 74 | // Only the first four corners are interpolatory, we need to project the value of the other |
| 75 | // nodes |
| 76 | if (corner < 2) |
| 77 | { |
| 78 | this->Points->GetPoint(corner, cp.GetData()); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | this->SetParametricCoords(); |
| 83 | double pcoords[3]; |
| 84 | this->PointParametricCoordinates->GetPoint(corner, pcoords); |
| 85 | int subIdtps; |
| 86 | const int numtripts = (this->Order[0] + 1); |
| 87 | std::vector<double> weights(numtripts); |
| 88 | this->vtkHigherOrderCurve::EvaluateLocation(subIdtps, pcoords, cp.GetData(), weights.data()); |
| 89 | } |
| 90 | approx->Points->SetPoint(ic, cp.GetData()); |
| 91 | approx->PointIds->SetId(ic, doScalars ? corner : this->PointIds->GetId(corner)); |
| 92 | if (doScalars) |
| 93 | { |
| 94 | scalarsOut->SetTuple(ic, scalarsIn->GetTuple(corner)); |
| 95 | } |
| 96 | } |
| 97 | return approx; |
| 98 | } |
| 99 | |
| 100 | void vtkBezierCurve::InterpolateFunctions(const double pcoords[3], double* weights) |
| 101 | { |
no test coverage detected