/// <summary> /// Calculates a mesh for a standard euclidean catenoid. /// This will need to be transformed to the various locations later. /// </summary> private static Mesh StandardCatenoid(double waist, double height) { Mesh mesh = new Mesh(); int res = m_params.Res * 2; Func <double, Vector3D[]> oneCircle = z => { double r = waist * Math.Cosh(z / waist); Vector3D cen = new Vector3D(0, 0, z); Vector3D radius = new Vector3D(r, 0); return(Shapeways.Disk(cen, new Vector3D(0, 0, 1), radius, res)); }; double inc = height / (res * 2); for (int i = 0; i < res; i++) { double z1 = inc * i; double z2 = inc * (i + 1); mesh.AddBand(oneCircle(z1), oneCircle(z2)); mesh.AddBand(oneCircle(-z1), oneCircle(-z2)); } return(mesh); }
public static Half Cosh(Half x) => (Half)M.Cosh(x);
public static double Cosh(double value) { return(CSMath.Cosh(value)); }
public Real Cosh() { return(Math.Cosh(Radians)); }
/// <summary> /// Finds the hyperbolic cosine of an angle (radians). /// </summary> /// <param name="angle">An angle in radians.</param> /// <returns name="cosh">Hyperbolic cosine of the angle.</returns> /// <search>hyperbolic cosine</search> public static double Cosh(double angle) { return(CSMath.Cosh(angle)); }
/// <summary> /// The derivative of the phi function. /// https://www.wolframalpha.com/input/?i=derivative+of+a*(1-x*tanh(x))%2Bb*tanh(x) /// </summary> private static double dPhi(double s, double A, double B) { double sech_squared = 1 / Math.Pow(Math.Cosh(s), 2); return(A * (-Math.Tanh(s) - s * sech_squared) + B * sech_squared); }
/// <summary> /// Calculates a mesh for a standard euclidean catenoid. /// This will need to be transformed to the various locations later. /// /// Like above, but we adjust the xy components of the mesh using one of the mappings described here: /// https://arxiv.org/ftp/arxiv/papers/1509/1509.06344.pdf /// I found that paper here: /// https://stackoverflow.com/questions/13211595/how-can-i-convert-coordinates-on-a-circle-to-coordinates-on-a-square /// This is so we can connect up to the RLD mesh later. /// </summary> private static Mesh CatenoidSquared(double waist, double height) { Mesh mesh = new Mesh(); int res = m_params.Res * 2; double diskRad = waist * Math.Cosh(height / 2 / waist);; // NOTE: A band is *not* a constant height slice, // so the input z value is the height at the edge midpoints of the square. Func <double, Vector3D[]> oneCircle = z => { bool neg = z < 0; z = Math.Abs(z); // Radius on disk at a starting edge midpoint. double r = waist * Math.Cosh(z / waist); Vector3D start = new Vector3D(r, 0); Vector3D axis = new Vector3D(0, 0, 1); List <Vector3D> points = new List <Vector3D>(); double angleInc = 2 * Math.PI / res; double angle = 0; for (int i = 0; i < res; i++) { Vector3D point = start; point.RotateAboutAxis(axis, angle); point = DiskToSquare(point, diskRad); double zi = waist * DonHatch.acosh(point.Abs() / waist); if (double.IsNaN(zi)) { zi = 0; } if (neg) { zi *= -1; } Vector3D newPoint = new Vector3D(point.X, point.Y, zi); if (newPoint.DNE) { throw new System.Exception(); } points.Add(newPoint); angle += angleInc; } return(points.ToArray()); }; double inc = height / (res * 2); for (int i = 0; i < res; i++) { double z1 = inc * i; double z2 = inc * (i + 1); mesh.AddBand(oneCircle(z1), oneCircle(z2)); mesh.AddBand(oneCircle(-z1), oneCircle(-z2)); } return(mesh); }
/// <inheritdoc cref="IHyperbolicFunctions{TSelf}.Cosh(TSelf)" /> public static double Cosh(double x) => Math.Cosh(x);
static double IFloatingPoint <double> .Cosh(double x) => Math.Cosh(x);
public static float Cosh(float x) { return((float)Math.Cosh(x)); }
public static nfloat Cosh(nfloat value) { return((nfloat)Math.Cosh((double)value)); }