[vtkusers] Some help on this one, please
De Boer Ingo
I.deBoer at polytec.de
Wed Apr 9 09:29:38 EDT 2003
Hi,
first of all I am rather new to VTK. I took a look at the
samples and did already some coding.
Now, I want to code a simple cube and show it. I have made
a simple vtk file like:
# vtk DataFile Version 1.0
cube
ASCII
DATASET POLYDATA
POINTS 8 float
0.0 0.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
1.0 1.0 1.0
0.0 1.0 1.0
POLYGONS 6 30
4 0 1 2 3
4 4 5 6 7
4 0 1 5 4
4 2 3 7 6
4 0 4 7 3
4 1 2 6 5
POINT_DATA 8
VECTORS mode8 float
0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00
-6.850900e-04 1.131900e-01 -4.838000e-04
-3.533400e-02 1.260400e-01 6.314500e-02
-5.096200e-02 8.419700e-02 6.382000e-02
-1.532600e-03 2.888500e-01 -7.648200e-04
I can read that with the vtkPolyDataReader and show it.
Now, I want to hardcode the same thing, like:
vtkPoints *points = vtkPoints::New();
points->SetNumberOfPoints(8);
points->InsertPoint( 0, 0.0, 0.0, 0.0);
points->InsertPoint( 1, 1.0, 0.0, 0.0);
points->InsertPoint( 2, 1.0, 1.0, 0.0);
and so on.
I want to put it on a vtkStructuredGrid, like:
vtkStructuredGrid *grid = vtkStructuredGrid::New();
grid->SetPoints(points);
grid->GetPointData()->SetVectors(vectors);
vtkStructuredGridGeometryFilter *geom = vtkStructuredGridGeometryFilter::New();
geom->SetInput(grid);
vtkDataSetMapper *plateMapper = vtkDataSetMapper::New();
plateMapper->SetInput(geom->GetOutput());
But where do I set the polygons ? And how do I build the
polygons ?
The thing is that I don't see anything.
Could anyone give/send me a small sample on this one, please ?
greets
Ingo
More information about the vtkusers
mailing list