using System; using System.Diagnostics; namespace LibNoise.Operator { /// /// Provides a noise module that outputs the absolute value of the output value from /// a source module. [OPERATOR] /// public class Abs : ModuleBase { #region Constructors /// /// Initializes a new instance of Abs. /// public Abs() : base(1) { } /// /// Initializes a new instance of Abs. /// /// The input module. public Abs(ModuleBase input) : base(1) { Modules[0] = input; } #endregion #region ModuleBase Members /// /// Returns the output value for the given input coordinates. /// /// The input coordinate on the x-axis. /// The input coordinate on the y-axis. /// The input coordinate on the z-axis. /// The resulting output value. public override double GetValue(double x, double y, double z) { Debug.Assert(Modules[0] != null); return Math.Abs(Modules[0].GetValue(x, y, z)); } #endregion } }