OK, the problem is quite "simple" to understand; difficult to solve:
1. When perspectiveDepth is on (standard operation), an adjustment is
made to the XY screen position of a point based on its Z coordinate.
(I'll use caps here for SCREEN coordinates, lower case xyz for molecular
coordinates.) Points nearer to the "camera" are pushed further from the
rotation center's XY position; points further back are collapsed toward
the rotation center's XY position. This gives the illusion of depth.
2. When perspectiveDepth is on, and the rotation center is changed to a
new center that is closer to the camera than the old one, then there is
a problem. Effectively, the camera has been moved closer to the model
(as defined by its rotation center). The "perspective" has changed.
3. This causes the whole model to look "bigger", and this pushes the
nearer points even further from the center.
What to do about it:
1. I think the solution is to decouple the idea of the camera distance
from the idea of the rotation center. We have a model; it is some
distance from the camera. We rotate it around. If part of it moves back,
it gets smaller. We rotate it around a DIFFERENT point. Just because we
do that, the camera shouldn't readjust. Right now the camera is
readjusting, I think, because the Z points of the transformed xyz
coordinates are renormalizing relative to the rotation center. This
should not be happening.
2. In effect, we need one additional point -- the Z-reference point,
from which perspective is calculated. This point would be fixed in the
*transformed* XYZ screen frame, not the molecular xyz frame.
3. I think this business of constantly renormalizing the Z value for the
model based on the rotation center is just complicating things. I think
I understand the issue -- that there has to be some range that the Z
falls into or it will be clipped and the model distorted, but I think we
can get around that.
Proposal:
1. Change Xyzd so that there is a much greater range of allowed Z
values, both positive and negative. This can be done by adding two bits
to the Z storage, dropping 1 from each of X and Y. This should not cause
a problem in X and Y because right now we are allowing for an app window
that is ridiculously large -- 30000 x 30000. I see no loss in limiting
this to 15000 x 15000. This allows a Z range of 131071, which could be
normalized to -65536 to +65535.
2. Set the Z-reference point once per model load and leave it.
3. Reference the camera position to this point.
I THINK what this will do is allow smooth rotation and extensive zooming
without any distortion.
Miguel wrote:
Let's talk about how this should work. Right now there's a problem
with
set windowCentered off
because there is some automatic scaling going on that probably
shouldn't be. But before I go turn it off, I'd like to know what its
purpose is. Go to:
http://www.stolaf.edu/people/hansonr/jmol/test/json/spin.htm
and then click on the following links, in order, about half-way down
the list, repeating the centering switch.
set windowCentered off
center atomno=23
center atomno=9
center atomno=23
center atomno=9
center atomno=23
center atomno=9
center atomno=23
center atomno=9
this is clearly a problem! The desired center is set, and its position
is not changed. But because the zoom or perspective depth is
automatically changing, the xy position of the OTHER center changes,
and the model walks off the page!
How do I get that zoom/perspective depth to not do that?
Don't know.
I don't know what 'windowCentered' is doing.
I feel your pain ... welcome to the club ... misery loves company :-)
Miguel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers