-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunits.fth
35 lines (27 loc) · 1 KB
/
units.fth
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
\ Units of measure.
\ BoardForth's internal representation nominally uses millimeters, in
\ conformance with The Gerber File Format Specification. In order to represent
\ the 6 decimal places required by the spec in a fixed-point format, the actual
\ representation is in nanometers.
\
\ Inches are not supported, here or in the Gerber format:
\ "Inch is only there for historic reasons and is now a useless
\ embellishment. It will be revoked at some future date."
: NM ( n -- n , Convert a value in nanometers to internal representation )
\ noop
;
: UM ( n -- n , Convert a value in whole micrometers to internal representation )
1000 *
;
: MM ( n -- n , Convert a value in whole millimeters to internal representation )
UM 1000 *
;
: >NM ( n -- n , Convert a value in internal representation to nanometers )
\ noop
;
: >UM ( n -- n , Convert a value in internal representation to whole micrometers )
1000 /
;
: >MM ( n -- n , Convert a value in internal representation to whole millimeters )
UM 1000 /
;