Yes, it was quite satisfying to see that the newer "perspectivemodel 11" (which I developed a while back) actually does match what is done in VRML. I hadn't ever compared it, and it is a relief to see it works so well. The issue comes -- perhaps you would like to experiment -- with moving the center of rotation around the screen, as with CTRL-ALT-left-drag. In many cases it seems to work properly, but if there is a high zoom level with a large protein you will see a difference. It's just not quite right yet. There are three parameters here -- getFieldOfView(), getViewpointPosition(), and adjustViewpointPosition(). The first one is correct. I think the second and third ones are not quite right. The perspective model is explained in As described there, the sequence is:

1a) translate the fixed rotation center to (0,0,0) (m)
1b) apply the current molecular rotation (m)
1c) apply zoom-based scaling, scalePixelsPerAngstrom (s)
1d) add a Z-translation, modelCenterOffset (s)

I guess this could be all done with translation, rotation, and scaling, and we may end up doing it that way, but I thought the Viewpoint idea was much smarter. So I have the Viewpoint position moving the *observer* rather than applying a translation (1a), Viewpoint orientation instead of a rotation (1b), and Viewpoint fieldOfView applying (1c).

Now, what about 1d? I think, really, the application of all this is from last to first (or inner to outer) as presented in the VRML syntax:

Transform{ translation 1a ... children
†† Transform { rotation 1b ... children
† †† † Transform{ scale 1c .. children
† †† ††††† Transform { translation 1d ... children
††† † †† † † † [ ...raw model ]
†††††††††† }
†††††† }
†† }

which I now have encoded simply as:

Viewpoint {
††††† position 1a+1d
††††† orientation 1b
††††† fieldOfView† 1c

Transform { children
† † [ ...raw model ]

I think 1d is not applied quite correctly, but I don't know how to fix it. I have a feeling that we won't be able to use Viewpoint, but I'm not sure.

We'll see. Feel free to experiment.


2009/7/21 Angel HerrŠez <>
That's darned good, Bob. Great job!

The X3D export is now up-to-date with that.

Jmol-developers mailing list

Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
phone: 507-786-3107

If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900