public LSL_Rotation(LSL_Rotation Quat) { x = (float)Quat.x; y = (float)Quat.y; z = (float)Quat.z; s = (float)Quat.s; if (x == 0 && y == 0 && z == 0 && s == 0) s = 1; }
public static double Mag(LSL_Rotation q) { return Math.Sqrt(q.x * q.x + q.y * q.y + q.z * q.z + q.s * q.s); }
// Vector-Rotation Math public static LSL_Vector operator *(LSL_Vector v, LSL_Rotation r) { LSL_Rotation vq = new LSL_Rotation(v.x, v.y, v.z, 0); LSL_Rotation nq = new LSL_Rotation(-r.x, -r.y, -r.z, r.s); // adapted for operator * computing "b * a" LSL_Rotation result = nq * (vq * r); return new LSL_Vector(result.x, result.y, result.z); }