[vtkusers] Determining vtkActors from point in space
Robbie Banks
robbie.banks at gmail.com
Tue Mar 30 19:37:24 EDT 2010
OK,
Note for all.
Here is how to convert from a point in your model to a point in the viewport
to select an Actor.
vtkSmartPointer<vtkPropPicker> pPicker =
vtkSmartPointer<vtkPropPicker>::New();
double x = location.at(0);
double y = location.at(1);
double z = location.at(2);
vtkSmartPointer<vtkCoordinate> pCoord =
vtkSmartPointer<vtkCoordinate>::New();
pCoord->SetCoordinateSystemToWorld();
pCoord->SetValue(x,y,z);
int * View = pCoord->GetComputedDisplayValue(pRenderer);
pPicker->Pick(View[0],View[1],0,pRenderer);
vtkSmartPointer<vtkActor> pPickedActor = pPicker->GetActor();
pPickedActor->GetProperty()->SetOpacity(opacity);
where location is a QList<double>.
Cheers
Robbie
-----Original Message-----
From: daviddoria at gmail.com [mailto:daviddoria at gmail.com] On Behalf Of David
Doria
Sent: Tuesday, March 30, 2010 2:53 PM
Cc: Robbie Banks; vtkusers at vtk.org
Subject: Re: [vtkusers] Determining vtkActors from point in space
On Tue, Mar 30, 2010 at 5:17 PM, David E DeMarle
<dave.demarle at kitware.com> wrote:
> Make a vtkPicker instead of the Abstract class, then call the
> vtkPicker::GeActors() to get a list of all the actors that are
> underneath the pixel.
>
> David E DeMarle
Robbie,
Here is an example:
http://www.vtk.org/Wiki/VTK/Examples/Interaction/SelectAnActor
Thanks,
David
More information about the vtkusers
mailing list