Display Coordinates for Axis

Will Schroeder will.schroeder at kitware.com
Thu Jul 8 07:09:25 EDT 1999


Hi Steve-

>I know the size of my vtkActor in world coordinates (from
>anActor->GetBounds), but I'd like to find the bounds of my actor in
>display coordinates.  In other words, the extent of the display that my
>actor takes up.  I've been trying to use vtkCoordinate, but can't seem
>to get it to work.

It might be easier to use code like this:

        viewport->SetWorldPoint(x[0],x[1],x[2],1.0);
        viewport->WorldToDisplay();
        viewport->GetDisplayPoint(dx[0], dx[1], dx[2]);

where "viewport" could be a renderer, since the renderer is a subclass of viewport .

The coordinate path should work as well. You have to set the coordinate system in which the point is defined:

int *pos;
vtkCoordinate *coord = vtkCoordinate::New();
    coord->SetCoordinateSystemToWorld();
    coord->SetValue(0,0,1);  // a corner of my actor in world coords
    pos = coord->GetComputedDisplayValue(vtkViewport *ren);

pos[0] & pos[1] will contain the display coordinates (pixel values in window).

Will




--------------------------------
Dr. William J. Schroeder
Kitware Visualization Solutions / vtk Commercial Support
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 (Phone & Fax)


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list