Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Hi Tomas- Tomas Pluskal wrote:
I'm using VisAD library to visualize a large data sets of mass spectrometry data in 3D. I would like to resample the visible part of the data set according to the current zoom (scale), to get a primitive "level of detail" support. I have added a listener for the projection control, so I know when the scale changes and using MouseBehaviorJ3D.unmake_matrix() I can get the current scale, rotation and translation values. But I don't know how to determine the subset of the domain (X/Y axes), which is currently visible.Is there any simple way how to do it? Thanks!
We do this by using a projection listener to listen for changes and then sampling the screen at the corners to determine the XY bounds. You can use the MouseBehavior.findRay(x,y) method to figure out what the VisAD X/Y/Z values are at screen xy coordinates. Use DisplayImpl.getComponent().getBounds() to figure out how large your canvas is and then sample at the 4 corners. Then for each point, use the ScalarMap.inverseScaleValues() method to convert the x and y values to the scalar values of the map. That should give you the limits of the visible portion of your screen that you can use for resampling. If you have a display side coordinate system (e.g. map projection), your mappings are not necessarily linear. In that case, we sample at 9 points (3 across the top, middle and bottom) on the screen to get a more representative bounds. Don Murray ************************************************************* Don Murray UCAR Unidata Program dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000 (303) 497-8628 Boulder, CO 80307 http://www.unidata.ucar.edu/staff/donm ************************************************************* ============================================================================== To unsubscribe visad, visit: http://www.unidata.ucar.edu/mailing-list-delete-form.html ==============================================================================
visad
archives: