public override Point Fun(Point p)
        {
            var point = new Point();

            var n2 = p.X * p.X + p.Y * p.Y;
            var n3 = n2 + 1.0;
            var n4 = 2.0 * p.X;
            var n5 = 0.5 * Math.Atan2(2.0 * p.Y, n2 - 1.0) + -VariationHelper.HalfPi * P1;

            if (n5 > VariationHelper.HalfPi)
            {
                n5 = -VariationHelper.HalfPi + VariationHelper.Fmod(n5 + VariationHelper.HalfPi, Math.PI);
            }
            else if (n5 < -VariationHelper.HalfPi)
            {
                n5 = VariationHelper.HalfPi - VariationHelper.Fmod(VariationHelper.HalfPi - n5, Math.PI);
            }
            var n6 = n3 + n4;
            var n7 = n3 - n4;

            if (Math.Abs(n7) < 1E-300 || n6 / n7 <= 0.0)
            {
                return(p);
            }
            point.X += _wRadiant25 * Math.Log((n3 + n4) / (n3 - n4));
            point.Y += _wRadiant * n5;
            return(point);
        }
        public override Point Fun(Point p)
        {
            var n2 = 1.0 / (_re + 1.0E-300);
            var n3 = _im / 100.0;
            var n4 = Math.Atan2(p.Y, p.X) +
                     VariationHelper.Fmod(VariationHelper.RandomInt(int.MinValue, int.MaxValue), _re) * 2.0 * Math.PI;
            var n5  = _dist * 0.5 * Math.Log(p.X * p.X + p.Y * p.Y);
            var n6  = n4 * n2 + n5 * n3;
            var sin = Math.Sin(n6);
            var cos = Math.Cos(n6);
            var exp = Math.Exp(n5 * n2 - n4 * n3);
            var x   = W * exp * cos;
            var y   = W * exp * sin;

            return(new Point(x, y));
        }
Example #3
0
        public override Point Fun(Point p)
        {
            var    atan2 = Math.Atan2(p.Y, p.X);
            var    n2    = W * Math.Sqrt(VariationHelper.Sqr(p.X) + VariationHelper.Sqr(p.Y));
            double n4;

            if (atan2 >= 0.0)
            {
                var n3 = (int)(atan2 * _knPi);
                if (n3 % 2 == 0)
                {
                    n4 = n3 * _piKn + VariationHelper.Fmod(_kaKn + atan2, _piKn);
                }
                else
                {
                    n4 = n3 * _piKn + VariationHelper.Fmod(-_kaKn + atan2, _piKn);
                }
            }
            else
            {
                var n5 = (int)(-atan2 * _knPi);
                if (n5 % 2 != 0)
                {
                    n4 = -(n5 * _piKn + VariationHelper.Fmod(-_kaKn - atan2, _piKn));
                }
                else
                {
                    n4 = -(n5 * _piKn + VariationHelper.Fmod(_kaKn - atan2, _piKn));
                }
            }

            var sin = Math.Sin(n4);
            var x   = n2 * Math.Cos(n4);
            var y   = n2 * sin;

            return(new Point(x, y));
        }