예제 #1
0
        public static void RotFromTo2Quat(Matrix x, Matrix y, Matrix q)
        {
            Matrix axis = new Matrix(3, 1);

            axis.Cross(y, x);
            axis.Normalize();

            double angle = Math.Acos(x.Dot(y));
            double s     = Math.Sin(angle / 2.0);

            q[0] = axis[0] * s;
            q[1] = axis[1] * s;
            q[2] = axis[2] * s;
            q[3] = Math.Cos(angle / 2.0);
        }
예제 #2
0
		public static void RotFromTo2Quat(Matrix x, Matrix y, Matrix q)		
		{
			Matrix axis = new Matrix(3,1);
			axis.Cross(y, x);
			axis.Normalize();

			double angle = Math.Acos(x.Dot(y));
			double s = Math.Sin(angle/2.0);
		
			q[0] = axis[0]*s;
			q[1] = axis[1]*s;
			q[2] = axis[2]*s;
			q[3] = Math.Cos(angle/2.0);
		}