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

Function TestLineSource

Filters/Sources/Testing/Cxx/TestLineSource.cxx:10–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <vtkVector.h>
9
10int TestLineSource(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
11{
12 vtkSmartPointer<vtkMinimalStandardRandomSequence> randomSequence =
13 vtkSmartPointer<vtkMinimalStandardRandomSequence>::New();
14 randomSequence->SetSeed(1);
15
16 vtkSmartPointer<vtkLineSource> lineSource = vtkSmartPointer<vtkLineSource>::New();
17 lineSource->SetResolution(8);
18
19 lineSource->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);
20
21 double point1[3];
22 for (unsigned int i = 0; i < 3; ++i)
23 {
24 randomSequence->Next();
25 point1[i] = randomSequence->GetValue();
26 }
27 lineSource->SetPoint1(point1);
28
29 double point2[3];
30 for (unsigned int i = 0; i < 3; ++i)
31 {
32 randomSequence->Next();
33 point2[i] = randomSequence->GetValue();
34 }
35 lineSource->SetPoint2(point2);
36
37 lineSource->Update();
38
39 vtkSmartPointer<vtkPolyData> polyData = lineSource->GetOutput();
40 vtkSmartPointer<vtkPoints> outputPoints = polyData->GetPoints();
41
42 if (outputPoints->GetDataType() != VTK_FLOAT)
43 {
44 return EXIT_FAILURE;
45 }
46
47 lineSource->SetOutputPointsPrecision(vtkAlgorithm::DOUBLE_PRECISION);
48
49 for (unsigned int i = 0; i < 3; ++i)
50 {
51 randomSequence->Next();
52 point1[i] = randomSequence->GetValue();
53 }
54 lineSource->SetPoint1(point1);
55
56 for (unsigned int i = 0; i < 3; ++i)
57 {
58 randomSequence->Next();
59 point2[i] = randomSequence->GetValue();
60 }
61 lineSource->SetPoint2(point2);
62
63 lineSource->Update();
64
65 polyData = lineSource->GetOutput();
66 outputPoints = polyData->GetPoints();
67

Callers

nothing calls this directly

Calls 15

NewFunction · 0.50
SetSeedMethod · 0.45
SetResolutionMethod · 0.45
NextMethod · 0.45
GetValueMethod · 0.45
SetPoint1Method · 0.45
SetPoint2Method · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
GetPointsMethod · 0.45

Tested by

no test coverage detected