Point3f[] getCameraFactors() {
aperatureAngle = (float) (Math.atan2(screenPixelCount / 2f,
referencePlaneOffset) * 2 * 180 / Math.PI);
cameraDistanceFromCenter = referencePlaneOffset / scalePixelsPerAngstrom;
Point3f ptRef = new Point3f(screenWidth / 2, screenHeight / 2,
referencePlaneOffset);
unTransformPoint(ptRef, ptRef);
// NOTE: Camera position will be approximate.
// when the model has been shifted with CTRL-ALT
// the center of distortion is not the screen center.
// The simpler perspective model in VRML and U3D
// doesn't allow for that. (of course, one could argue,
// that's because they are more REALISTIC). We do it
// this way so that visual metrics in the model are preserved
// when the model is shifted using CTRL-ALT, and it was found
// that if you didn't do that, moving the model was very odd
// in that a fish-eye distortion was present as you moved it.
// note that navigation mode should be EXACTLY reproduced
// in these renderers.
Point3f ptCamera = new Point3f(screenWidth / 2, screenHeight / 2, 0);
viewer.unTransformPoint(ptCamera, ptCamera);
ptCamera.sub(fixedRotationCenter);
Point3f pt = new Point3f(screenWidth / 2, screenHeight / 2, cameraDistanceFromCenter * scalePixelsPerAngstrom);
viewer.unTransformPoint(pt, pt);
pt.sub(fixedRotationCenter);
ptCamera.add(pt);
/*
System.out.println("TM no " + navigationOffset + " rpo "
+ referencePlaneOffset + " aa " + aperatureAngle + " sppa "
+ scalePixelsPerAngstrom + " vr " + visualRange + " sw/vr "
+ screenWidth / visualRange + " " + ptRef + " " + fixedRotationCenter);
*/
return new Point3f[] {
ptRef,
ptCamera,
fixedRotationCenter,
new Point3f(cameraDistanceFromCenter, aperatureAngle,
scalePixelsPerAngstrom) };
}