public boolean isCollinearWith(Vector other){
  if (x == 0 && y == 0 && z == 0) {
    return true;
  }
  final double otherX=other.x;
  final double otherY=other.y;
  final double otherZ=other.z;
  if (otherX == 0 && otherY == 0 && otherZ == 0) {
    return true;
  }
  if ((x == 0) != (otherX == 0))   return false;
  if ((y == 0) != (otherY == 0))   return false;
  if ((z == 0) != (otherZ == 0))   return false;
  final double quotientX=otherX / x;
  if (!Double.isNaN(quotientX)) {
    return other.equals(multiply(quotientX));
  }
  final double quotientY=otherY / y;
  if (!Double.isNaN(quotientY)) {
    return other.equals(multiply(quotientY));
  }
  final double quotientZ=otherZ / z;
  if (!Double.isNaN(quotientZ)) {
    return other.equals(multiply(quotientZ));
  }
  throw new RuntimeException("This should not happen");
}

public boolean isCollinearWith ( Vector other ) { if ( x == 0 && y == 0 && z == 0 ) { return true ; } final double otherX = other . x ; final double otherY = other . y ; final double otherZ = other . z ; if ( otherX == 0 && otherY == 0 && otherZ == 0 ) { return true ; } if ( ( x == 0 ) != ( otherX == 0 ) ) return false ; if ( ( y == 0 ) != ( otherY == 0 ) ) return false ; if ( ( z == 0 ) != ( otherZ == 0 ) ) return false ; final double quotientX = otherX / x ; if ( ! Double . isNaN ( quotientX ) ) { return other . equals ( multiply ( quotientX ) ) ; } final double quotientY = otherY / y ; if ( ! Double . isNaN ( quotientY ) ) { return other . equals ( multiply ( quotientY ) ) ; } final double quotientZ = otherZ / z ; if ( ! Double . isNaN ( quotientZ ) ) { return other . equals ( multiply ( quotientZ ) ) ; } throw new RuntimeException ( "This should not happen" ) ; }
returns whether this vector is collinear with another vector .
