Esempio n. 1
0
 @Override
 public Vector3f multiply(Axis axis, Vector3f vector) {
   if (axis == null) {
     throw new NullPointerException("Axis must not be null");
   }
   if (vector == null) {
     throw new NullPointerException("vector must not be null");
   }
   switch (axis) {
     case X:
       this.multiplyX(vector.x());
       return this;
     case Y:
       this.multiplyY(vector.y());
       return this;
     case Z:
       this.multiplyZ(vector.z());
       return this;
     case XY:
       this.multiplyX(vector.x());
       this.multiplyY(vector.y());
       return this;
     case XZ:
       this.multiplyX(vector.x());
       this.multiplyZ(vector.z());
       return this;
     case YZ:
       this.multiplyY(vector.y());
       this.multiplyZ(vector.z());
       return this;
   }
   throw new IllegalArgumentException("Axis is invalid");
 }
Esempio n. 2
0
 @Override
 public Vector3f cross(Vector3f other) {
   return this.set(
       this.y() * other.z() - other.y() * this.z(),
       -this.x() * other.z() + other.x() * this.z(),
       this.x() * other.y() - other.x() * this.y());
 }
Esempio n. 3
0
 @Override
 public Vector3f multiply(Vector3f vector) {
   this.multiplyX(vector.x());
   this.multiplyY(vector.y());
   this.multiplyZ(vector.z());
   return this;
 }
Esempio n. 4
0
 @Override
 public Vector3f subtract(Vector3f vector) {
   this.subtractX(vector.x());
   this.subtractY(vector.y());
   this.subtractZ(vector.z());
   return this;
 }
Esempio n. 5
0
 @Override
 public Vector3f add(Vector3f vector) {
   this.addX(vector.x());
   this.addY(vector.y());
   this.addZ(vector.z());
   return this;
 }
Esempio n. 6
0
 @Override
 public boolean at(Vector3f vector) {
   if (vector == null) {
     return false;
   }
   return this.x() == vector.x() && this.y() == vector.y() && this.z() == vector.z();
 }
Esempio n. 7
0
 @Override
 public Vector3f set(Vector3f vector) {
   if (vector == null) {
     throw new NullPointerException("vector must not be null");
   }
   this.setX(vector.x());
   this.setY(vector.y());
   this.setZ(vector.z());
   return this;
 }
Esempio n. 8
0
 @Override
 public boolean equals(final Object obj) {
   if (this == obj) {
     return true;
   }
   if (!(obj instanceof Vector3f)) {
     return false;
   }
   final Vector3f other = (Vector3f) obj;
   if (this.isMutable() != other.isMutable()) {
     return false;
   }
   if (this.x() != other.x()) {
     return false;
   }
   if (this.y() != other.y()) {
     return false;
   }
   if (this.z() != other.z()) {
     return false;
   }
   return true;
 }
Esempio n. 9
0
 @Override
 public Vector3f divide(Vector3f vector) {
   return this.divide(vector.x(), vector.y(), vector.z());
 }