void ArcBall_Update (void) { int setSize = setSizes[axisSet]; HVect *set = (HVect *)(sets[axisSet]); vFrom = MouseOnSphere(vDown, center, radius); vTo = MouseOnSphere(vNow, center, radius); if (dragging) { if (axisSet!=NoAxes) { vFrom = ConstrainToAxis(vFrom, set[axisIndex]); vTo = ConstrainToAxis(vTo, set[axisIndex]); } qDrag = Qt_FromBallPoints(vFrom, vTo); qNow = Qt_Mul(qDrag, qDown); } else { if (axisSet!=NoAxes) axisIndex = NearestConstraintAxis(vTo, set, setSize); } Qt_ToBallPoints(qDown, &vrFrom, &vrTo); Qt_ToMatrix(Qt_Conj(qNow), mNow); /* Gives transpose for GL. */ }
void Trackball::GetCurrentRotation(double *returnRot) { Mat4d tempRot; Qt_ToMatrix(mCurrQuat,tempRot); for(int x=0;x<4;x++) { for(int y=0;y<4;y++) {returnRot[4*x+y]=tempRot[y][x];} } }
void Trackball::GetCurrentRotation(Mat4d & returnRot) { Qt_ToMatrix(mCurrQuat,returnRot); }