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

Method Reduce

Common/DataModel/vtkPlane.cxx:515–527  ·  view source on GitHub ↗

Compose the coordinate sums and then average them (to compute the origin).

Source from the content-addressed store, hash-verified

513 // Compose the coordinate sums and then average them (to
514 // compute the origin).
515 void Reduce()
516 {
517 double sum[3] = { 0, 0, 0 };
518 auto iEnd = this->Sum.end();
519 for (auto itr = this->Sum.begin(); itr != iEnd; ++itr)
520 {
521 vtkMath::Add(sum, (*itr).data(), sum);
522 }
523
524 vtkIdType npts = this->Points->GetNumberOfPoints();
525 vtkMath::Add(this->Origin, sum, this->Origin);
526 vtkMath::MultiplyScalar(this->Origin, (1.0 / npts));
527 }
528};
529
530// Determine the points covariance matrix

Callers

nothing calls this directly

Calls 6

AddFunction · 0.50
MultiplyScalarFunction · 0.50
endMethod · 0.45
beginMethod · 0.45
dataMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected