29 |
#include <VTKDriver.hpp> |
#include <VTKDriver.hpp> |
30 |
|
|
31 |
#include <vtkPointData.h> |
#include <vtkPointData.h> |
32 |
#include <vtkActor.h> |
#include <vtkCellData.h> |
33 |
|
#include <vtkLODActor.h> |
34 |
#include <vtkRenderer.h> |
#include <vtkRenderer.h> |
35 |
#include <vtkPolyDataMapper.h> |
#include <vtkPolyDataMapper.h> |
36 |
#include <vtkRenderWindow.h> |
#include <vtkRenderWindow.h> |
91 |
// the graphics primitives for a mapper. We set this actor's mapper to be |
// the graphics primitives for a mapper. We set this actor's mapper to be |
92 |
// coneMapper which we created above. |
// coneMapper which we created above. |
93 |
// |
// |
94 |
vtkActor *anActor = vtkActor::New(); |
vtkLODActor *anActor = vtkLODActor::New(); |
95 |
anActor->SetMapper( mapper ); |
anActor->SetMapper( mapper ); |
96 |
|
anActor->SetNumberOfCloudPoints(1000); |
97 |
|
|
98 |
// Create the Renderer and assign actors to it. A renderer is like a |
// Create the Renderer and assign actors to it. A renderer is like a |
99 |
// viewport. It is part or all of a window on the screen and it is |
// viewport. It is part or all of a window on the screen and it is |
178 |
// the graphics primitives for a mapper. We set this actor's mapper to be |
// the graphics primitives for a mapper. We set this actor's mapper to be |
179 |
// coneMapper which we created above. |
// coneMapper which we created above. |
180 |
// |
// |
181 |
vtkActor *anActor = vtkActor::New(); |
vtkLODActor *anActor = vtkLODActor::New(); |
182 |
anActor->SetMapper( mapper ); |
anActor->SetMapper( mapper ); |
183 |
|
anActor->SetNumberOfCloudPoints(1000); |
184 |
|
|
185 |
// Create the Renderer and assign actors to it. A renderer is like a |
// Create the Renderer and assign actors to it. A renderer is like a |
186 |
// viewport. It is part or all of a window on the screen and it is |
// viewport. It is part or all of a window on the screen and it is |
247 |
aTriangleGrid->SetPoints(vertices); |
aTriangleGrid->SetPoints(vertices); |
248 |
|
|
249 |
vtkDoubleArray* values = vtkDoubleArray::New(); |
vtkDoubleArray* values = vtkDoubleArray::New(); |
250 |
values->Resize(s.numberOfVertices()); |
values->Resize(s.numberOfCells()); |
251 |
for (size_t i=0; i<s.numberOfVertices(); ++i) { |
for (size_t i=0; i<s.numberOfCells(); ++i) { |
252 |
values->InsertNextValue(s.vertex(i)[0]); |
values->InsertNextValue(s.cell(i).reference()); |
253 |
} |
} |
254 |
|
|
255 |
aTriangleGrid->GetPointData()->SetScalars(values); |
aTriangleGrid->GetCellData()->SetScalars(values); |
256 |
|
|
257 |
// We create an instance of vtkPolyDataMapper to map the polygonal data |
// We create an instance of vtkPolyDataMapper to map the polygonal data |
258 |
// into graphics primitives. We connect the output of the cone souece |
// into graphics primitives. We connect the output of the cone souece |
266 |
// the graphics primitives for a mapper. We set this actor's mapper to be |
// the graphics primitives for a mapper. We set this actor's mapper to be |
267 |
// coneMapper which we created above. |
// coneMapper which we created above. |
268 |
// |
// |
269 |
vtkActor *anActor = vtkActor::New(); |
vtkLODActor *anActor = vtkLODActor::New(); |
270 |
anActor->SetMapper( mapper ); |
anActor->SetMapper( mapper ); |
271 |
|
anActor->SetNumberOfCloudPoints(10000); |
272 |
|
|
273 |
|
|
274 |
// Create the Renderer and assign actors to it. A renderer is like a |
// Create the Renderer and assign actors to it. A renderer is like a |
275 |
// viewport. It is part or all of a window on the screen and it is |
// viewport. It is part or all of a window on the screen and it is |