public Vector3 Gradient(Vector3 point) { Coords3D<SphericalCoords> coords = SphericalCoords.System.FromCartesian(point); var gradient = new Coords3D<SphericalCoords>(SphericalCoords.System, dfdr(coords), dfdtheta(coords) / (coords.FirstComponent * Math.Sin(coords.ThirdComponent)), dfdphi(coords) / coords.FirstComponent ); return SphericalCoords.System.ToCartesian(gradient); }
/// <summary> /// Derivative of the scalar field with respect to r. /// </summary> public double dfdr(Coords3D<SphericalCoords> point) => a * A * Math.Pow(point.FirstComponent, a - 1);
/// <summary> /// Derivative of the scalar field with respect to phi. /// </summary> public double dfdphi(Coords3D<SphericalCoords> point) => c * C * Math.Pow(point.ThirdComponent, c - 1);
/// <summary> /// Derivative of the scalar field with respect to theta. /// </summary> public double dfdtheta(Coords3D<SphericalCoords> point) => b * B * Math.Pow(point.SecondComponent, b - 1);
public SETLINE(Int32 x1, Int32 y1, Int32 z1, Int32 x2, Int32 y2, Int32 z2) { _p1 = new Coords3D(x1, y1, z1); _p2 = new Coords3D(x2, y2, z2); }
public Vector3 Value(Vector3 pos) { var vectOrigin = SphericalCoords.System.FromCartesian(pos); var spherVect = new Coords3D<SphericalCoords>(SphericalCoords.System, R.Value(pos), Phi.Value(pos), Theta.Value(pos)); return spherVect.ToCartesianVector(vectOrigin); }