Jump to content

Cistercian numerals: Difference between revisions

m (→‎{{header|FutureBasic}}: Merge all PathDraw1-9 functions into one)
Line 2,057:
 
{{FormulaeEntry|page=https://formulae.org/?script=examples/Cistercian_numerals}}
 
'''Solution'''
 
We can take advantage of the coordinate transformations.
 
'''Part 1. Glypths for each digit'''
 
The glyphs of each "digit" are the same, excepting they are mirrored according if they are in "units", "tens", "hundreds" and "thousands" place, so we have generic code for each.
 
The following specification are for "units" and it is independent of size. They are referred to the top-right "quadrant" of the complete number, which has mathematical coordinate system, being (-1, -1) the bottom-left corner, and (1, 1) the opposite one, hence, the center is (0, 0).
 
Please notice that they are provided as an array of (9) lambda expressions. There is no glyph for zero.
 
[[File:Fōrmulæ - Cistercian numerals 01.png]]
 
'''Part 2. Mirroring for "tens", "hundreds" and "thousands"'''
 
The following is the specification to change the scale, according to the place and to produce the mirrored effect. Notice that there is no specification for "units", because the definitions of glypths are based on "units" and therefore there is no transformation to apply.
 
[[File:Fōrmulæ - Cistercian numerals 02.png]]
 
'''Part 3. Function to draw a Cistercian number'''
 
Finally, the following function creates the representation of the Cistercian number.
 
Notice that the origin is initially translated to the center of the graphics, and also is scaled to the size of the graphics too, in order to define the system of coordinates.
 
[[File:Fōrmulæ - Cistercian numerals 03.png]]
 
'''Test cases'''
 
[[File:Fōrmulæ - Cistercian numerals 04.png]]
 
[[File:Fōrmulæ - Cistercian numerals 05.png]]
 
'''Additional case. Creating all the Cistercian numerals in a single image'''
 
The following program creates all the 10,000 different Cistercian numerals in a single image:
 
[[File:Fōrmulæ - Cistercian numerals 06.png]]
 
The result is a 4000 x 6010 pixels image. Click or tap on the following image to enlarge:
 
[[File:Fōrmulæ - Cistercian numerals 07.png|400px]]
 
=={{header|FutureBasic}}==
2,120

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.