[vtk-developers] update vtkActor position after translation

Goodwin Lawlor goodwin.lawlor.lists at gmail.com
Sun May 6 14:03:55 EDT 2012


Hi,

Are you following this example?

http://vtkbioeng.cvs.sourceforge.net/viewvc/vtkbioeng/vtkbioeng/Testing/Cxx/TestCollisionDetection.cxx?revision=1.2&view=markup

If you want to manually transform the actors and maintain collision
detection, use vtkTransform instead of vtkMatrix4x4:

vtkTransform *trans0 = vtkTransform::New();
vtkTransform *trans1 = vtkTransoform::New();

collide->SetTransform(0, trans0);
collide->SetTransform(1, trans1);

actor1->SetUserTransform(trans0);
actor2->SetUserTransform(trans1);

//then to transform your models:

trans0->Translate(10.0, 0.0, 0.0);
trans1->RotateX(20.0);

// don't use:
actor1->AddPosition(10.0, 0.0, 0.0);
actor2->RotateX(20.0);

// or any or the other vtkProp3D transformation methods.
// as you found out, the interactors work fine with the user transforms or
matrices.

hth

Goodwin




On Sun, May 6, 2012 at 3:39 PM, M.M Mhiri <mhiri_m at hotmail.com> wrote:

>  Hi all,
> i have a problem to update a vtkActor Position after translation.
>
> I'm using a collision Detection Filter, when i move my object with
> Trackball Actor style
> the collision is ok, but when i move my object using (myActor->SetPosition)
> the collision is not detected.
>
> I'm adding
>            myActor->Modified();
>             myActor->GetProperty()->Modified();
>             myActor->Render(myRenderer, myMapper);
>
>
>
> Please Help !!
>
> Thanks a lot
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120506/00c1988e/attachment.html>


More information about the vtk-developers mailing list