NumberMap
ReferencesRepresents 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.
Properties
Height
#Gets the height of the map. If the Height equals zero, it implied this map only contains a single value.
Indexers
Methods
AllEqualTo
#Test whether all values are equal to a given value.
Returns: True if all values are equal to value.
Blur
#Blur this map.
public NumberMap Blur()
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
Cancellation token.
Returns: Blurred map.
Blur
#Blur this map.
public NumberMap Blur()
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
Cancellation token.
Returns: Blurred map.
BlurHorizontal
#Blur this map horizontally.
public NumberMap BlurHorizontal()
horizontal,
Horizontal tiling.
profile,
Blur profile.
radius,
Blur radius.
Cancellation token.
Returns: Blurred map.
BlurHorizontal
#Blur this map horizontally.
public NumberMap BlurHorizontal()
horizontal,
Horizontal tiling.
profile,
Blur profile.
radius,
Blur radius.
Cancellation token.
Returns: Blurred map.
BlurVertical
#Blur this map vertically.
public NumberMap BlurVertical()
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
Cancellation token.
Returns: Blurred map.
BlurVertical
#Blur this map vertically.
public NumberMap BlurVertical()
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
Cancellation token.
Returns: Blurred map.
Convolve
#Apply a convolution kernel to this map.
public NumberMap Convolve()
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
kernel,
Convolution kernel.
Cancellation token.
Returns: 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.
Returns: 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.
Returns: Float depth map.
CreateRotateX
#Create a transformation map for rotating around an origin.
Returns: Rotation map for the x-axis.
CreateRotateY
#Create a transformation map for rotating around an origin.
Returns: Rotation map for the x-axis.
DownSample
#Downsample this map.
public NumberMap DownSample()
blockSize,
Number of rows and columns per downsampled block.
Cancellation token.
Returns: Downsampled map.
DownSample
#Downsample this map.
public NumberMap DownSample()
blockWidth,
Number of columns per downsampled block.
blockHeight,
Number of rows per downsampled block.
Cancellation token.
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.
Cancellation token.
Returns: 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.
Cancellation token.
Returns: Map with median values.
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.
Returns: 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'.
Returns: Normalised map.
Resize
#Perform a resizing operation on this map.
public NumberMap Resize()
width,
New width.
height,
New height.
scheme,
Interpolation scheme.
Cancellation token.
Sobel
#Apply a sobel operator to this map.
public NumberMap Sobel()
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
operator,
Operator to apply.
Cancellation token.
Returns: Modified number map.
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.
Returns: Bitmap.
ToNormalMap
#Create an RGB normal map from this numbermap.
public void ToNormalMap()
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
factor,
Vertical scaling factor.
out NumberMap
red,
Red component of normal map will be outputted here.
out NumberMap
green,
Green component of normal map be outputted here.
out NumberMap
blue,
Blue component of normal map will be outputted here.
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.
Returns: Transformed map.
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| double | + | NumberMap | NumberMap | Add a value to this number map. |
| NumberMap | + | NumberMap | NumberMap | Add two maps together. |
| NumberMap | + | ConvolutionKernel | NumberMap | Apply a convolution kernel to a number map using Clip tiling. Use the Convolve() method if you want control over the tiling. |
| NumberMap | + | double | NumberMap | Add a value to this number map. |
| double | / | NumberMap | NumberMap | Divide a value by the entire map. |
| NumberMap | / | NumberMap | NumberMap | Divide one map by another. |
| NumberMap | / | double | NumberMap | Divide this map by a value. |
| double | * | NumberMap | NumberMap | Multiply this map by a factor. |
| NumberMap | * | NumberMap | NumberMap | Multiply two maps together. |
| NumberMap | * | double | NumberMap | Multiply this map by a factor. |
| double | - | NumberMap | NumberMap | Subtract the entire map from a value. |
| NumberMap | - | NumberMap | NumberMap | Subtract one map from another. |
| NumberMap | - | double | NumberMap | Subtract a value from this number map. |
| - | NumberMap | NumberMap | Inversion operator. | |
| + | NumberMap | NumberMap | Identity operator. | |