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

Method BuildFunctionFromTable

Common/DataModel/vtkPiecewiseFunction.cxx:979–1006  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

977
978//------------------------------------------------------------------------------
979void vtkPiecewiseFunction::BuildFunctionFromTable(
980 double xStart, double xEnd, int size, double* table, int stride)
981{
982 double inc = 0.0;
983 double* tptr = table;
984
985 this->RemoveAllPoints();
986
987 if (size > 1)
988 {
989 inc = (xEnd - xStart) / static_cast<double>(size - 1);
990 }
991
992 int i;
993 for (i = 0; i < size; i++)
994 {
995 vtkPiecewiseFunctionNode* node = new vtkPiecewiseFunctionNode;
996 node->X = xStart + inc * i;
997 node->Y = *tptr;
998 node->Sharpness = 0.0;
999 node->Midpoint = 0.5;
1000
1001 this->Internal->Nodes.push_back(node);
1002 tptr += stride;
1003 }
1004
1005 this->SortAndUpdateRange();
1006}
1007
1008//------------------------------------------------------------------------------
1009void vtkPiecewiseFunction::FillFromDataPointer(int nb, double* ptr)

Callers 1

TestFunction · 0.45

Calls 3

RemoveAllPointsMethod · 0.95
SortAndUpdateRangeMethod · 0.95
push_backMethod · 0.45

Tested by 1

TestFunction · 0.36