示例#1
0
        public override double GetWrapped(double x, double y, int wrap)
        {
            double a = SourceModule1.GetWrapped(x, y, wrap);
            double b = SourceModule2.GetWrapped(x, y, wrap);

            return(a + ((b - a) * 0.5f));
        }
        public override double GetWrapped(double x, double y, int wrap)
        {
            double a = SourceModule1.GetWrapped(x, y, wrap);
            double b = SourceModule2.GetWrapped(x, y, wrap);

            if (a > b)
            {
                return(a);
            }
            return(b);
        }
示例#3
0
        public override double GetWrapped(double x, double y, int wrap)
        {
            double a = SourceModule1.GetWrapped(x, y, wrap);
            double b = SourceModule2.GetWrapped(x, y, wrap);

            if (a != b)
            {
                return(IfTrue.GetWrapped(x, y, wrap));
            }

            return(IfFalse.GetWrapped(x, y, wrap));
        }
示例#4
0
        public override double GetWrapped(double x, double y, int wrap)
        {
            // Stretch out t by times to repeat:
            double rep    = SourceModule2.GetWrapped(x, y, wrap);
            bool   mirror = (SourceModule3.GetWrapped(x, y, wrap) > 0.5);

            x *= rep;
            y *= rep;

            // Get the current repetition:
            int baseRepetition = (int)x;

            // Shift:
            x -= baseRepetition;

            // X is now in the 0-1 range.

            if (mirror && (baseRepetition & 1) == 1)
            {
                // "odd" repetition - flip t:
                x = 1.0 - x;
            }

            // Get the current repetition:
            baseRepetition = (int)y;

            // Shift:
            y -= baseRepetition;

            // Y is now in the 0-1 range.

            if (mirror && (baseRepetition & 1) == 1)
            {
                // "odd" repetition - flip t:
                y = 1.0 - y;
            }

            // Read source:
            return(SourceModule1.GetWrapped(x, y, wrap));
        }
示例#5
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     return(Loonim.Math.LinearInterpolate(SourceModule1.GetWrapped(x, y, wrap),
                                          SourceModule2.GetWrapped(x, y, wrap),
                                          (WeightModule.GetWrapped(x, y, wrap) + 1.0) / 2.0));
 }
示例#6
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     return(SourceModule1.GetWrapped(x, y, wrap) * SourceModule2.GetWrapped(x, y, wrap));
 }
示例#7
0
 public override double GetWrapped(double x, double y, int wrap)
 {
     return(System.Math.Atan2(SourceModule1.GetWrapped(x, y, wrap), SourceModule2.GetWrapped(x, y, wrap)));
 }
        public override double GetWrapped(double x, double y, int wrap)
        {
            double controlValue = ControlModule.GetWrapped(x, y, wrap);
            double alpha;

            double lowerBound  = LowerBound.GetWrapped(x, y, wrap);
            double upperBound  = UpperBound.GetWrapped(x, y, wrap);
            double edgeFalloff = EdgeFalloff.GetWrapped(x, y, wrap);

            if (edgeFalloff > 0.0)
            {
                if (controlValue < (lowerBound - edgeFalloff))
                {
                    // The output value from the control module is below the selector
                    // threshold; return the output value from the first source module.
                    return(SourceModule1.GetWrapped(x, y, wrap));
                }
                else if (controlValue < (lowerBound + edgeFalloff))
                {
                    // The output value from the control module is near the lower end of the
                    // selector threshold and within the smooth curve. Interpolate between
                    // the output values from the first and second source modules.
                    double lowerCurve = (lowerBound - edgeFalloff);
                    double upperCurve = (lowerBound + edgeFalloff);
                    alpha = Loonim.Math.SCurve3((controlValue - lowerCurve) / (upperCurve - lowerCurve));
                    return(Loonim.Math.LinearInterpolate(SourceModule1.GetWrapped(x, y, wrap),
                                                         SourceModule2.GetWrapped(x, y, wrap), alpha));
                }
                else if (controlValue < (upperBound - edgeFalloff))
                {
                    // The output value from the control module is within the selector
                    // threshold; return the output value from the second source module.
                    return(SourceModule2.GetWrapped(x, y, wrap));
                }
                else if (controlValue < (upperBound + edgeFalloff))
                {
                    // The output value from the control module is near the upper end of the
                    // selector threshold and within the smooth curve. Interpolate between
                    // the output values from the first and second source modules.
                    double lowerCurve = (upperBound - edgeFalloff);
                    double upperCurve = (upperBound + edgeFalloff);
                    alpha = Loonim.Math.SCurve3(
                        (controlValue - lowerCurve) / (upperCurve - lowerCurve));
                    return(Loonim.Math.LinearInterpolate(SourceModule2.GetWrapped(x, y, wrap),
                                                         SourceModule1.GetWrapped(x, y, wrap),
                                                         alpha));
                }
                else
                {
                    // Output value from the control module is above the selector threshold;
                    // return the output value from the first source module.
                    return(SourceModule1.GetWrapped(x, y, wrap));
                }
            }
            else
            {
                if (controlValue < lowerBound || controlValue > upperBound)
                {
                    return(SourceModule1.GetWrapped(x, y, wrap));
                }
                else
                {
                    return(SourceModule2.GetWrapped(x, y, wrap));
                }
            }
        }