Name: | _______________________________ |
Student ID: | _______________________________ |
void getAxisAngle(float x0, float y0, float x1, float y1, float& axis, float& ang) { float vec0[3], vec1[3], xprod[3]; vec0[0] = x0; vec0[1] = y0; vec1[0] = x1; vec1[1] = y1; vec0[2] = sqrt(1 - x0*x0 + y0*y0); vec1[2] = sqrt(1 - x1*x1 + y1*y1); xprod = crossproduct(vec0, vec1); axis = normalize(xprod); ang = arcsin(magnitude(xprod)); }