[vtkusers] write a specific point's normal of polyData

Hila Hiler hilahiler at gmail.com
Sun Mar 11 14:10:06 EDT 2012


Hi David,

I'll try to explain again:

How I can calculate the normal at a specific point (id) on polydata.
I'd like to visualize that normal too, so how to write that normal (as an
arrow)?

this is what I use, but it doesn't write the normals:
void generateNormals(vtkPolyData* polydata)
{

    // Generate normals
    vtkSmartPointer<vtkPolyDataNormals> normalGenerator =
vtkSmartPointer<vtkPolyDataNormals>::New();
    normalGenerator->SetInput(polydata);

    normalGenerator->ComputePointNormalsOn();
    normalGenerator->ComputeCellNormalsOff();
    normalGenerator->Update();

    polydata = normalGenerator->GetOutput();

    vtkPolyDataWriter* writer = vtkPolyDataWriter::New();
    writer->SetInput(polydata);
    writer->SetFileName("normals.vtk");
    writer->Write();
}

On Sun, Mar 11, 2012 at 7:48 PM, David Doria <daviddoria at gmail.com> wrote:

> On Sun, Mar 11, 2012 at 11:25 AM, Hila Hiler <hilahiler at gmail.com> wrote:
> > Hi All,
> >
> > How should I get and WRITE a normal of a specific point from polyData.
> > The writing on .vtk file in order to examine what I got ...
> >
> > I use this example, but only three first normals set. and again, how I
> can
> > write them?
> > http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataPointNormals
> >
> >
> > Thanks
>
> I'm not sure I understand your question, but if it is "how do I write
> a PolyData to a file?", then the answer is:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/WriteVTP
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120311/e7832df9/attachment.htm>


More information about the vtkusers mailing list