﻿ MathCell - Utilities

# Basic Functions

lerp( a, b ) — linear interpolation between two-dimensional points returned as a function

linspace( a, b, number ) — equally spaced number of points from a to b inclusive

minMax( data, index ) — minimum and maximum values in a data array of points for the specified index returned as `{ min: min, max: max }`

# Rounding Functions

roundTo( x, n ) — round to n significant digits

roundTo( x, n, `false` ) — round to n decimal places

floorTo( x, n ) — floor to n significant digits

floorTo( x, n, `false` ) — floor to n decimal places

ceilTo( x, n ) — ceiling to n significant digits

ceilTo( x, n, `false` ) — ceiling to n decimal places

# Transformation Functions

normalize( vector ) — normalize a vector array

translate( points, vector ) — translate an array of points by a vector array

rotate( points, angle ) — rotate an array of points by an angle about the z-axis

rotate( points, angle, vector ) — rotate an array of points by an angle about an arbitrary axis

# Color Functions

colormap( name ) — predefined colormap returned as a function taking an argument in [0,1]

colormap( name, `true` ) — reversed predefined colormap returned as a function

colorToHexString( color ) — HTML hex string for a color `{ r: r, g: g, b: b }`

hueToColor( h ) — RGB color for a hue in [0,1] returned as `{ r: r, g: g, b: b }`