C# Class LibNoise.NMath

Provides math operations not found in System.Math.
Show file Open project: MadoxLabs/NoiseTool

Public Properties

Property Type Description
DEG_TO_RAD double
PI double
RAD_TO_DEG double
Sqrt2 double
Sqrt3 double

Public Methods

Method Description
ClampValue ( double value, double lowerBound, double upperBound ) : double
ClampValue ( int value, int lowerBound, int upperBound ) : int

Returns the given value clamped between the given lower and upper bounds. - @a value if @a value lies between @a lowerBound and @a upperBound. - @a lowerBound if @a value is less than @a lowerBound. - @a upperBound if @a value is greater than @a upperBound.

CubicInterpolate ( double n0, double n1, double n2, double n3, double a ) : double

Returns the cubic interpolation of two values bound between two other values.

GetLarger ( double a, double b ) : double

Returns the larger of the two given numbers.

GetSmaller ( double a, double b ) : double

Returns the smaller of the two given numbers.

GradientCoherentNoise ( double x, double y, double z, int seed, NoiseQuality noiseQuality ) : double
GradientNoise ( double fx, double fy, double fz, int ix, int iy, int iz, long seed ) : double
IntValueNoise ( int x, int y, int z, int seed ) : int
LatLonToXYZ ( double lat, double lon, double &x, double &y, double &z ) : void

Provides the X, Y, and Z coordinates on the surface of a sphere cooresponding to the given latitude and longitude.

LinearInterpolate ( double n0, double n1, double a ) : double

Returns the linear interpolation of two values with the given alpha.

MakeInt32Range ( double n ) : double

Returns the given value, modified to be able to fit into a 32-bit integer.

SCurve3 ( double a ) : double

Returns the given value mapped onto a cubic S-curve. @a a should range from 0.0 to 1.0. The derivitive of a cubic S-curve is zero at @a a = 0.0 and @a a = 1.0

SCurve5 ( double a ) : double

Returns the given value mapped onto a quintic S-curve. @a a should range from 0.0 to 1.0. The first derivitive of a quintic S-curve is zero at @a a = 0.0 and @a a = 1.0 The second derivitive of a quintic S-curve is zero at @a a = 0.0 and @a a = 1.0

SwapValues ( double &a, double &b ) : void

Swaps the values contained by the two given variables.

ValueCoherentNoise ( double x, double y, double z, int seed, NoiseQuality noiseQuality ) : double
ValueNoise ( int x, int y, int z ) : double
ValueNoise ( int x, int y, int z, int seed ) : double

Method Details

ClampValue() public static method

public static ClampValue ( double value, double lowerBound, double upperBound ) : double
value double
lowerBound double
upperBound double
return double

ClampValue() public static method

Returns the given value clamped between the given lower and upper bounds. - @a value if @a value lies between @a lowerBound and @a upperBound. - @a lowerBound if @a value is less than @a lowerBound. - @a upperBound if @a value is greater than @a upperBound.
public static ClampValue ( int value, int lowerBound, int upperBound ) : int
value int
lowerBound int
upperBound int
return int

CubicInterpolate() public static method

Returns the cubic interpolation of two values bound between two other values.
public static CubicInterpolate ( double n0, double n1, double n2, double n3, double a ) : double
n0 double The value before the first value.
n1 double The first value.
n2 double The second value.
n3 double The value after the second value.
a double The alpha value.
return double

GetLarger() public static method

Returns the larger of the two given numbers.
public static GetLarger ( double a, double b ) : double
a double
b double
return double

GetSmaller() public static method

Returns the smaller of the two given numbers.
public static GetSmaller ( double a, double b ) : double
a double
b double
return double

GradientCoherentNoise() public static method

public static GradientCoherentNoise ( double x, double y, double z, int seed, NoiseQuality noiseQuality ) : double
x double
y double
z double
seed int
noiseQuality NoiseQuality
return double

GradientNoise() public static method

public static GradientNoise ( double fx, double fy, double fz, int ix, int iy, int iz, long seed ) : double
fx double
fy double
fz double
ix int
iy int
iz int
seed long
return double

IntValueNoise() public static method

public static IntValueNoise ( int x, int y, int z, int seed ) : int
x int
y int
z int
seed int
return int

LatLonToXYZ() public static method

Provides the X, Y, and Z coordinates on the surface of a sphere cooresponding to the given latitude and longitude.
public static LatLonToXYZ ( double lat, double lon, double &x, double &y, double &z ) : void
lat double
lon double
x double
y double
z double
return void

LinearInterpolate() public static method

Returns the linear interpolation of two values with the given alpha.
public static LinearInterpolate ( double n0, double n1, double a ) : double
n0 double
n1 double
a double
return double

MakeInt32Range() public static method

Returns the given value, modified to be able to fit into a 32-bit integer.
public static MakeInt32Range ( double n ) : double
n double
return double

SCurve3() public static method

Returns the given value mapped onto a cubic S-curve. @a a should range from 0.0 to 1.0. The derivitive of a cubic S-curve is zero at @a a = 0.0 and @a a = 1.0
public static SCurve3 ( double a ) : double
a double
return double

SCurve5() public static method

Returns the given value mapped onto a quintic S-curve. @a a should range from 0.0 to 1.0. The first derivitive of a quintic S-curve is zero at @a a = 0.0 and @a a = 1.0 The second derivitive of a quintic S-curve is zero at @a a = 0.0 and @a a = 1.0
public static SCurve5 ( double a ) : double
a double
return double

SwapValues() public static method

Swaps the values contained by the two given variables.
public static SwapValues ( double &a, double &b ) : void
a double
b double
return void

ValueCoherentNoise() public static method

public static ValueCoherentNoise ( double x, double y, double z, int seed, NoiseQuality noiseQuality ) : double
x double
y double
z double
seed int
noiseQuality NoiseQuality
return double

ValueNoise() public static method

public static ValueNoise ( int x, int y, int z ) : double
x int
y int
z int
return double

ValueNoise() public static method

public static ValueNoise ( int x, int y, int z, int seed ) : double
x int
y int
z int
seed int
return double

Property Details

DEG_TO_RAD public static property

public static double DEG_TO_RAD
return double

PI public static property

public static double PI
return double

RAD_TO_DEG public static property

public static double RAD_TO_DEG
return double

Sqrt2 public static property

public static double Sqrt2
return double

Sqrt3 public static property

public static double Sqrt3
return double