2D actors

Hank Childs childs at forum.llnl.gov
Fri Apr 21 19:23:19 EDT 2000


Hello All,

I would like to render a 2D plot, but I am having some problems doing so.

vtkCoordinates *coords = vtkCoordinate::New();
    coords->SetCoordinateSystemToNormalizeViewport();

vtkPolyDataMapper2D  *mapper = vtkPolyDataMapper2D::New();
    mapper->SetInput(aTwoDimensionalDataset); // 3D with z=0
    mapper->SetTransformCoordinate(coords);

vtkActor2D  *actor = vtkActor2D::New();
    actor->SetMapper(mapper);

vtkRenderer   *ren = vtkRenderer::New();
    ren->AddActor2D(actor);
...


For the example I am running right now, my data runs from x=-1,1, y=-1,1,
so mapping to the normalized viewport gives me 1/4 of the view, which is
far better than the unnormalized viewport, which give me one pixel.  I
really don't think that this is the best setup, but I was unable to find a
better one.  I am hoping to avoid scaling the dataset so that its
coordinates coincide with those of the viewport - too hackish.  I would
like some facility to modify the actor as I think that is the correct way
to go, but I can't find any way to do so with an Actor2D.  I am using
2.4, so please forgive me if there is something better out there.  I have
resisted moving to 3.1 because I believe that the UpStream/DownStream
(->Input/Output) ports are broken (someone please correct me if I'm
wrong).

Ultimately, I would like to have a 2D plot up and be able to translate it
and zoom on it.

Can someone point me to an example of a 2D plot or tell me how to do this?

Thanks,
Hank Childs


____________________________________________________________________________

Hank Childs
MeshTV
Lawrence Livermore National Laboratory



--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list