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

Method InterpolateFunctions

Common/DataModel/vtkPolygon.cxx:482–520  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Compute interpolation weights using 1/r**2 normalized sum or mean value coordinate.

Source from the content-addressed store, hash-verified

480// Compute interpolation weights using 1/r**2 normalized sum or mean value
481// coordinate.
482void vtkPolygon::InterpolateFunctions(const double x[3], double* weights)
483{
484 // Compute interpolation weights using mean value coordinate.
485 if (this->UseMVCInterpolation)
486 {
487 this->InterpolateFunctionsUsingMVC(x, weights);
488 return;
489 }
490
491 // Compute interpolation weights using 1/r**2 normalized sum.
492 int i;
493 int numPts = this->Points->GetNumberOfPoints();
494 double sum, pt[3];
495
496 for (sum = 0.0, i = 0; i < numPts; i++)
497 {
498 this->Points->GetPoint(i, pt);
499 weights[i] = vtkMath::Distance2BetweenPoints(x, pt);
500 if (weights[i] == 0.0) // exact hit
501 {
502 for (int j = 0; j < numPts; j++)
503 {
504 weights[j] = 0.0;
505 }
506 weights[i] = 1.0;
507 return;
508 }
509 else
510 {
511 weights[i] = 1.0 / weights[i];
512 sum += weights[i];
513 }
514 }
515
516 for (i = 0; i < numPts; i++)
517 {
518 weights[i] /= sum;
519 }
520}
521
522//------------------------------------------------------------------------------
523// Compute interpolation weights using mean value coordinate.

Callers 15

EvaluatePositionMethod · 0.95
EvaluateLocationMethod · 0.95
CellBoundaryMethod · 0.95
DerivativesMethod · 0.95
EvaluatePositionMethod · 0.45
EvaluateLocationMethod · 0.45
EvaluatePositionMethod · 0.45
EvaluateLocationMethod · 0.45
EvaluatePositionMethod · 0.45
EvaluateLocationMethod · 0.45

Calls 3

GetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45

Tested by 10

TestTetraFunction · 0.36
InterpolateDerivsNumericFunction · 0.36
InterpolateDerivsNumericFunction · 0.36
InterpolateDerivsNumericFunction · 0.36