[vtkusers] vtkPolyData - multiple normals per vertex and vertex duplication
david.gobbi at gmail.com
Tue Sep 2 12:08:38 EDT 2014
The simple answer is no, you cannot have multiple normals per point,
so you are stuck with point duplication.
So you might have to devise a way to identify the points other than
their point IDs. One possibility is to add a label array to the
PointData so that each point is labeled by one of 8 unique label
values. A label array can be just a vtkIntArray with the name
"Labels" and the an int for each of the 24 points that has a value
between 0 and 7 to identify which "unique" point each of the actual
points corresponds to.
On Tue, Sep 2, 2014 at 8:24 AM, eternallite2 <cdavid.tran at gmail.com> wrote:
> This is a fundamental question about how to deal with multiple normals per
> If I have a cube with 8 vertices and 6 faces for example, I would store this
> into a vtkPolyData object with
> 8 vtkPoints using vtkPolyData->SetPoints and for the faces I would store
> 6 vtkPolygon (faces) with each face referencing 4 point IDs from the points
> Since there are 6 faces and each face references 4 points, I would have a
> of 6 * 4 = 24 point IDs for the faces.
> This makes sense, but now let's say I want to texture map the cube (or add
> I can't just assign each point one normal or one texture coordinate because
> on a cube,
> every point is shared by 3 other faces so every point would have 3 different
> normals depending on which face of the cube that point is on.
> In VTK, one vtkPoint can only have one normal, so I noticed the way VTK
> tries to remedy this
> is by duplicating the point everytime the face references the point.
> So since every point is referenced by 3 faces in the cube, every point will
> have 3 normals.
> But since there are only 8 unique points, VTK will duplicate the 8 points 3
> times and make 24
> vtkPoints with 24 normals.
> Sorry for the long explanation, so my question is... there are only 8 unique
> points but now my vtkPolyData contains 24 vtkPoints (even though it's 3x
> duplicates), how would I get the individual unique points from the
> vtkPolyData while still preserving its normals/texture coordinates?
> (I know vtkCleanPolyData can merge points within the same position, but they
> also merge
> normals and texture coordinates so that each point has one normal, etc.
> Is there a data structure in VTK that preserves the relationship without
> duplicating? (or can I extract
> the unique points and their referenced texture coordinates, normals easily
> from a vtkPolyData is what I'm asking) -
> Thanks for any help I can get :)
More information about the vtkusers