private Vec2 InvJouk(Vec2 cMul)
        {
            cMul = CMul(CExp(0.0), cMul);
            var minus = cMul.Division(2.0)
                        .Plus(CSqrt(CMul(cMul, cMul).Division(4.0).Minus(new Vec2(P1 * P1, 0.0))))
                        .Minus(_z0);
            var minus2 = cMul.Division(2.0)
                         .Minus(CSqrt(CMul(cMul, cMul).Division(4.0).Minus(new Vec2(P1 * P1, 0.0))))
                         .Minus(_z0);

            return(CNorm(minus) > CNorm(minus2) ? minus : minus2);
        }
示例#2
0
        public override Point Fun(Point p)
        {
            double n2;
            double n3;
            double n4;
            double n5;

            if (Math.Abs(_mode) <= VariationHelper.SmallDouble)
            {
                n2 = p.X;
                n3 = p.Y;
                n4 = 0.0;
                n5 = 0.0;
            }
            else
            {
                n2 = VariationHelper.Psi;
                n3 = VariationHelper.Psi;
                n4 = 0.5;
                n5 = 0.5;
            }

            // var vec2 = new vec2(n2, n3);
            var plus        = new Vec2(n2 * _zoom, n3 * _zoom).Plus(new Vec2(_x0, _y0));
            var vec3        = new Vec2(4.0, 6.0);
            var tilePattern = TilePattern(plus);

            // var tilePattern2 = TilePattern(plus.plus(vec3));
            TilePattern(plus.Plus(vec3.Multiply(3.0)));
            // var smoothStep = G.smoothstep(0.0, 0.03333333333333333, tilePattern - 0.015);
            // var smoothStep2 = G.smoothstep(0.0, 0.03333333333333333, tilePattern2 - 0.015);
            // var n6 = Math.Max(smoothStep2 - smoothStep, 0.0) / G.Length(vec3);
            // var n7 = Math.Max(smoothStep - smoothStep2, 0.0) / G.Length(vec3);

            const double n8          = 0.005;
            var          smoothStep3 = G.Smoothstep(0.0, 0.5, GrungeTex(plus.Division(4.0).Plus(0.5)));

            smoothStep3.Multiply(new Vec3(0.85, 0.68, 0.51));
            var mix = G.Mix(new Vec3(0.0), new Vec3(0.0), SStep(n8, tilePattern));

            new Vec3(2.5, 0.75, 0.25).Multiply(smoothStep3);

            var x = G.Sqrt(G.Max(G.Mix(mix, _vec3, SStep(n8, tilePattern + 0.025)), 0.0)).X;

            if (Math.Abs(_invert) <= VariationHelper.SmallDouble)
            {
                if (x > 0.0)
                {
                    n2 = 0.0;
                    n3 = 0.0;
                    return(p);
                }
            }
            else if (x <= 0.0)
            {
                n2 = 0.0;
                n3 = 0.0;
                return(p);
            }

            var dx = W * (n2 - n4);
            var dy = W * (n3 - n5);

            return(new Point(dx, dy));
        }