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

Method GetApproximateLine

Common/DataModel/vtkBezierCurve.cxx:53–98  ·  view source on GitHub ↗

\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. */

Source from the content-addressed store, hash-verified

51 * before using it to map connectivity-array offsets.
52 */
53vtkLine* 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
100void vtkBezierCurve::InterpolateFunctions(const double pcoords[3], double* weights)
101{

Callers 4

EvaluatePositionMethod · 0.45
ContourMethod · 0.45
ClipMethod · 0.45
IntersectWithLineMethod · 0.45

Calls 13

GetApproxMethod · 0.45
SetNumberOfTuplesMethod · 0.45
PointIndexFromIJKMethod · 0.45
GetPointMethod · 0.45
GetDataMethod · 0.45
SetParametricCoordsMethod · 0.45
dataMethod · 0.45
SetPointMethod · 0.45
SetIdMethod · 0.45
GetIdMethod · 0.45
SetTupleMethod · 0.45

Tested by

no test coverage detected