<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2716.2200" name=GENERATOR></HEAD>
<BODY>
<DIV>Petru<SPAN class=356575508-11062004>,</SPAN></DIV>
<DIV><SPAN class=356575508-11062004>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Use&nbsp; normals.ComputeCellNormalsOn() and you should be fine.</SPAN></DIV>
<DIV><SPAN class=356575508-11062004></SPAN>&nbsp;</DIV>
<DIV><SPAN class=356575508-11062004><FONT face=Arial color=#0000ff 
size=2>--Shyam</FONT></SPAN></DIV>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  vtkusers-bounces@vtk.org [mailto:vtkusers-bounces@vtk.org] <B>On Behalf Of 
  </B>Petru Pau<BR><B>Sent:</B> Friday, June 11, 2004 2:12 PM<BR><B>To:</B> 
  vtkusers@vtk.org<BR><B>Subject:</B> [vtkusers] how to get the normal to a 
  cell?<BR><BR></FONT></DIV>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>&gt;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></BLOCKQUOTE></BODY></HTML>