[vtkusers] point inside a voxel

Grzegorz Pytel bioinfguy at gmail.com
Tue Aug 4 14:35:57 EDT 2009


I have voxels stored in vtkUnstructuredGrid. On mousemove I want to
determine whether point selected by mouse is inside voxel. I have tried this
(please see code below), but the program behaves like it had infinite loop
on the line: *

double
* *z* = ren.GetZ((*int*)mouse.getX(), (*int*)mouse.getY()). How can I
determine: 1. the world coordinate position of selected point by mouse, 2.
whether point is inside a voxel grid. Does VTK support detection whether
point is inside a voxel or do I have to write my own code?

*

private
* vtkUnstructuredGrid voxelGrid;

vtkPanel sculpturePanel;


*

this
*.sculpturePanel.addMouseMotionListener(*new* MouseMotionListener() {

@Override

*public* *void* mouseMoved(MouseEvent arg0) {

// *TODO* Auto-generated method stub

Point mouse = arg0.getLocationOnScreen();

vtkRenderer ren = sculpturePanel.GetRenderer();

*double* *z* = ren.GetZ((*int*)mouse.getX(), (*int*)mouse.getY());
///?????!!!!!!!!

ren.SetDisplayPoint(mouse.getX(), mouse.getY(), ren.GetZ((*int*)mouse.getX(),
(*int*)mouse.getY()));

ren.DisplayToWorld();

}

 @Override

*public* *void* mouseDragged(MouseEvent arg0) {

// *TODO* Auto-generated method stub

}

});



Thanks in advance,

Gregory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090804/e352f8eb/attachment.htm>


More information about the vtkusers mailing list