Content


NTL
Core
CNoise

CNoise


This class provides method for generation different kinds of noise.

You can find more information in comments below.

class CNoise
{
public:
    enum class NoiseType
    {
        White,
        Value,
        ValueFractal,
        Perlin,
        PerlinFractal,
        Simplex,
        SimplexFractal,
        Cubic,
        CubicFractal,
        Cellular
    };

    enum class InterpolationType // Interpolation method used to smooth between noise values(lowest to highest quality). Used in Value, Perlin Noise and Position Warping 
    {
        Linear,
        Hermite,
        Quintic
    };

    enum class FractalType
    {
        FBM,
        Billow,
        RigidMulti
    };

    enum class CellularDistance
    {
        Euclidean,
        Manhattan,
        Natural
    };

    enum class CellularReturn
    {
        CellValue,
        Distance,
        Distance2,
        Distance2Add,
        Distance2Sub,
        Distance2Mul,
        Distance2Div,
        NoiseLookup
    };
public:
    CNoise(const int seed = 1337);

    int getSeed() const; // Return seed 
    int getOctaves() const; // Return octave count(for fractal noise) 
    double getFrequency() const; // Return frequency 
    double getLacunarity() const; // Return lacunarity 
    double getGain() const; // Return gain 
    NoiseType getNoiseType() const; // Return noise type 
    InterpolationType getInterpolationType() const; // Return interpolation type 
    FractalType getFractalType() const; // Return fractal type 
    CellularDistance getCellularDistance() const; // Return cellular distance type 
    CellularReturn getCellularReturn() const; // Return cellular return type 
    int getCellularDistanceIndex0() const; // Return cellular distance first index 
    int getCellularDistanceIndex1() const; // Return cellular distance second index 
    double getCellularJitter() const; // Return cellular jitter 
    double getGradientPerturbAmplitude() const; // Return gradient perturbation amplitude 
    CNoise *getCellularNoiseLookup(); // Return cellular lookup noise 

    bool setSeed(const int value); // Set seed 
    bool setOctaves(const int value); // Set octave count. >= 1 
    bool setFrequency(const double value); // Set frequency 
    bool setLacunarity(const double value); // Set lacunarity 
    bool setGain(const double value); // Set gain 
    bool setNoiseType(const NoiseType value); // Set noise type 
    bool setInterpolationType(const InterpolationType value); // Set interpolation type 
    bool setFractalType(const FractalType value); // Set fractal type 
    bool setCellularDistance(const CellularDistance value); // Set cellular distance type 
    bool setCellularReturn(const CellularReturn value); // Set cellular return type 
    bool setCellularDistanceIndex0(const int value); // Set cellular distance first index 
    bool setCellularDistanceIndex1(const int value); // Set cellular distance second index 
    bool setCellularJitter(const double value); // Set cellular jitter 
    bool setGradientPerturbAmplitude(const double value); // Set gradient perturbation amplitude 
    bool setCellularNoiseLookup(CNoise *value); // Set cellular lookup noise 

    // Calculate 2D/3D noise in specified position depending on current settings 
    double CalculateNoise(const double x, const double y) const;
    double CalculateNoise(const double x, const double y, const double z) const;

    // White noise calculation methods 
    double CalculateWhiteNoise(const double x, const double y) const;
    double CalculateWhiteNoiseInt(const int x, const int y) const;
    double CalculateWhiteNoise(const double x, const double y, const double z) const;
    double CalculateWhiteNoiseInt(const int x, const int y, const int z) const;
    double CalculateWhiteNoise(const double x, const double y, const double z, const double w) const;
    double CalculateWhiteNoiseInt(const int x, const int y, const int z, const int w) const;

    // Value noise calculation methods 
    double CalculateValue(const double x, const double y) const;
    double CalculateValueFractal(const double x, const double y) const;
    double CalculateValue(const double x, const double y, const double z) const;
    double CalculateValueFractal(const double x, const double y, const double z) const;

    // Perlin noise calculation methods 
    double CalculatePerlin(const double x, const double y) const;
    double CalculatePerlinFractal(const double x, const double y) const;
    double CalculatePerlin(const double x, const double y, const double z) const;
    double CalculatePerlinFractal(const double x, const double y, const double z) const;

    // Simplex noise calculation methods 
    double CalculateSimplex(const double x, const double y) const;
    double CalculateSimplexFractal(const double x, const double y) const;
    double CalculateSimplex(const double x, const double y, const double z) const;
    double CalculateSimplexFractal(const double x, const double y, const double z) const;
    double CalculateSimplex(const double x, const double y, const double z, const double w) const;

    // Cubic noise calculation methods 
    double CalculateCubic(const double x, const double y) const;
    double CalculateCubicFractal(const double x, const double y) const;
    double CalculateCubic(const double x, const double y, const double z) const;
    double CalculateCubicFractal(const double x, const double y, const double z) const;

    // Cellular noise calculation methods 
    double CalculateCellular(const double x, const double y) const;
    double CalculateCellular(const double x, const double y, const double z) const;

    // Gradient perturbation calculation methods 
    void GradientPerturb(double &x, double &y) const;
    void GradientPerturbFractal(double &x, double &y) const;
    void GradientPerturb(double &x, double &y, double &z) const;
    void GradientPerturbFractal(double &x, double &y, double &z) const;
};
Namespace: nitisa
Include: Nitisa/Math/Noise.h