rotateInto method
Write input rotated by this into out. Safe when out == input.
Implementation
void rotateInto(Vector3 input, Vector3 out) {
// v' = v + 2w(q×v) + 2q×(q×v)
final vx = input.x, vy = input.y, vz = input.z;
final tx = 2.0 * (y * vz - z * vy);
final ty = 2.0 * (z * vx - x * vz);
final tz = 2.0 * (x * vy - y * vx);
out.x = vx + w * tx + (y * tz - z * ty);
out.y = vy + w * ty + (z * tx - x * tz);
out.z = vz + w * tz + (x * ty - y * tx);
}