/** {@inheritDoc} */
 public double[] gradient(double x, double[] parameters) {
   final double a = parameters[0];
   final double omega = parameters[1];
   final double phi = parameters[2];
   final double alpha = omega * x + phi;
   final double cosAlpha = FastMath.cos(alpha);
   final double sinAlpha = FastMath.sin(alpha);
   return new double[] {cosAlpha, -a * x * sinAlpha, -a * sinAlpha};
 }
示例#2
0
 /**
  * Simple constructor. Build a vector from its azimuthal coordinates
  *
  * @param alpha azimuth (α) around Z (0 is +X, π/2 is +Y, π is -X and 3π/2 is -Y)
  * @param delta elevation (δ) above (XY) plane, from -π/2 to +π/2
  * @see #getAlpha()
  * @see #getDelta()
  */
 public Vector3D(double alpha, double delta) {
   double cosDelta = FastMath.cos(delta);
   this.x = FastMath.cos(alpha) * cosDelta;
   this.y = FastMath.sin(alpha) * cosDelta;
   this.z = FastMath.sin(delta);
 }
 /** {@inheritDoc} */
 public double value(double x, double[] parameters) {
   final double a = parameters[0];
   final double omega = parameters[1];
   final double phi = parameters[2];
   return a * FastMath.cos(omega * x + phi);
 }