private void changeFocus(MouseEvent e) {
double scale = panelFisheye.scale;
double omniX = e.getX()/scale;
double omniY = e.getY()/scale;
if( !fisheye.isInBounds((int)omniX,(int)omniY))
return;
panelPinhole.grabFocus();
synchronized (imageLock) {
Point3D_F32 norm = new Point3D_F32();
fisheyeDistort.undistortPtoS_F32().compute((float)omniX, (float)omniY, norm);
Rodrigues_F32 rotation = new Rodrigues_F32();
Vector3D_F32 canonical = new Vector3D_F32(0,0,1);
rotation.theta = UtilVector3D_F32.acute(new Vector3D_F32(norm),canonical);
GeometryMath_F32.cross(canonical,norm,rotation.unitAxisRotation);
rotation.unitAxisRotation.normalize();
FMatrixRMaj R = ConvertRotation3D_F32.rodriguesToMatrix(rotation,null);
distorter.setRotationWideToNarrow(R);
distortImage.setModel(new PointToPixelTransform_F32(distorter));
if (inputMethod == InputMethod.IMAGE) {
rerenderPinhole();
}
}
}