<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi vtkUsers,<br><br>The following is a program that place a vtkSphere and a vtkCursor2D in a rendering window.&nbsp; My question is why the cursor 2d does not pass the center of the sphere, see attached image.<br><br>int _tmain(int argc, _TCHAR* argv[])<br>{<br>&nbsp;&nbsp;&nbsp; // create sphere geometry<br>&nbsp;&nbsp;&nbsp; vtkSphereSource *sphere = vtkSphereSource::New();<br>&nbsp;&nbsp;&nbsp; sphere-&gt;SetCenter(0.0, 0.0, 0.0);<br>&nbsp;&nbsp;&nbsp; sphere-&gt;SetRadius(1.0);<br>&nbsp;&nbsp;&nbsp; sphere-&gt;SetThetaResolution(18);<br>&nbsp;&nbsp;&nbsp; sphere-&gt;SetPhiResolution(18);<br><br>&nbsp;&nbsp;&nbsp; // map to graphics library<br>&nbsp;&nbsp;&nbsp; vtkPolyDataMapper *map = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; map-&gt;SetInput(sphere-&gt;GetOutput());<br><br>&nbsp;&nbsp;&nbsp; // actor coordinates geometry, properties, transformation<br>&nbsp;&nbsp;&nbsp; vtkActor *actor = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; actor-&gt;SetMapper(map);<br>&nbsp;&nbsp;&nbsp; actor-&gt;GetProperty()-&gt;SetColor(0,0,1); // sphere color blue<br><br>&nbsp;&nbsp;&nbsp; // renderers and render window<br>&nbsp;&nbsp;&nbsp; vtkRenderer *renA = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; renA-&gt;SetViewport(0.0, 0.0, 1.0, 1.0);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow* win = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; win-&gt;SetSize(300,300);<br>&nbsp;&nbsp;&nbsp; win-&gt;AddRenderer(renA);<br><br>&nbsp;&nbsp;&nbsp; // an interactor<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(win);<br><br>&nbsp;&nbsp;&nbsp; renA-&gt;SetBackground(1,1,1); // Background color white<br><br>&nbsp;&nbsp;&nbsp; renA-&gt;AddActor(actor);<br><br>&nbsp;&nbsp;&nbsp; // add a 2D cursor to each Renderer<br>&nbsp;&nbsp;&nbsp; vtkCursor2D* cursor = vtkCursor2D::New();<br>&nbsp;&nbsp;&nbsp; cursor-&gt;SetTranslationMode(1);<br>&nbsp;&nbsp;&nbsp; cursor-&gt;SetWrap(1);<br>&nbsp;&nbsp;&nbsp; cursor-&gt;SetModelBounds(-0.5, 0.5, -0.5, 0.5, 0.0, 0.0);<br>&nbsp;&nbsp;&nbsp; cursor-&gt;SetFocalPoint(0.0, 0.0, 0.0);<br>&nbsp;&nbsp;&nbsp; cursor-&gt;AllOff();<br>&nbsp;&nbsp;&nbsp; cursor-&gt;AxesOn();<br><br>&nbsp;&nbsp;&nbsp; vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; mapper-&gt;SetInput(cursor-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; actor = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; actor-&gt;SetMapper(mapper);<br>&nbsp;&nbsp;&nbsp; actor-&gt;GetProperty()-&gt;SetColor(1.0, 0.0, 0.0);<br><br>&nbsp;&nbsp;&nbsp; renA-&gt;AddActor(actor);<br><br>&nbsp;&nbsp;&nbsp; // render an image (lights and cameras are created automatically)<br>&nbsp;&nbsp;&nbsp; win-&gt;Render();<br><br>&nbsp;&nbsp;&nbsp; iren-&gt;Start();<br><br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br><br><br>Xiaofeng Z<br>
<a href="http://www.xzing.org"></a><br><br>                                               <br /><hr />The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. <a href='http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4' target='_new'>Get busy.</a></body>
</html>