[vtkusers] Why doesn't the intersection of the lines of a vtkCursor2D not set at the focal point?
Xiaofeng Z
xf10036 at hotmail.com
Thu Apr 8 21:52:29 EDT 2010
Hi vtkUsers,
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.
int _tmain(int argc, _TCHAR* argv[])
{
// create sphere geometry
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetCenter(0.0, 0.0, 0.0);
sphere->SetRadius(1.0);
sphere->SetThetaResolution(18);
sphere->SetPhiResolution(18);
// map to graphics library
vtkPolyDataMapper *map = vtkPolyDataMapper::New();
map->SetInput(sphere->GetOutput());
// actor coordinates geometry, properties, transformation
vtkActor *actor = vtkActor::New();
actor->SetMapper(map);
actor->GetProperty()->SetColor(0,0,1); // sphere color blue
// renderers and render window
vtkRenderer *renA = vtkRenderer::New();
renA->SetViewport(0.0, 0.0, 1.0, 1.0);
vtkRenderWindow* win = vtkRenderWindow::New();
win->SetSize(300,300);
win->AddRenderer(renA);
// an interactor
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(win);
renA->SetBackground(1,1,1); // Background color white
renA->AddActor(actor);
// add a 2D cursor to each Renderer
vtkCursor2D* cursor = vtkCursor2D::New();
cursor->SetTranslationMode(1);
cursor->SetWrap(1);
cursor->SetModelBounds(-0.5, 0.5, -0.5, 0.5, 0.0, 0.0);
cursor->SetFocalPoint(0.0, 0.0, 0.0);
cursor->AllOff();
cursor->AxesOn();
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
mapper->SetInput(cursor->GetOutput());
actor = vtkActor::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(1.0, 0.0, 0.0);
renA->AddActor(actor);
// render an image (lights and cameras are created automatically)
win->Render();
iren->Start();
return 0;
}
Xiaofeng Z
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100408/e90ef8ac/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cursor2dandsphere.png
Type: image/png
Size: 30253 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100408/e90ef8ac/attachment.png>
More information about the vtkusers
mailing list