omdl  v0.6.1
OpenSCAD Mechanical Design Library
Utilities

Miscellaneous mathematical utilities. More...

+ Collaboration diagram for Utilities:

Files

file  math_utility.scad
 Miscellaneous mathematical utilities.
 

Functions

function hist (v, m=0, cs, cb, cp, ca, cf, d=false)
 Generate a histogram for the elements of a list of values. More...
 

Detailed Description

Miscellaneous mathematical utilities.

Function Documentation

function hist ( ,
= 0,
cs  ,
cb  ,
cp  ,
ca  ,
cf  ,
= false 
)

Generate a histogram for the elements of a list of values.

Parameters
v<data> A list of values.
m<integer> The output mode (a 5-bit encoded integer).
cs<string-list-4> A list of strings [s1, s2, s3, fs] (for custom field formatting).
Returns
<list|string> with the occurrence frequency of the elements of v.

The custom formatting strings are inserted in the output stream as follows:

  s1, value, s2, value-frequency, s3, fs

See lstr_html() for description of the html formatting parameters cb, cp, ca, cf, and d.

Output mode selection:

bit Description 0 1
0 output mode numerical string
1-3 string mode format see table see table
4 field separator mode not at end all

String output modes:

B3 B2 B1 B0 Description
1 0 0 0 1 list of strings
3 0 0 1 1 text format 1
9 1 0 0 1 html format 1
15 1 1 1 1 custom formating