using System.Diagnostics;
namespace LibNoise.Operator
{
///
/// Provides a noise module that outputs the sum of the two output values from two
/// source modules. [OPERATOR]
///
public class Add : ModuleBase
{
#region Constructors
///
/// Initializes a new instance of Add.
///
public Add()
: base(2)
{
}
///
/// Initializes a new instance of Add.
///
/// The left hand input module.
/// The right hand input module.
public Add(ModuleBase lhs, ModuleBase rhs)
: base(2)
{
Modules[0] = lhs;
Modules[1] = rhs;
}
#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);
Debug.Assert(Modules[1] != null);
return Modules[0].GetValue(x, y, z) + Modules[1].GetValue(x, y, z);
}
#endregion
}
}