> Miguel, > > I try to implement the rotational stuff we discussed previously but I > get some problems. > The purpose is to rotate around an axis defined by "axisAngle" and > passing through the point "point" (see code below). The rotation angle > is included in "axisAngle". The basic idea in the code is to translate > the molecule so that the center of rotation moves to 0,0 (screen > coordinate), then do the rotation and translate again by the opposite > amount of the previous rotation. The scheme in code below works as long > as I don't rotate with the mouse. If I begin to rotate with the mouse > then further call to rotate(...) doesn't behave as expected. Actually, > as I expect; probably because I don't understand very good what is > returned by getViewTransformMatrix(). I guess you will immediately see > what's going wrong in my code Fabian,
Below are some thoughts and observations: Fundamentally, I think your code is correct. I am still struggling to understand some of the matrix transformation processes. The code in getViewTransformMatrix() is essentially the same code that was there before. As I was trying to figure out how the code worked I made the variable names longer so that they would make more sense to me. > (I put translations in matrixRotate which > is probably not good). I am not sure why matrixRotate and matrixTranslate are separate. I think they could be merged together. But I was afraid to take that step right now. If I recall, in the current implementation the units of matrixTranslate are in screen pixels. If we were to merge them I think we would want to convert to angstroms before we merged with matrixRotation. (But right now it is hurting my head to think about it :-) The reason I started working on this code was to fix a bug ... which I still have not fixed. But once I started changing the variable names I decided I should figure out how it works. I added several versions of rotate(...) at the bottom of DisplayPanel.java. I included one for an AngleAxis4f rotation. I added 4 test menu items under the view menu. They are currently tied to rotateX(45) rotateY(45) rotateZ(45) and an AngleAxis rotation of 45 degrees about the 1,1,1 vector. Search for "test1" ... "test4" in the code and you will find it. During testing you can change these items to do whatever you want. I think a good molecule to test out these rotations is samples/bulk_Si.in The more I worked on this, the more I realized what you are trying to do. It is probably the case that you want to do this rotation while keeping the molecule in the center of the screen. If that is the case, then it is going to require a little more thought. I may be mistaken, but my current thinking is that, in the general case, it isn't possible to accomplish that unless we set up a pipeline of transformations to apply. But if you only want to do one AngleAxis rotation about a point then we could build it into the transform process. In the process of working on this I wondered if it would be useful to have an option to display the X, Y, and Z axes on the screen. Do you think that would be useful? I don't think it would be too difficult to build ... although I have some concern that getting the paint process z-ordering correct may be a challenge. I will need to split DisplayPanel.java into two pieces. There is too much code in there and too much of it has to be cloned for the applet. But I'm not ready to do that yet. I have already done some work on a more comprehensive rasmol/chime script interpreter. That will expose quite a bit of functionality in the area of rotations and will allow for fine gradations of rotations/translations/scaling. Can you tell me a little more about the level of "fine rotation" you want? What kind of UI gestures do you want to accomplish this? Do you want a "fine mouse movements" mode? What is the UI you want to use to specify the point and the axis? Can you give me a brief description of the application and what you are trying to accomplish? �Adi�s! Miguel ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jmol-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jmol-developers
