[vtkusers] vtkPolyDataNormals-access violation reading location..

Amy Squillacote ahs at cfdrc.com
Wed Mar 5 09:22:07 EST 2008


Hi Kiv,

Maybe this is just a typo, but you haven't set a condition where your 
for loop will stop. Instead of "for(int i=0;k;i++)", try "for(int 
i=0;i<k;i++)".

- Amy

kývýlcým helhel wrote:
> Hi everyone,
> I wrote the code below to reach the normals one by one,
>
>
> vtkPolyDataNormals *norm= vtkPolyDataNormals::New();
>     norm->SetInput(pd);
>     norm->FlipNormalsOff();
>     norm->SetComputePointNormals(1);
>     norm->Update();
>     vtkPolyData *vtknorm=norm->GetOutput();
>     vtkPointData *normpoints=vtknorm->GetPointData();
>     vtkDataArray *arraynorm= normpoints->GetNormals();
>     int k=vtknorm->GetNumberOfPoints();
>     for(int i=0;k;i++)
>     {  
>         double* nrm= arraynorm->GetTuple3(i);
>         //nrm=arraynorm->GetTuple3(i);
>         printf("%f %f %f \n",(float)nrm[0],(float)nrm[1],(float)nrm[2]);
>     }
>
> k is 307200, ý have 307200 points in vtkPolyData structure.
> but in this double* nrm= arraynorm->GetTuple3(i); I have access 
> violation exception.I must  find the normals of each point.Please help me
>
> Kiv
>
> ------------------------------------------------------------------------
> Never miss a thing. Make Yahoo your homepage. 
> <http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list