<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Hi,<br>
<br>
I have a vtkPolyData, and I need to partition its (polygonal) cells according
to the <br>
normal in each cell.<br>
<br>
More exactly, I want to assign a scalar value to each cell: this value should
be the angle <br>
made by the normal to that cell with the plane xOy. This scalar value will
then be used to<br>
extract subsets of cells (using, e.g., vtkThreshold).<br>
<br>
The sequence of commands should be simple:<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<i>&nbsp; // "model" is the variable that stores the initial vtkPolyData<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // compute the normals<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPolyDataNormals normals = vtkPolyDataNormals.New();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; normals.SetInput(model);<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPolyData output = normals.GetOutput();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output.Update();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // extract the cell data<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkCellData cellData = output.GetCellData();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkDataArray cellNormals = cellData.GetNormals();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // ... use cellNormals to set some scalar values</i><br>
<br>
The only problem is that cellNormals is null. <br>
<br>
>From the documentation of vtkPolyDataNormals, and using personal deduction<br>
skills, I inferred that the output of this filter is a vtkPolyData identical
to the input, <br>
additionally having normal data. I guess though that some of my assumptions
are wrong.<br>
Therefore I come and ask: <b>Where are the normals? How can I access<br>
them, for every single cell?</b><br>
<br>
There is another direction to look at my problem: I do not exclude the existence
of<br>
a simpler way to associate scalar data which are related to normal data.
<b>Is there a filter<br>
that uses the normals to generate scalars?</b> I've studied a few examples
that use <br>
vtkPolyDataNormals, but found nothing.<br>
<br>
Petru<br>
<br>
</body>
</html>