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

Method SmoothEdges

Infovis/BoostGraphAlgorithms/vtkBoostDividedEdgeBundling.cxx:491–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491void vtkBundlingMetadata::SmoothEdges()
492{
493 // From Mathematica Total[GaussianMatrix[{3, 3}]]
494 int kernelSize = 3;
495 // Has to sum to 1.0 to be correct.
496 float gaussianKernel[] = { 0.10468, 0.139936, 0.166874, 0.177019, 0.166874, 0.139936, 0.10468 };
497 vtkIdType numEdges = this->Graph->GetNumberOfEdges();
498 std::vector<std::vector<vtkVector3f>> smoothedEdgeMesh(
499 numEdges, std::vector<vtkVector3f>(this->MeshCount));
500 for (vtkIdType e = 0; e < numEdges; ++e)
501 {
502 for (int m = 1; m < this->MeshCount - 1; ++m)
503 {
504 vtkVector3f smoothed(0.0f, 0.0f, 0.0f);
505 for (int kernelIndex = 0; kernelIndex < kernelSize * 2 + 1; kernelIndex++)
506 {
507 int m2 = m + kernelIndex - kernelSize;
508 m2 = std::max(0, std::min(this->MeshCount - 1, m2));
509
510 vtkVector3f pt = this->EdgeMesh[e][m2];
511 smoothed = smoothed + gaussianKernel[kernelIndex] * pt;
512 }
513 smoothedEdgeMesh[e][m] = smoothed;
514 }
515 }
516 this->EdgeMesh = smoothedEdgeMesh;
517}
518
519void vtkBundlingMetadata::LayoutEdgePoints()
520{

Callers 1

LayoutEdgePointsMethod · 0.95

Calls 3

maxFunction · 0.50
minFunction · 0.50
GetNumberOfEdgesMethod · 0.45

Tested by

no test coverage detected