omdl
v0.9.5
OpenSCAD Mechanical Design Library
|
Miscellaneous mathematical utilities. More...
Files | |
file | utility.scad |
Miscellaneous mathematical utilities. | |
Functions | |
function | get_fn (r) |
Return facets number for the given arc radius. More... | |
function | histogram (v, m=0, cs, cb, cp, ca, cf, d=false) |
Generate a histogram for the elements of a list of values. More... | |
Miscellaneous mathematical utilities.
Requires: |
---|
include <omdl-base.scad>; |
function get_fn | ( | r | ) |
Return facets number for the given arc radius.
r | <decimal> The arc radius. |
This function approximates the get_fragments_from_r()
code that is used by OpenSCAD to calculates the number of fragments in a circle or arc. The arc facets are controlled by the special variables $fa
, $fs
, and $fn
.
function histogram | ( | v | , |
m | = 0 , |
||
cs | , | ||
cb | , | ||
cp | , | ||
ca | , | ||
cf | , | ||
d | = false |
||
) |
Generate a histogram for the elements of a list of values.
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). |
v
.The custom formatting strings are inserted in the output stream as follows:
s1, value, s2, value-frequency, s3, fs
See strl_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 |