Example #1
0
        public static quat FpsQuat(quat rotation, float dx, float dy)
        {
            quat rx    = new quat(AxisAngle.RightHandAround(vec3.Up, angle.FromDegrees(-dx)));
            quat ry    = new quat(AxisAngle.RightHandAround(rotation.Right, angle.FromDegrees(-dy)));
            quat final = rx * ry;

            return(final);
        }
Example #2
0
        public quat rotation(vec2 from, vec2 to)
        {
            vec3  f     = transform(from);
            vec3  t     = transform(to);
            vec3  axis  = vec3.cross(f, t).Normalized;
            angle angle = vec3.AngleBetween(f, t);

            return(new quat(AxisAngle.RightHandAround(axis, angle)));
        }