[Paraview] normals in programmable filter

Kathleen Schwarz kas382 at cornell.edu
Tue Jun 26 14:40:18 EDT 2012


Thanks David- that worked perfectly!

On Tue, Jun 26, 2012 at 2:35 PM, David E DeMarle
<dave.demarle at kitware.com>wrote:

> Use vtkDataSetAttributes::Get/SetNormals() to access the normals.
> Likewise use Get/SetTCoords() to access the texture coordinates.
>
> od = self.GetOutput()
> id = self.GetInput()
> od.GetPointData().ShallowCopy(id.GetPointData())
> innorm = od.GetPointData().GetNormals()
> onorm = innorm.NewInstance()
> onorm.DeepCopy(innorm)
> onorm.SetName("NewNormals")
> for x in range(0, onorm.GetNumberOfTuples()):
>  a,b,c = onorm.GetTuple(x)
>  print a,b,c
>  a = -1*a
>  b = -1*b
>  c = -1*c
>  onorm.SetTuple3(x, a,b,c)
> od.GetPointData().SetNormals(onorm)
>
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
> On Tue, Jun 26, 2012 at 2:09 PM, Kathleen Schwarz <kas382 at cornell.edu>
> wrote:
> > Hello,
> > I am trying to transform a surface using a programmable filter, and I am
> > unable to get the output to use the normals.  Even the most basic filter:
> >
> >  output.PointData.append(inputs[0].PointData['Normals'], 'Normals')
> >
> > results in the mesh being copied but the normals not being used.  The
> > normals appear as a Data Array, but are not used in rendering.  However,
> > using the copy arrays option in the properties of the programmable filter
> > lead to the normals being used correctly.
> >
> > What I would like to do is to apply an affine transformation on the point
> > positions and normals (and visualize contours of a scalar field on a
> > uniform, nonorthogonal parallelepiped grid), so I can't just use the copy
> > arrays option.
> >
> > Thanks in advance!
> > -Katie
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120626/57f26b58/attachment-0001.htm>


More information about the ParaView mailing list