Link to home
Start Free TrialLog in
Avatar of khdani
khdaniFlag for Israel

asked on

rotating a point about another point

Hello,
I've two points 'a' and 'b',
i do the following commands:

[code]
            float m[] = new float[16];

            gl.glTranslatef(a.x, a.y, a.z);
            gl.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
            gl.glTranslatef(-a.x, -a.y, -a.z);

            gl.glGetFloatv(GL.GL_MODELVIEW_MATRIX, m, 0);
            gl.glLoadIdentity();

            float[] point = new float[4];
            float[] bp = b.getPoints();

            point[0] = m[0] * bp[0] + m[4] * bp[1] + m[8] * bp[2] + m[12] * bp[3];
            point[1] = m[1] * bp[0] + m[5] * bp[1] + m[9] * bp[2] + m[13] * bp[3];
            point[2] = m[2] * bp[0] + m[6] * bp[1] + m[10] * bp[2] + m[14] * bp[3];
            point[3] = m[3] * bp[0] + m[7] * bp[1] + m[11] * bp[2] + m[15] * bp[3];

[/code]

after that, i get a point which is perpendicular to point 'a',
now i want this new point rotate around the vector 'ab',

how can i do it?



ASKER CERTIFIED SOLUTION
Avatar of gsx1022
gsx1022
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial