/// <summary> /// Compute the spherical harmonic sum and its gradient. /// </summary> /// <param name="x"><i>x</i> component of the cartesian coordinate.</param> /// <param name="y"><i>y</i> component of the cartesian coordinate.</param> /// <param name="z"><i>z</i> component of the cartesian coordinate.</param> /// <param name="gradx"><i>x</i> component of the gradient.</param> /// <param name="grady"><i>y</i> component of the gradient.</param> /// <param name="gradz"><i>z</i> component of the gradient.</param> /// <returns><i>V</i>, the spherical harmonic sum.</returns> /// <remarks> /// This is the same as <see cref="Evaluate(double, double, double)"/>, /// except that the components of the gradients of the sum in the <i>x</i>, <i>y</i>, and <i>z</i> directions are computed. /// This routine requires constant memory and thus never throws an exception. /// </remarks> public double Evaluate(double x, double y, double z, out double gradx, out double grady, out double gradz) { Span <double> f = stackalloc double[] { 1 }; return(SphericalEngine.Value(true, _norm, _c.Span, f, x, y, z, _a, out gradx, out grady, out gradz)); }
/// <summary> /// Compute the spherical harmonic sum. /// </summary> /// <param name="x"><i>x</i> component of the cartesian coordinate.</param> /// <param name="y"><i>y</i> component of the cartesian coordinate.</param> /// <param name="z"><i>z</i> component of the cartesian coordinate.</param> /// <returns><i>V</i>, the spherical harmonic sum.</returns> /// <remarks> /// This routine requires constant memory and thus never throws an exception. /// </remarks> public double Evaluate(double x, double y, double z) { Span <double> f = stackalloc double[] { 1 }; return(SphericalEngine.Value(false, _norm, _c.Span, f, x, y, z, _a, out _, out _, out _)); }