[vtkusers] vtkStructuredGrid with dimensions (x, y=1, z=1) or (x, y=1) bug?

da remywendy at gmail.com
Mon Oct 5 17:23:57 EDT 2009


I believe I've got this figured out.

On rendering a PolyData and changing the representation in vtkActor()'s
vtkProperty, Lines and Vertices are always going to be displayed regardless
of the representation (wireframe, point, surface). However, if its Polygon,
changing the representation to wireframe will render the wireframe of the
bounded polygons, while Point will display the Vertices that make up the
polygon (even if there are no vertices defined in the PolyData).

Because a (x,y=1,z=1) structured grid only produced Lines in PolyData, that
was all that showed up and changing the vtkProperty representation to Points
doesn't change anything.

Here is the legacy file I played around with in Paraview to understand this.

# vtk DataFile Version 1.0
Grid Example
ASCII
DATASET POLYDATA
POINTS 27 float
0.0 0.0 0.0
1.0 0.0 0.0
2.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
2.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
2.0 0.0 1.0
0.0 1.0 1.0
1.0 1.0 1.0
2.0 1.0 1.0
0.0 1.0 2.0
1.0 1.0 2.0
2.0 1.0 2.0
0.0 1.0 3.0
1.0 1.0 3.0
2.0 1.0 3.0
0.0 1.0 4.0
1.0 1.0 4.0
2.0 1.0 4.0
0.0 1.0 5.0
1.0 1.0 5.0
2.0 1.0 5.0
0.0 1.0 6.0
1.0 1.0 6.0
2.0 1.0 6.0

VERTICES 5 10
1 16
1 17
1 18
1 19
1 20

LINES 27 81
2 0 1
2 1 2
2 2 3
2 3 4
2 4 5
2 5 6
2 6 7
2 7 8
2 8 9
2 9 10
2 10 11
2 11 12
2 12 13
2 13 14
2 14 15
2 15 16
2 16 17
2 17 18
2 18 19
2 19 20
2 20 21
2 21 22
2 22 23
2 23 24
2 24 25
2 25 26
2 26 0

POLYGONS 2 10
4 0 1 2 3
4 6 7 8 1


On Mon, Oct 5, 2009 at 11:03 AM, da <remywendy at gmail.com> wrote:

> Hi all,
>
> I posted this problem a few months back, and still haven't been able to
> figure this out so I figured I would try again on the mailing list.
>
> The problem is that vtkStructuredGrid dimensions of (x,y=1,z=1) or (x, y=1)
> do not seem to display correctly (and doesn't display at all on Paraview).
> In my application, after passing through a vtkStructuredGridGeometryFilter
> and vtkDataSetMapper, the vtkActor->GetProperty()->SetRepresentationTo(xxx)
> no longer works; I cannot see points or surface or wireframe (it always
> shows an outline, which is the same as what it would look like in
> wireframe).
>
> Attached is a (x,y=1,z=1) plot3d file that you can open up with Paraview to
> see the problem. (options= unselect everything, not binary or any other
> option).
>
> Because a vtkStructuredGrid with (x,y,z=1) displays fine, I'm guessing this
> has to do with the structured grid having ncells = npoints-1, and the cells
> types are all lines; somehow its not being mapped or rendered correctly? Or
> am I not implementing the correct pipeline after
> vtkStructuredGridGeometryFilter?
>
>
>
> Currently, what I do when I read a structured grid with dimensions of
> (x,y=1,z=1) or (x, y=1), I manually convert the vtkStructuredGrid to a
> vtkPolyData with the following, just so it displays correctly. However, I
> want to get rid of this and fix the core of the problem. Any ideas
> appreciated.
>
>     int counter_oneD = 0;
>     for (int a=0; a<3;a++){
>         if (dim[a]==1)
>             counter_oneD++;
>     }
>     if (counter_oneD==2)
>     {
>         vtkPolyData *polyData = vtkPolyData::New();
>         polyData->SetPoints(points);
>         vtkCellArray *carray = vtkCellArray::New();
>         for (int a=0; a<ntemp; a++)
>         {
>             carray->InsertNextCell(1, &a);
>         }
>         polyData->SetVerts(carray);
>         vtkPolyDataMapper *polyMapper = vtkPolyDataMapper::New();
>         polyMapper->SetInput(polyData);
>
>         // need to make member...
>         if (!m_ActorFix)
>             m_ActorFix = vtkActor::New();
>
> m_ActorFix->GetProperty()->SetRepresentation(this->m_Representation);
>         m_ActorFix->GetProperty()->SetPointSize(this->m_PointSize);
>         m_ActorFix->GetProperty()->SetColor(this->m_Color[0],
> this->m_Color[1], this->m_Color[2]);
>         m_ActorFix->SetMapper(polyMapper);
>         renderer->AddActor(m_ActorFix);
>     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091005/4290c82b/attachment.htm>


More information about the vtkusers mailing list