VTK  9.7.1
TestParallelCoordinatesUtilities.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
4 #include "vtkDoubleArray.h"
5 #include "vtkNew.h"
6 #include "vtkSmartPointer.h"
7 #include "vtkTable.h"
8 
9 namespace
10 {
11 
12 inline vtkSmartPointer<vtkTable> CreateDummyData()
13 {
14  vtkNew<vtkTable> table;
15 
17  arrX->SetName("x");
18  table->AddColumn(arrX);
20  arrC->SetName("cosine");
21  table->AddColumn(arrC);
23  arrS->SetName("sine");
24  table->AddColumn(arrS);
26  arrS2->SetName("tangent");
27  table->AddColumn(arrS2);
28 
29  int numPoints = 200;
30  float inc = 7.5 / (numPoints - 1);
31  table->SetNumberOfRows(numPoints);
32  for (int i = 0; i < numPoints; ++i)
33  {
34  table->SetValue(i, 0, i * inc);
35  table->SetValue(i, 1, cos(i * inc));
36  table->SetValue(i, 2, sin(i * inc));
37  table->SetValue(i, 3, tan(i * inc) + 0.5);
38  }
39 
40  return table;
41 }
42 
43 }
void SetValue(vtkIdType row, vtkIdType col, vtkVariant value)
Set a value in the table by row and column index as a variant.
void SetNumberOfRows(vtkIdType)
Set the number of rows in the table.
virtual void SetName(const char *)
Set/get array's name.
void AddColumn(vtkAbstractArray *arr)
Add a column to the table.