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 (I put translations in matrixRotate which is probably not good).
Thankx
in DisplayPanel.java:
public void rotate(Vector3f point, AxisAngle4f axisAngle) {
Matrix4f matrix = new Matrix4f();
Vector3f center = new Vector3f(chemframe.getCenter());
point.negate();
point.add(center);
matrix.setIdentity();
matrix.set(point); //translation
matrixRotate.mul(matrix, matrixRotate);
matrix.setIdentity();
matrix.setRotation(axisAngle); //rotation
matrixRotate.mul(matrix, matrixRotate);
point.negate();
matrix.setIdentity();
matrix.set(point); //translation
matrixRotate.mul(matrix,matrixRotate);
repaint();
}
Fabian
--
Fabian Dortu <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
