/**
  * Compute the magnitude (length) of a vector
  *
  * @param vector The vector
  * @return The magnitude of the vector
  */
 public static int magnitude(int[] vector) {
   return FixedPointUtils.sqrt(
       FixedPointUtils.multiply(vector[0], vector[0])
           + FixedPointUtils.multiply(vector[1], vector[1])
           + FixedPointUtils.multiply(vector[2], vector[2]));
 }
 /**
  * Multiply a vector by a scalar. <b>Modifies the input vector</b>
  *
  * @param vector The vector
  * @param scalar The scalar
  */
 public static void scalarMultiply(int[] vector, int scalar) {
   for (int i = 0; i < vector.length; i++) vector[i] = FixedPointUtils.multiply(vector[i], scalar);
 }
 /**
  * Compute the cross product of two vectors
  *
  * @param v1 The first vector
  * @param v2 The second vector
  * @param result Where to store the cross product
  */
 public static void cross(int[] p1, int[] p2, int[] result) {
   result[0] = FixedPointUtils.multiply(p1[1], p2[2]) - FixedPointUtils.multiply(p2[1], p1[2]);
   result[1] = FixedPointUtils.multiply(p1[2], p2[0]) - FixedPointUtils.multiply(p2[2], p1[0]);
   result[2] = FixedPointUtils.multiply(p1[0], p2[1]) - FixedPointUtils.multiply(p2[0], p1[1]);
 }