rgl
rgl copied to clipboard
enhancement: option to set default mousewheel for translational movement rather than zoom
For geographic 3D models, it may useful in an upcoming rgl release to include an option for the mouse wheel to translate through the model rather than magnify it as in this example:
library(rgl);
# cube = test mesh
cube <- cube3d(color = rainbow(6), meshColor = "faces");
shade3d(cube);
# movement = global space units to move per mouse wheel movement
movement <- 0.5;
# will move scene around mesh (note uses openGL axis for camera: + x right, +y up, z in/out of screen)
camForwardBackward = function(wheelDirection){
if(wheelDirection == 1){
observer3d(par3d("observer")[1], par3d("observer")[2], par3d("observer")[3] + movement);
} else if(wheelDirection == 2){
observer3d(par3d("observer")[1], par3d("observer")[2], par3d("observer")[3] - movement);
}
};
rgl.setWheelCallback(rotate = camForwardBackward)
fyi Thank you for considering the above enhancement :-)