/**
   * Figures out the rotation needed to get from one vector to another, then applies that rotation
   * to a third vector and normalizes the result.
   *
   * @param from The vector from which we are finding the transform.
   * @param to The vector to which we are finding the transform.
   * @param vec The vector to be transformed.
   * @return A new vector that represents the rotated and normalized input {@code vec}.
   */
  protected Vector3f transformAndNormalize(Vector3f from, Vector3f to, Vector3f vec) {

    // find the transform between the first two vectors
    Quat4f rot = MathUtil.getRotation(from, to);
    Transform trans = new Transform();

    trans.setIdentity();

    if (!rot.equals(new Quat4f())) {
      trans.setRotation(rot);
    }

    // apply the transform to the third vector and normalize
    Vector3f temp = new Vector3f(vec);

    trans.transform(temp);
    temp.normalize();

    return temp;
  }