<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004>Hi
all,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004> I am trying
to render a cloud of vertices with shading. In the code I have included below, I
generate a pointset representing two orthogonal planes. Since there only are two
planes, I constructed a vtkCellArray with two cells, each cell containing the
vertices of one plane, and then set one normal per cell (during the polydata
construction). However, this generates two flat colored planes, one having the
red color I assigned to the actor while the other one is rendered black (see
screenshot). Does anyone have an idea how to solve this? </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004>Many
thanks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004>Jan.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004>My
Code:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004> int
npixels=100;<BR> vtkPoints* points =
vtkPoints::New();<BR> points->Allocate(2*npixels*npixels);<BR> vtkCellArray*
verts = vtkCellArray::New();<BR> vtkFloatArray* normals =
vtkFloatArray::New();<BR> normals->SetNumberOfComponents(3);<BR> normals->SetNumberOfTuples(2);<BR> normals->InsertNextTuple3(0,0,1);<BR> normals->InsertNextTuple3(1,0,0);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004> float
x,y,z;<BR> <BR> z =
0.0;<BR> verts->InsertNextCell(npixels*npixels);<BR> for(int i=0;
i<npixels;i++)<BR> {<BR> x = -1.0 +
i*2.0/npixels;<BR> for(int j=0; j<npixels;
j++)<BR> {<BR> y =
-1.0+j*2.0/npixels;<BR> int id =
points->InsertNextPoint(x,y,z);<BR> verts->InsertCellPoint(id);<BR> }<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004> x =
0.0;<BR> verts->InsertNextCell(npixels*npixels);<BR> for(i=0;
i<npixels;i++)<BR> {<BR> y = -1.0 +
i*2.0/npixels;<BR> for(int j=0; j<npixels;
j++)<BR> {<BR> z =
-1.0+j*2.0/npixels;<BR> int id =
points->InsertNextPoint(x,y,z);<BR> verts->InsertCellPoint(id);<BR> }<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=496490111-29032004> vtkPolyData*
pd =
vtkPolyData::New();<BR> pd->SetPoints(points);<BR> pd->SetVerts(verts);<BR> pd->GetCellData()->SetNormals(normals);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=496490111-29032004> vtkPolyDataMapper* pdm =
vtkPolyDataMapper::New();<BR> pdm->SetInput(pd);<BR> <BR> vtkActor*
a =
vtkActor::New();<BR> a->SetMapper(pdm);<BR> a->GetProperty()->SetPointSize(4.0);<BR> a->GetProperty()->SetColor(1.0,0.0,0.0);</SPAN></FONT></DIV></BODY></HTML>