<!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> </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 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> </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> </DIV>
<DIV><FONT face=Arial size=2></FONT> </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> int i;<BR> float
*initialPoint,*point,*normal,*color;<BR> double x,y,norm;<BR> double
n[3],xv[3],yv[3];<BR> ANNidxArray AnnIDs= new
ANNidx[N]; <BR> ANNdistArray AnnDist= new
ANNdist[N];<BR> <BR> initialPoint=Data->GetOutput()->GetPoint(ID);<BR> normal=Data->GetOutput()->GetPointData()->GetNormals()->GetTuple(ID);<BR> norm=vtkMath::Norm
(normal);<BR> <BR> n[0]=normal[0]/norm;<BR> n[1]=normal[1]/norm;<BR> n[2]=normal[2]/norm; <BR> <BR> kdLocator(N,initialPoint,Tree,AnnIDs,AnnDist);</FONT></DIV>
<DIV><FONT face=Arial size=2> delete[] AnnDist;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> for(i=0;i<N;i++)<BR> { <BR> point=Data->GetOutput()->GetPoint(AnnIDs[i]);
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> vtkMath::Perpendiculars
(n,xv,yv,0);<BR> x=(point[0]-initialPoint[0])*xv[0]+<BR>
(point[1]-initialPoint[1])*xv[1]+<BR>
(point[2]-initialPoint[2])*xv[2];<BR> y=(point[0]-initialPoint[0])*yv[0]+<BR>
(point[1]-initialPoint[1])*yv[1]+<BR>
(point[2]-initialPoint[2])*yv[2];<BR> x=x/bin+W/2;<BR> y=y/bin+W/2;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> color=Data->GetOutput()->GetPointData()->GetScalars()->GetTuple(AnnIDs[i]); <BR> if(x>=0
&& y>=0 &&x<W &&
y<W)<BR>
Image[int(x)][int(y)]=int(0.3*color[0] + 0.59*color[1] +
0.11*color[2]); <BR><BR> } <BR> delete[]
AnnIDs;<BR>}</FONT></DIV></BODY></HTML>