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

Method EvaluatePosition

Common/DataModel/vtkHigherOrderWedge.cxx:340–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340int vtkHigherOrderWedge::EvaluatePosition(const double x[3], double closestPoint[3], int& subId,
341 double pcoords[3], double& minDist2, double weights[])
342{
343 int result = 0;
344
345 int dummySubId;
346 double linearWeights[8];
347 double tmpDist2;
348 vtkVector3d params;
349 vtkVector3d tmpClosestPt;
350
351 minDist2 = VTK_DOUBLE_MAX;
352 vtkIdType nwedge = this->GetNumberOfApproximatingWedges();
353 for (int subCell = 0; subCell < nwedge; ++subCell)
354 {
355 vtkWedge* approx = this->GetApproximateWedge(subCell, nullptr, nullptr);
356 int stat = approx->EvaluatePosition(
357 x, tmpClosestPt.GetData(), dummySubId, params.GetData(), tmpDist2, linearWeights);
358 if (stat != -1 && tmpDist2 < minDist2)
359 {
360 result = stat;
361 subId = subCell;
362 minDist2 = tmpDist2;
363 for (int ii = 0; ii < 3; ++ii)
364 {
365 pcoords[ii] = params[ii]; // We will translate the winning parameter values later.
366 if (closestPoint)
367 {
368 closestPoint[ii] = tmpClosestPt[ii];
369 }
370 }
371 }
372 }
373
374 if (result != -1)
375 {
376 // std::cout << "EvaluatePosition([" << x[0] << " " << x[1] << " " << x[2] << "]) => "
377 // << "subId " << subId << " pc " << pcoords[0] << " " << pcoords[1] << " " << pcoords[2];
378
379 /*
380 std::cout << " " << x[0] << " " << x[1] << " " << x[2] << " "
381 << subId << " " << pcoords[0] << " " << pcoords[1] << " " << pcoords[2];
382 */
383 this->TransformApproxToCellParams(subId, pcoords);
384 if (closestPoint)
385 {
386 this->EvaluateLocation(dummySubId, pcoords, closestPoint, weights);
387 /*
388 std::cout
389 << pcoords[0] << " " << pcoords[1] << " " << pcoords[2] << " "
390 << closestPoint[0] << " " << closestPoint[1] << " " << closestPoint[2] << "\n";
391 */
392 }
393 else
394 {
395 this->InterpolateFunctions(pcoords, weights);
396 // std::cout << pcoords[0] << " " << pcoords[1] << " " << pcoords[2] << "\n";
397 }

Callers

nothing calls this directly

Calls 6

GetApproximateWedgeMethod · 0.95
EvaluateLocationMethod · 0.95
GetDataMethod · 0.45
InterpolateFunctionsMethod · 0.45

Tested by

no test coverage detected