Example #1
0
  /** Normalizes an angle to lie within [-π,π) radians. */
  public static final double normalizeAnglePi(double rad) {
    rad = Angle.normalizeAnglePi(rad);

    if (rad == Math.PI) {
      return -Math.PI; // to maintain backward compatibility for this version of the method
    }

    return rad;
  }
Example #2
0
  /**
   * Returns the conical angle between this vector and the positive z axis. Zero on the +z axis.
   * Positive elsewhere with max value of PI radians or 180 degrees (in system units).
   */
  public double phiAngle() {
    double phi_RAD;
    if ((this.getX() == 0) && (this.getY() == 0)) {
      if (this.getZ() < 0) {
        phi_RAD = Math.PI;
      } else {
        phi_RAD = 0;
      }
    } else {
      phi_RAD = Math.acos(this.getZ() / this.norm());
    }

    return Angle.fromRad(phi_RAD);
  }
Example #3
0
 /** Returns the conical (unsigned) angle between this vector and vector v. */
 public double angleWith(Vector3d v) {
   return Angle.fromRad(Math.acos(cosAngleWith(v)));
 }
Example #4
0
 /**
  * Returns the conical angle between this vector and the xy-plane. Zero on the xy-plane. Positive
  * above the plane to a max of PI/2 or 90 degrees (in system units), negative below the plane to a
  * min of -PI/2 or -90 degrees (in system units).
  */
 public double elevationAngle() {
   return Angle.fromRad(Math.PI / 2) - phiAngle();
 }