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

rotateObject( object, angle, vector ) — rotate a graphics object by an angle about an arbitrary axis


Color Functions

color( r, g, b ) — RGB color returned as { r: r, g: g, b: b }

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

colorFromArg( x ) — RGB color from the argument of a complex number returned as { r: r, g: g, b: b }

colorStringFromHue( h ) — HTML color for a hue in [0,1]

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

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