<!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.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I wrote some Code to get an image of a surface 
where i stored the color in scalars. I search for the closest point from the 
centre of the image (i use ann because itīs faster than vtkpointfinder). i 
transform the coordinates to&nbsp; x y which i store in an 2dim array. This code 
works but i īm not satisfied. The output of the renderer on the screen is much 
better than the image i created. So, maybe you have some ideas to optimize 
following code.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks a lot</FONT></DIV>
<DIV><FONT face=Arial size=2>Bernhard</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>v</FONT><FONT face=Arial size=2>oid 
Image(vtkPolyDataNormals *Data,ANNkd_tree *Tree,int **Image,int ID,int N,int 
W,double bin)<BR>{<BR>&nbsp;int i;<BR>&nbsp;float 
*initialPoint,*point,*normal,*color;<BR>&nbsp;double x,y,norm;<BR>&nbsp;double 
n[3],xv[3],yv[3];<BR>&nbsp;ANNidxArray&nbsp;AnnIDs= new 
ANNidx[N];&nbsp;<BR>&nbsp;ANNdistArray AnnDist= new 
ANNdist[N];<BR>&nbsp;<BR>&nbsp;initialPoint=Data-&gt;GetOutput()-&gt;GetPoint(ID);<BR>&nbsp;normal=Data-&gt;GetOutput()-&gt;GetPointData()-&gt;GetNormals()-&gt;GetTuple(ID);<BR>&nbsp;norm=vtkMath::Norm 
(normal);<BR>&nbsp;<BR>&nbsp;n[0]=normal[0]/norm;<BR>&nbsp;n[1]=normal[1]/norm;<BR>&nbsp;n[2]=normal[2]/norm;&nbsp;&nbsp;<BR>&nbsp;<BR>&nbsp;kdLocator(N,initialPoint,Tree,AnnIDs,AnnDist);</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;delete[] AnnDist;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>&nbsp;for(i=0;i&lt;N;i++)<BR>&nbsp;{&nbsp;<BR>&nbsp;&nbsp;point=Data-&gt;GetOutput()-&gt;GetPoint(AnnIDs[i]); 
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;vtkMath::Perpendiculars&nbsp; 
(n,xv,yv,0);<BR>&nbsp;&nbsp;x=(point[0]-initialPoint[0])*xv[0]+<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
(point[1]-initialPoint[1])*xv[1]+<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
(point[2]-initialPoint[2])*xv[2];<BR>&nbsp;&nbsp;y=(point[0]-initialPoint[0])*yv[0]+<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
(point[1]-initialPoint[1])*yv[1]+<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
(point[2]-initialPoint[2])*yv[2];<BR>&nbsp;&nbsp;x=x/bin+W/2;<BR>&nbsp;&nbsp;y=y/bin+W/2;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>&nbsp;&nbsp;color=Data-&gt;GetOutput()-&gt;GetPointData()-&gt;GetScalars()-&gt;GetTuple(AnnIDs[i]);&nbsp;<BR>&nbsp;&nbsp;if(x&gt;=0 
&amp;&amp; y&gt;=0 &amp;&amp;x&lt;W &amp;&amp; 
y&lt;W)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;Image[int(x)][int(y)]=int(0.3*color[0] + 0.59*color[1] + 
0.11*color[2]);&nbsp;<BR><BR>&nbsp;}&nbsp;<BR>&nbsp;delete[] 
AnnIDs;<BR>}</FONT></DIV></BODY></HTML>