[vtkusers] Rendering problem after changing some camera settings

Federico Milano fmilano at gmail.com
Mon Jan 16 15:22:48 EST 2012


Hi,

I'm trying to render a 2D view of vtkCutter applied to polydata. The
polydata is cut perpendicular to its y axis.

If I do the following:

ren->ResetCamera();

 ren->GetRenderWindow()->Render();


I see a thin line (the cut is seen on the xy plane), but I want to see
it on the xz plane. So I do the following:


mAxialPlane->GetNormal(normal);

mAxialCutter->GetOutput()->GetCenter(position);

ren->ResetCamera();


ren->GetActiveCamera()->SetPosition(position[0]+normal[0],
position[1]+normal[1], position[2]+normal[2]);

ren->GetActiveCamera()->SetFocalPoint(position);

ren->GetActiveCamera()->ParallelProjectionOn();

ren->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);

ren->GetRenderWindow()->Render();


I have found two problems:


1) If I set the UP vector with  vtkCamera::OrthogonalizeViewUp
<http://www.vtk.org/doc/nightly/html/classvtkCamera.html#ac00519491b0af991462f8660d75a0aac>
the result is the vector (0, 0, 0) and, of course, I don't see
anything.

1) If I set the ViweUp vector as I do it in the code above, I have to
rotate a little bit the view with the interactor and the image
suddenly appears. It appears in the position and view I was expecting,
but why should I manually rotate it just a little for it to appear
(moreover, when this is working I will disable the rotation with my
own interactor style).


I would really appreciate any hint.


Thanks in advance,


Federico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120116/755de95e/attachment.htm>


More information about the vtkusers mailing list