NumberMap

References
public sealed class NumberMap
Represents an immutable rectangular grid of number values. Ie. a bitmap with double precision numbers instead of colours.

Constructors

NumberMap

#
Create a new map.
public NumberMap(
double[][]
map,
Float map. Ie. an array of equal length number columns.
copy
If true, the map will be duplicated in memory. If there is a chance of this data being unexpectedly modified by some code, you must set copy=true. If there's any doubt in your mind whatsoever, use copy=true.
)

NumberMap

#
Create a new constant map.
public NumberMap(
width,
Width of map.
height,
Height of map.
constant
Constant value.
)

Properties

Constant

#
Gets the constant value of this map. If IsConstant is not true, this value is meaningless.
public double Constant { get; }

Count

#
Gets the total number of entries in this map.
public long Count { get; }

Height

#
Gets the height of the map. If the Height equals zero, it implied this map only contains a single value.
public int Height { get; }

InfinityCount

#
Gets the number of infinite values in this map.
public long InfinityCount { get; }

IsConstant

#
Gets whether this map contains only a single value.
public bool IsConstant { get; }

Maximum

#
Gets the highest value in this map. NaNs are ignored in this test.
public double Maximum { get; }

Minimum

#
Gets the lowest value in this map. NaNs are ignored in this test.
public double Minimum { get; }

NanCount

#
Gets the number of nan values in this map.
public long NanCount { get; }

NegativeInfinityCount

#
Gets the number of negative infinite values in this map.
public long NegativeInfinityCount { get; }

PositiveInfinityCount

#
Gets the number of positive infinite values in this map.
public long PositiveInfinityCount { get; }

Width

#
Gets the width of the map. If the Width equals zero, it implied this map only contains a single value.
public int Width { get; }

Indexers

this[]

#
Gets the number at the given (x,y) coordinate. If the map is constant this indexer will throw.
public double this[
x,
X index.
y
Y index.
] { get; }
Value at (x,y).

Methods

Abs

#
Convert all values in this map to their absolute.
public NumberMap Abs()
Absolute map.

AddNoise

#
Use a random engine to add noise to this map.
public NumberMap AddNoise(
engine,
Random engine.
minimum,
Least amount of noise to add.
maximum
Most amount of noise to add.
)
Map with noise.

AddPerlinNoise

#
Add perlin noise to this map.
public NumberMap AddPerlinNoise(
dx,
X offset.
dy,
Y offset.
minimum,
Least amount of noise to add.
maximum,
Most amount of noise to add.
waveLength
Wavelength of average perlin wave.
)
Map with perlin noise.

AddPerlinNoise

#
Add perlin noise to this map.
public NumberMap AddPerlinNoise(
dx,
X offset.
dy,
Y offset.
minimum,
Least amount of noise to add.
maximum,
Most amount of noise to add.
waveLength
Wavelength of average perlin wave.
)
Map with perlin noise.

AddPerlinNoise

#
Add perlin noise to this map.
public NumberMap AddPerlinNoise(
dx,
X offset.
dy,
Y offset.
minimum,
Least amount of noise to add.
maximum,
Most amount of noise to add.
waveLength
Wavelength of average perlin wave.
)
Map with perlin noise.

AllEqualTo

#
Test whether all values are equal to a given value.
public bool AllEqualTo(
value
Equality value.
)
True if all values are equal to value.

AllEqualTo

#
Test whether all values are equal.
public bool AllEqualTo(
out double
value
If this method returns true, the constant value will be returned here.
)
True if all values are equal to value.

Blend

#
Overlay two maps.
public NumberMap Blend(
layer,
Top layer.
blend,
Blend type.
strength
Strength of blending.
)
Combined result.

Blend

#
Overlay two maps.
public NumberMap Blend(
layer,
Top layer.
blend,
Blend type.
strength
Strength of blending.
)
Combined result.

Blur

#
Blur this map.
public NumberMap Blur(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred map.

Blur

#
Blur this map.
public NumberMap Blur(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred map.

BlurHorizontal

#
Blur this map horizontally.
public NumberMap BlurHorizontal(
horizontal,
Horizontal tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred map.

BlurHorizontal

#
Blur this map horizontally.
public NumberMap BlurHorizontal(
horizontal,
Horizontal tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred map.

BlurVertical

#
Blur this map vertically.
public NumberMap BlurVertical(
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred map.

BlurVertical

#
Blur this map vertically.
public NumberMap BlurVertical(
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred map.

Clip

#
Clip all values in this map to a numeric domain.
public NumberMap Clip(
min,
Lower limit.
max
Upper limit.
)
Clipped map.

Clip

#
Clip all values in this map to a numeric domain.
public NumberMap Clip(
min,
Lower limit.
max
Upper limit.
)
Clipped map.

Convolve

#
Apply a convolution kernel to this map.
public NumberMap Convolve(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
kernel,
Convolution kernel.
token = default(CancellationToken)
Cancellation token.
)
Convolved map.

CreateFromDelegate

#
Populate a number map using a shader delegate.
public static NumberMap CreateFromDelegate(
width,
Width of map to create.
height,
Height of map to create.
shader
Shader delegate.
)
Instantiated number map.

CreateFromShapes

#
Populate a number map using the elevation data of various shapes.
public static NumberMap CreateFromShapes(
width,
Width of numbermap.
height,
Height of numbermap.
backgroundElevation,
Value of background elevation.
shapes
Collection of shapes in numbermap space.
)
Float depth map.

CreateMoveX

#
Create a transformation map for motion along the x-axis.
public static NumberMap CreateMoveX(
width,
Width of map.
height,
Height of map.
dx
Amount of motion.
)
Motion map.

CreateMoveY

#
Create a transformation map for motion along the y-axis.
public static NumberMap CreateMoveY(
width,
Width of map.
height,
Height of map.
dy
Amount of motion.
)
Motion map.

CreateRotateX

#
Create a transformation map for rotating around an origin.
public static NumberMap CreateRotateX(
width,
Width of map.
height,
Height of map.
originX,
X origin of rotation.
originY,
Y origin of rotation.
angle
Rotational angle (counter-clockwise, in radians).
)
Rotation map for the x-axis.

CreateRotateY

#
Create a transformation map for rotating around an origin.
public static NumberMap CreateRotateY(
width,
Width of map.
height,
Height of map.
originX,
X origin of rotation.
originY,
Y origin of rotation.
angle
Rotational angle (counter-clockwise, in radians).
)
Rotation map for the x-axis.

CreateSampler

#
Create a sampler object for this map.
public IMapSampler CreateSampler(
horizontal,
vertical
)
Sampler.

CreateScaleX

#
Create a transformation map for scaling along the x-axis.
public static NumberMap CreateScaleX(
width,
Width of map.
height,
Height of map.
origin,
Scaling origin.
factor
Scaling factor.
)
Scaling map.

CreateScaleY

#
Create a transformation map for scaling along the y-axis.
public static NumberMap CreateScaleY(
width,
Width of map.
height,
Height of map.
origin,
Scaling origin.
factor
Scaling factor.
)
Scaling map.

DownSample

#
Downsample this map.
public NumberMap DownSample(
blockSize,
Number of rows and columns per downsampled block.
token = default(CancellationToken)
Cancellation token.
)
Downsampled map.

DownSample

#
Downsample this map.
public NumberMap DownSample(
blockWidth,
Number of columns per downsampled block.
blockHeight,
Number of rows per downsampled block.
token = default(CancellationToken)
Cancellation token.
)

Flip

#
Flip this map along the diagonal.
public NumberMap Flip()
Flipped map.

Fragment

#
Fragment the map.
public NumberMap Fragment(
IEnumerable<PointF>
seeds
Fragment seeds.
)
Fragmented map.

Fragment

#
Fragment the map.
public NumberMap Fragment(
SpatialTree<PointF>
seeds
Fragment seeds.
)
Fragmented map.

Log

#
Compute the base-e logarithm of this map.
public NumberMap Log()
Logarithmic map.

Log

#
Compute the base-x logarithm of this map.
public NumberMap Log(
base
Logarithm base.
)
Logarithmic map.

Log10

#
Compute the base-10 logarithm of this map.
public NumberMap Log10()
Logarithmic map.

Max

#
Maximize all values in this map with respect to a limit.
public NumberMap Max(
value
Value to maximize against.
)
Maximum map.

Max

#
Maximize all values in this map with respect to a limit map.
public NumberMap Max(
other
Map to maximize against.
)
Maximum map.

Median

#
Apply a rectangular median filter to this map.
public NumberMap Median(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
geometry,
Type of mask to use, only Square and Circle are supported by the current implementation.
radius,
Constant radius of median filter geometry.
token = default(CancellationToken)
Cancellation token.
)
Map with median values.

Median

#
Apply a rectangular median filter to this map.
public NumberMap Median(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
geometry,
Type of mask to use, only Square and Circle are supported by the current implementation.
radius,
Variable radius map. The values in the map are rounded to integers.
token = default(CancellationToken)
Cancellation token.
)
Map with median values.

Min

#
Minimize all values in this map with respect to a limit.
public NumberMap Min(
value
Value to minimize against.
)
Minimum map.

Min

#
Minimize all values in this map with respect to a limit map.
public NumberMap Min(
other
Map to minimize against.
)
Minimum map.

MirrorHorizontal

#
Mirror this map horizontally.
public NumberMap MirrorHorizontal()
Mirrored map.

MirrorVertical

#
Mirror this map vertically.
public NumberMap MirrorVertical()
Mirrored map.

Modify

#
Apply a custom modifier to a map.
public NumberMap Modify(
modifier,
Custom modifier delegate. First argument is the map value, second argument is the control value.
controlMap
Control map.
)
Modified map.

Modify

#
Apply a custom modifier to a map.
public NumberMap Modify(
modifier
Custom modifier delegate.
)
Modified map.

Normalise

#
Normalise this map to the (0~1) domain. If the map contains infinite values, all negative infinities will become 0.0, all positive infinities will become 1.0 and every finite value will become 0.5.
public NumberMap Normalise()
Normalised map.

Normalise

#
Normalise this map to a custom domain. If the map contains infinite values, all negative infinities will become 'min', all positive infinities will become 'max' and every finite value will become the average of 'min' and 'max'.
public NumberMap Normalise(
min,
Custom domain start.
max
Custom domain end.
)
Normalised map.

Pixelate

#
Pixelate this map.
public NumberMap Pixelate(
size
Size of pixels.
)
Pixelated map.

Pixelate

#
Pixelate this map.
public NumberMap Pixelate(
width,
Width of pixels.
height
Height of pixels.
)
Pixelated map.

Posterise

#
Pull all values in this map to a collection of key values.
public NumberMap Posterise(
table
Key values to tabulate against.
)
Tabulated map.

Posterise

#
Pull all values in this map to a collection of key values.
public NumberMap Posterise(
params double[]
table
Key values to tabulate against.
)
Tabulated map.

Pow

#
Raise this map to a power.
public NumberMap Pow(
exponent
Exponent.
)
Exponentiated map.

Pow

#
Raise this map to a power.
public NumberMap Pow(
exponent
Exponent.
)
Exponentiated map.

Resize

#
Perform a resizing operation on this map.
public NumberMap Resize(
width,
New width.
height,
New height.
scheme,
Interpolation scheme.
token = default(CancellationToken)
Cancellation token.
)

Round

#
Round all the values in this map.
public NumberMap Round(
decimals
Number of decimals. Must be in the (0~16) range.
)
Rounded map.

ShiftHorizontal

#
Shift all columns in this map.
public NumberMap ShiftHorizontal(
amount
Amount to shift rightwards. Negative amounts offset leftwards.
)
Shifted map.

ShiftVertical

#
Shift all rows in this map.
public NumberMap ShiftVertical(
amount
Amount to shift downwards. Negative amounts offset upwards.
)
Shifted map.

Sobel

#
Apply a sobel operator to this map.
public NumberMap Sobel(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
operator,
Operator to apply.
token = default(CancellationToken)
Cancellation token.
)
Modified number map.

Split

#
Split this map into portions larger than and smaller than some threshold.
public NumberMap Split(
threshold,
Threshold value.
lessThan,
Value to assign to samples smaller than threshold.
equalTo,
Value to assign to samples equal to threshold.
largerThan
Value to assign to samples larger than threshold.
)
Split map.

SubMap

#
Copy a portion of this map into a new map.
public NumberMap SubMap(
x0,
Inclusive index of first column to include in duplicate.
x1,
Exclusive index of last column to include in duplicate.
y0,
Inclusive index of first row to include in duplicate.
y1
Exclusive index of last row to include in duplicate.
)
Float map portion.

ToBitmap

#
Create a bitmap out of this number map.
public Bitmap ToBitmap(
gradient,
Gradient to use for mapping numbers to colours.
PixelFormat
format
Pixel format to use.
)
Bitmap.

ToBitmap

#
Create a bitmap out of this number map.
public Bitmap ToBitmap(
gradient
)
Bitmap.

ToColourMap

#
Create a colour map out of this number map.
public ColourMap ToColourMap(
gradient
Gradient for number->colour conversion.
)
Colour map.

ToNormalMap

#
Create an RGB normal map from this numbermap.
public void ToNormalMap(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
factor,
Vertical scaling factor.
red,
Red component of normal map will be outputted here.
green,
Green component of normal map be outputted here.
blue,
Blue component of normal map will be outputted here.
token = default(CancellationToken)
Cancellation token.
)

Transform

#
Transform this map.
public NumberMap Transform(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
interpolation,
Interpolation.
Transform
matrix
Transformation matrix. The kernel encodes how samples (treated as integer [x,y] points) are moved. This matrix needs to be inversible.
)
Transformed map.

Operators

OperationResultDescription
double+NumberMapNumberMapAdd a value to this number map.
NumberMap+NumberMapNumberMapAdd two maps together.
NumberMap+ConvolutionKernelNumberMapApply a convolution kernel to a number map using Clip tiling. Use the Convolve() method if you want control over the tiling.
NumberMap+doubleNumberMapAdd a value to this number map.
double/NumberMapNumberMapDivide a value by the entire map.
NumberMap/NumberMapNumberMapDivide one map by another.
NumberMap/doubleNumberMapDivide this map by a value.
double*NumberMapNumberMapMultiply this map by a factor.
NumberMap*NumberMapNumberMapMultiply two maps together.
NumberMap*doubleNumberMapMultiply this map by a factor.
double-NumberMapNumberMapSubtract the entire map from a value.
NumberMap-NumberMapNumberMapSubtract one map from another.
NumberMap-doubleNumberMapSubtract a value from this number map.
-NumberMapNumberMapInversion operator.
+NumberMapNumberMapIdentity operator.