Example #1
0
 public static Vector3f Multiply(Vector3f v, float scalar) {
   Vector3f v2 = new Vector3f(0, 0, 0);
   v2.x = v.x * scalar;
   v2.y = v.y * scalar;
   v2.z = v.z * scalar;
   return v2;
 }
Example #2
0
 public static Vector3f Add(Vector3f v1, Vector3f v2) {
   Vector3f v3 = new Vector3f(0, 0, 0);
   v3.x = v1.x + v2.x;
   v3.y = v1.y + v2.y;
   v3.z = v1.z + v2.z;
   return v3;
 }
Example #3
0
 public static Vector3f Subtract(Vector3f v1, Vector3f v2) {
   Vector3f v3 = new Vector3f(0, 0, 0);
   v3.x = v1.x - v2.x;
   v3.y = v1.y - v2.y;
   v3.z = v1.z - v2.z;
   return v3;
 }
Example #4
0
  public static Vector3f Divide(Vector3f v, float scalar) {

    if (scalar == 0) throw new RuntimeException("Divide by 0 prohibited");

    Vector3f v2 = new Vector3f(0, 0, 0);
    v2.x = v.x / scalar;
    v2.y = v.y / scalar;
    v2.z = v.z / scalar;
    return v2;
  }