コード例 #1
0
        public static double SolveParam_2(double len, double r1, double r2)
        {
            Func <double, double> f = (a) =>
            {
                double fs1, fc1;
                FresnelUtils.Fresnel(a / (r1 * sqrtpi), out fs1, out fc1);

                double fs2, fc2;
                FresnelUtils.Fresnel(a / (r2 * sqrtpi), out fs2, out fc2);

                double fc21 = (fc2 - fc1);
                double fs21 = (fs2 - fs1);

                return(a * a * SysMath.PI * (fc21 * fc21 + fs21 * fs21) - len * len);
            };

            int maxEval = 50; // 30

            try
            {
                double min = 0;
                double max = SysMath.Min(SysMath.Abs(r1), SysMath.Abs(r2)) * MAX_L;
                return(Solver.Solve(f, min, max, Solver.Type.Brent, Solver.DEFAULT_ABSOLUTE_ACCURACY, maxEval));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw;
            }
        }
コード例 #2
0
        public static void Clotho(double s, bool invertY, double a, out double x, out double y)
        {
            double a_sqrtpi = a * sqrtpi;

            double fs, fc;

            FresnelUtils.Fresnel(s / a_sqrtpi, out fs, out fc);

            x = a_sqrtpi * fc;
            y = a_sqrtpi * fs;

            if (invertY)
            {
                y = -y;
            }
        }