[vtkusers] Perspective view of vtkCursor3D
Granseier, Michael (VISUS)
granseier at visus.com
Tue Sep 14 06:33:29 EDT 2010
Hi Karthik,
thank you very much for your answer.
Using your suggested widget is much easier than using the vtkCursor3D.
It works fine in my application.
Thanks again and best regards,
Michael
..........................................................
Von: Karthik Krishnan [mailto:karthik.krishnan at kitware.com]
Gesendet: Dienstag, 14. September 2010 11:31
An: Granseier, Michael (VISUS)
Cc: vtkusers at vtk.org
Betreff: Re: [vtkusers] Perspective view of vtkCursor3D
On Mon, Sep 13, 2010 at 8:05 PM, Granseier, Michael (VISUS) <granseier at visus.com<mailto:granseier at visus.com>> wrote:
Dear VTK Users,
I'm trying to mark a three-dimensional point in a volume using the vtkCursor3D class.
My problem is, that the length of the crosshairs' lines stay constant, even if the position of the point is farther away from the camera.
I'm using SetModelBounds to specify the length.
The same problem occurs with a vtkSphereSource. The radius of the source stays the same, no matter how far away it is from the camera.
Is it possible to scale the crosshairs' lines or the sphere radius relative to the camera distance?
So, that the marker-object becomes smaller, the further the specified point is away from the camera and larger, the closer it is?
I presume you mean "becomes larger the further ..."
3D props maintain a fixed physical (world) size, unlike 2D props which maintain a fixed display size.
I'd recommend using the vtkHandleWidget, in conjunction with a vtkPointHandleRepresentation3D. This representation contains a vtkCursor3D and scales it dynamically based on the camera distance, so that it appears to maintain the same normalized display size.
Use the widget with event processing disabled (SetProcessEventsOff()) and its pretty much what you need. Take a look at its tests in VTK for usage.
-------
Alternatively, to dynamically on your own prop you could write a prop that derives from vtkProp3D and internally contains a vtkCursor3D along with its associated polydatamapper and actor. Then override the method RenderOpaqueGeometry to set your own actor scale.... something to the effect of...
int myProp::RenderOpaqueGeometry(vtkViewport *v)
{
// Get camera params
// Use the coordinate conversion methods vtkRenderer to
// compute the right scale so that your cursor maintains the same
// extent in normalized display coordinates.
this->Cursor3DActor->SetScale( computedScale );
return this->Cursor3DActor->RenderOpaqueGeometry(v);
}
--
karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100914/c3cac447/attachment.htm>
More information about the vtkusers
mailing list