Added documentation
This commit is contained in:
1 parent
814d4f6fd0
commit
6bee186952
11 files changed
+287
-6
No files matched your search
@@ -6,7 +6,16 @@ using CubicNoise.Contracts;
|
||||
|
||||
namespace CubicNoise.Noisers
|
||||
{
|
||||
public sealed class CubicNoiseEngine : INoiseEngine
|
||||
/// <summary>
|
||||
/// This is the cubic noise engine by Job Talle, cf. https://jobtalle.com/cubic_noise.html. It based on the
|
||||
/// C# version which was provided at Github: https://github.com/jobtalle/CubicNoise/blob/master/c%23/CubicNoise.cs.
|
||||
///
|
||||
/// Thanks Job for your implementation.
|
||||
///
|
||||
/// Compared to Job's version, this implementation is a bit optimized and
|
||||
/// used useful C# 8.0 / .NET Core 3.1 LTS features.
|
||||
/// </summary>
|
||||
internal sealed class CubicNoiseEngine : INoiseEngine
|
||||
{
|
||||
private const int RANDOM_NUMBER_A = 134_775_813;
|
||||
private const int RANDOM_NUMBER_B = 1_103_515_245;
|
||||
@@ -16,7 +25,7 @@ namespace CubicNoise.Noisers
|
||||
private readonly int periodY;
|
||||
private readonly int seed;
|
||||
|
||||
public CubicNoiseEngine(int seed, IReadOnlyDictionary<IParameterName, int> intParameters)
|
||||
internal CubicNoiseEngine(int seed, IReadOnlyDictionary<IParameterName, int> intParameters)
|
||||
{
|
||||
this.seed = seed;
|
||||
this.octave = intParameters?.ContainsKey(CubicNoiseIntParameters.OCTAVE) == true ? intParameters[CubicNoiseIntParameters.OCTAVE] : 16;
|
||||
|
||||
@@ -5,10 +5,24 @@ using CubicNoise.Contracts;
|
||||
|
||||
namespace CubicNoise.Noisers
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains all known cubic noise's parameters.
|
||||
/// </summary>
|
||||
public class CubicNoiseIntParameters : IParameterName
|
||||
{
|
||||
/// <summary>
|
||||
/// Cubic noise's octave parameter.
|
||||
/// </summary>
|
||||
public static readonly IParameterName OCTAVE = new CubicNoiseIntParameters();
|
||||
|
||||
/// <summary>
|
||||
/// Cubic noise's period x parameter.
|
||||
/// </summary>
|
||||
public static readonly IParameterName PERIOD_X = new CubicNoiseIntParameters();
|
||||
|
||||
/// <summary>
|
||||
/// Cubic noise's period y parameter.
|
||||
/// </summary>
|
||||
public static readonly IParameterName PERIOD_Y = new CubicNoiseIntParameters();
|
||||
|
||||
private CubicNoiseIntParameters()
|
||||
|
||||
@@ -5,11 +5,16 @@ using CubicNoise.Contracts;
|
||||
|
||||
namespace CubicNoise.Noisers
|
||||
{
|
||||
public sealed class RandomNumberEngine : INoiseEngine
|
||||
/// <summary>
|
||||
/// This is the random number engine which gets used in case that the UNKNOWN type was used.
|
||||
/// This engine is not meant for production. It is a placeholder for empty values, where a type
|
||||
/// is needed. The engine will generate a random value each time.
|
||||
/// </summary>
|
||||
internal sealed class RandomNumberEngine : INoiseEngine
|
||||
{
|
||||
private Random rng;
|
||||
private readonly Random rng;
|
||||
|
||||
public RandomNumberEngine(int seed)
|
||||
internal RandomNumberEngine(int seed)
|
||||
{
|
||||
this.rng = new Random(seed);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user