<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. 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> // create sphere geometry<br> vtkSphereSource *sphere = vtkSphereSource::New();<br> sphere->SetCenter(0.0, 0.0, 0.0);<br> sphere->SetRadius(1.0);<br> sphere->SetThetaResolution(18);<br> sphere->SetPhiResolution(18);<br><br> // map to graphics library<br> vtkPolyDataMapper *map = vtkPolyDataMapper::New();<br> map->SetInput(sphere->GetOutput());<br><br> // actor coordinates geometry, properties, transformation<br> vtkActor *actor = vtkActor::New();<br> actor->SetMapper(map);<br> actor->GetProperty()->SetColor(0,0,1); // sphere color blue<br><br> // renderers and render window<br> vtkRenderer *renA = vtkRenderer::New();<br> renA->SetViewport(0.0, 0.0, 1.0, 1.0);<br> vtkRenderWindow* win = vtkRenderWindow::New();<br> win->SetSize(300,300);<br> win->AddRenderer(renA);<br><br> // an interactor<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(win);<br><br> renA->SetBackground(1,1,1); // Background color white<br><br> renA->AddActor(actor);<br><br> // add a 2D cursor to each Renderer<br> vtkCursor2D* cursor = vtkCursor2D::New();<br> cursor->SetTranslationMode(1);<br> cursor->SetWrap(1);<br> cursor->SetModelBounds(-0.5, 0.5, -0.5, 0.5, 0.0, 0.0);<br> cursor->SetFocalPoint(0.0, 0.0, 0.0);<br> cursor->AllOff();<br> cursor->AxesOn();<br><br> vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();<br> mapper->SetInput(cursor->GetOutput());<br> actor = vtkActor::New();<br> actor->SetMapper(mapper);<br> actor->GetProperty()->SetColor(1.0, 0.0, 0.0);<br><br> renA->AddActor(actor);<br><br> // render an image (lights and cameras are created automatically)<br> win->Render();<br><br> iren->Start();<br><br> 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>