omdl
v0.6.1
OpenSCAD Mechanical Design Library
|
Arch rendering resolution management. More...
Files | |
file | units_resolution.scad |
An abstraction for arc rendering resolution control. | |
Functions | |
function | resolution_fn (r) |
Return facets number for the given arc radius. More... | |
function | resolution_fs () |
Return minimum facets size. More... | |
function | resolution_fa (r) |
Return the minimum facets angle. More... | |
function | resolution_reduced () |
Return the radius at which arc resolution will begin to degrade. More... | |
module | resolution_info (r) |
Output resolution information to the console for given radius. More... | |
function | resolution_facets (r) |
Return facet count used to render a radius. More... | |
function | resolution_facetsv (r) |
Return facet count information list used to render a radius. More... | |
Variables | |
$resolution_mode = "fast" | |
<string> Global special variable that configures the arc resolution mode. | |
$resolution_value = 0 | |
<number> Global special variable for modes that use custom resolutions. | |
Arch rendering resolution management.
Functions, global variables, and configuration presets to provide a common mechanism for managing arc rendering resolution. Specifically, the number of fragments/facets with which arcs (circles, spheres, and cylinders, etc.) are rendered in OpenSCAD.
Example
Result (base_unit_length = mm):
Result (base_unit_length = cm):
Result (base_unit_length = mil):
Result (base_unit_length = in):
function resolution_fa | ( | r | ) |
Return the minimum facets angle.
r | <decimal> The arc radius. |
The result of this function can be assigned to the special variables $fa
to render arcs.
function resolution_facets | ( | r | ) |
Return facet count used to render a radius.
r | <decimal> The arc radius. |
$fn
, $fa
, and $fs
. function resolution_facetsv | ( | r | ) |
Return facet count information list used to render a radius.
r | <decimal> The arc radius. |
Where facets
is the number of fragments/facets that will be used to render the radius
given the current values for $fn
, $fa
, and $fs
. limiter
identifies the special variable that currently limits the facets, and value
is the current value assigned to the limiter.
function resolution_fn | ( | r | ) |
Return facets number for the given arc radius.
r | <decimal> The arc radius. |
The result of this function can be assigned to the special variables $fn
to render arcs according to the resolution mode set by $resolution_mode and $resolution_value.
The following table shows the modes that require $resolution_value to be set prior to specifying the custom values used during resolution calculation.
$resolution_mode | $resolution_value sets | radius dependent |
---|---|---|
set | fixed value | no |
upf | units per facet | yes |
fpu | facets per unit | yes |
fpi | facets per inch | yes |
The following table has common resolution presets. Equivalent configuration can be obtained using $resolution_mode and $resolution_value as described in the preview table.
$resolution_mode | preset description | radius dependent |
---|---|---|
fast | fast rendering mode | no |
low | low resolution | yes |
medium | medium resolution | yes |
high | high resolution | yes |
50um | 50 micron per facets | yes |
100um | 100 micron per facets | yes |
200um | 200 micron per facets | yes |
300um | 300 micron per facets | yes |
400um | 400 micron per facets | yes |
500um | 500 micron per facets | yes |
50mil | 50 thousandth per facets | yes |
100mil | 100 thousandth per facets | yes |
200mil | 200 thousandth per facets | yes |
300mil | 300 thousandth per facets | yes |
400mil | 400 thousandth per facets | yes |
500mil | 500 thousandth per facets | yes |
function resolution_fs | ( | ) |
Return minimum facets size.
The result of this function can be assigned to the special variables $fs
to render arcs according to the resolution mode set by $resolution_mode and $resolution_value.
The following table shows the modes that require $resolution_value to be set prior to calling this function in order to specify the custom values used during resolution calculation.
$resolution_mode | $resolution_value sets | radius dependent |
---|---|---|
set | fixed value | no |
upf | units per facet | no |
fpu | facets per unit | no |
fpi | facets per inch | no |
The following table has common resolution presets. Equivalent configuration can be obtained using $resolution_mode and $resolution_value as described in the preview table.
$resolution_mode | preset description | radius dependent |
---|---|---|
fast | fast rendering mode | no |
low | low resolution | no |
medium | medium resolution | no |
high | high resolution | no |
50um | 50 micron per facets | no |
100um | 100 micron per facets | no |
200um | 200 micron per facets | no |
300um | 300 micron per facets | no |
400um | 400 micron per facets | no |
500um | 500 micron per facets | no |
50mil | 50 thousandth per facets | no |
100mil | 100 thousandth per facets | no |
200mil | 200 thousandth per facets | no |
300mil | 300 thousandth per facets | no |
400mil | 400 thousandth per facets | no |
500mil | 500 thousandth per facets | no |
module resolution_info | ( | r | ) |
Output resolution information to the console for given radius.
r | <decimal> The arc radius. |
Definition at line 322 of file units_resolution.scad.
function resolution_reduced | ( | ) |
Return the radius at which arc resolution will begin to degrade.
The special variables $fs
and $fa
work together when $fn
= 0. For a given $fs
, the fragment angle of a drawn arc gets smaller with increasing radius. In other words, the fragment angle is inversely proportional to the arc radius for a given fragment size.
The special variable $fa
enforces a minimum fragment angle limit and at some radius, the fragment angle would becomes smaller than this limit. At this point, OpenSCAD limits further reduction in the facet angle which forces the use of increased fragment size. This in effect begins the gradual reduction of arc resolution with increasing radius.
The return result of this function indicates the radius at which this enforced limiting begins. When $fn
!= 0, returns undef.