/** * Create Vector3d from cylindrical coordinates. * * <p>Note: Negative radius is allowed. This reverses the vector direction in x and y. * * @param radius distance from z-axis (XY plane projection radius) * @param theta horizontal azimuth angle (XY plane projection theta) * @param z z-coordinate * @return Vector3d */ public static Vector3d createCylindrical(double radius, double theta, double z) { double theta_MATHRAD = Azimuth.toMathRad(theta); double unitX = Math.cos(theta_MATHRAD); double unitY = Math.sin(theta_MATHRAD); return new Vector3d(radius * unitX, radius * unitY, z); }
/** * Returns the azimuth angle of the projection of this vector on the xy-plane. * * <p>Note: This version uses a faster, less accurate, calculation. */ public double horizontalAzimuthAngleFast() { double angle_MATHRAD = FastAtan.getInstance().atan2(this.getY(), this.getX()); return Azimuth.fromMathRad(angle_MATHRAD); }
/** Returns the azimuth angle of the projection of this vector on the xy-plane. */ public double horizontalAzimuthAngle() { double angle_MATHRAD = Math.atan2(this.getY(), this.getX()); return Azimuth.fromMathRad(angle_MATHRAD); }