Divide a rectangle into a number of unequal triangles: Difference between revisions
Divide a rectangle into a number of unequal triangles (view source)
Revision as of 16:13, 27 January 2022
, 2 years ago→{{header|Raku}}: moving the goalposts: now use a descending sequence to tell the triangles apart
(→{{header|Raku}}: after all the blunders, init 6) |
(→{{header|Raku}}: moving the goalposts: now use a descending sequence to tell the triangles apart) |
||
Line 462:
=={{header|Raku}}==
The first triangle bisects the rectangle via the diagonal. The rest of them all got one vertex at the origin and a side defined by ratios of numbers from
<lang perl6># 20220123 Raku programming solution
# Proof :
#
# H---
# | |
# | |
Line 475:
# ▲OEL is unique as its area is the sum of the rest.
#
#
sub UnequalDivider (\L,\H,\N where N > 2) {
my \sum = ( my @sequence = (
my \part = $ = 0;
( [ (0,0), (L,H), (L,0) ], ).Array.append:
}
}
Line 492:
<pre>
[(0 0) (1000 500) (1000 0)]
[(0 0) (0 500) (
[(0 0) (
[(0 0) (
[(0 0) (
</pre>
|