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

Method EvaluatePosition

Common/DataModel/vtkHigherOrderCurve.cxx:66–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66int vtkHigherOrderCurve::EvaluatePosition(const double x[3], double closestPoint[3], int& subId,
67 double pcoords[3], double& minDist2, double weights[])
68{
69 int result = 0;
70
71 int dummySubId;
72 double linearWeights[2];
73 double tmpDist2;
74 vtkVector3d params;
75 vtkVector3d tmpClosestPt;
76
77 minDist2 = VTK_DOUBLE_MAX;
78 vtkIdType nseg = vtkHigherOrderInterpolation::NumberOfIntervals<1>(this->GetOrder());
79 for (int subCell = 0; subCell < nseg; ++subCell)
80 {
81 vtkLine* approx = this->GetApproximateLine(subCell, nullptr, nullptr);
82 int stat = approx->EvaluatePosition(
83 x, tmpClosestPt.GetData(), dummySubId, params.GetData(), tmpDist2, linearWeights);
84 if (stat != -1 && tmpDist2 < minDist2)
85 {
86 result = stat;
87 subId = subCell;
88 minDist2 = tmpDist2;
89 for (int ii = 0; ii < 3; ++ii)
90 {
91 pcoords[ii] = params[ii]; // We will translate the winning parameter values later.
92 if (closestPoint)
93 {
94 closestPoint[ii] = tmpClosestPt[ii];
95 }
96 }
97 }
98 }
99
100 if (result != -1)
101 {
102 this->TransformApproxToCellParams(subId, pcoords);
103 if (closestPoint)
104 {
105 this->EvaluateLocation(dummySubId, pcoords, closestPoint, weights);
106 }
107 else
108 {
109 this->InterpolateFunctions(pcoords, weights);
110 }
111 }
112
113 return result;
114}
115
116void vtkHigherOrderCurve::EvaluateLocation(
117 int& subId, const double pcoords[3], double x[3], double* weights)

Callers

nothing calls this directly

Calls 6

GetOrderMethod · 0.95
EvaluateLocationMethod · 0.95
GetApproximateLineMethod · 0.45
GetDataMethod · 0.45
InterpolateFunctionsMethod · 0.45

Tested by

no test coverage detected