Created
April 18, 2021 18:25
-
-
Save Amplifi-Beats/4fb3fa5b37888fde9616884540de5fc0 to your computer and use it in GitHub Desktop.
for Setanta programming language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>-- Triantán Sierpinski - le haghaidh Setanta --< | |
gníomh tarraing(ts){ | |
glan@stáitse() | |
le i idir (0, fad(ts)) { | |
t := ts[i] | |
cruthLán@stáitse([t[0], t[1], t[2]]) | |
} | |
} | |
gníomh céadCeannEile(ts){ | |
nua := [] | |
le i idir (0, fad(ts)) { | |
t := ts[i] | |
a := t[0] | |
b := t[1] | |
c := t[2] | |
ab := [b[0] + (a[0]-b[0])/2, b[1] + (a[1] - b[1])/2] | |
ac := [c[0] + (a[0]-c[0])/2, c[1] + (a[1] - c[1])/2] | |
bc := [b[0] + (c[0]-b[0])/2, b[1] + (c[1] - b[1])/2] | |
nua = nua + [[b, ab, bc], [a, ab, ac], [ac, bc, c]] | |
} | |
toradh nua | |
} | |
X := fadX@stáitse | |
Y := fadY@stáitse | |
mn := X | |
má Y < X | |
mn = Y | |
lthd := 9*mn/10 | |
ard := (lthd*fréamh@mata(3))/2 | |
>-- dx & dy, sin an aistriúchán go dtí an lár | |
dx := X/2 - lthd/2 | |
dy := Y/2 - ard/2 | |
a_tos := [lthd/2 + dx, 0 + dy] | |
b_tos := [0 + dx, ard + dy] | |
c_tos := [lthd + dx, ard + dy] | |
triantáin := [[a_tos, b_tos, c_tos]] | |
le i idir (0, 10) { | |
tarraing(triantáin) | |
triantáin = céadCeannEile(triantáin) | |
coladh(500) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment