コード例 #1
0
        /// <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);
        }
コード例 #2
0
 public static Half Cosh(Half x) =>
 (Half)M.Cosh(x);
コード例 #3
0
ファイル: Math.cs プロジェクト: zjloscar/Dynamo
 public static double Cosh(double value)
 {
     return(CSMath.Cosh(value));
 }
コード例 #4
0
ファイル: Angle.cs プロジェクト: Bery0za/Methematica
 public Real Cosh()
 {
     return(Math.Cosh(Radians));
 }
コード例 #5
0
ファイル: Math.cs プロジェクト: venusdharan/Dynamo
 /// <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));
 }
コード例 #6
0
            /// <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);
            }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
 /// <inheritdoc cref="IHyperbolicFunctions{TSelf}.Cosh(TSelf)" />
 public static double Cosh(double x) => Math.Cosh(x);
コード例 #9
0
 static double IFloatingPoint <double> .Cosh(double x)
 => Math.Cosh(x);
コード例 #10
0
 public static float Cosh(float x)
 {
     return((float)Math.Cosh(x));
 }
コード例 #11
0
 public static nfloat Cosh(nfloat value)
 {
     return((nfloat)Math.Cosh((double)value));
 }