[vtkusers] How to find out whether mouse is moving on Mesh?

Italo Ribeiro italo.ribeiro at gmail.com
Mon Sep 20 13:12:37 EDT 2010


Hi,

I think that you can change actor for type you want.

virtual void OnMouseMove()
    {
        vtkImageActor* actor;

        image->Update();
        // Pick at the mouse location provided by the interactor
        Picker->Pick(this->GetInteractor()->GetEventPosition()[0],
                           this->GetInteractor()->GetEventPosition()[1],
                           0, this->GetDefaultRenderer());


        vtkAssemblyPath* path = this->Picker->GetPath();
        bool validPick = false;

        if (path)
        {
            vtkCollectionSimpleIterator sit;
            path->InitTraversal(sit);
            vtkAssemblyNode *node;
            for (int i = 0; i < path->GetNumberOfItems() && !validPick; ++i)
            {
                node = path->GetNextNode(sit);
                if (actor ==
vtkImageActor::SafeDownCast(node->GetViewProp()))
                  {
                  validPick = true;
                  }
            }
        }

        vtkInteractorStyleTrackballCamera::OnMouseMove();
 }

2010/9/20 rakesh patil <prakeshofficial at gmail.com>

> Hello,
>
> I have one interpolation function, which accepts three nodes of a triangle
> and an arbitrary point inside triangle. Using these data, it computes the
> depth/bathymetry value of the point inside the triangle. I mean, bathymetry
> information is stored only at node points.
>
> But this is done on mouse click. I click inside a triangle anywhere, and i
> get the bathymetry value at that location. Now i want this to change this
> behaviour from mouse click to mouse move.
>
> The question is how can I come to know whether mouse is over the triangle
> or not? Actually, it is a triangular mesh, how can i find out whether mouse
> is moving over mesh or not?
>
> Thanks
>
> Regards
> Rakesh Patil
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
Ítalo Mendes
ogre.irados.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100920/f588ff60/attachment.htm>


More information about the vtkusers mailing list