diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-08-08 17:33:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 17:33:09 +0200 |
| commit | daa35d6745d3f1519aab69c3e42ec269ebb5e108 (patch) | |
| tree | de1ebc9cb5fdc25405101b7089d17cf0a02a594a | |
| parent | 752dd83428a0952a490a7f759f96e4daad8b67be (diff) | |
| download | perlweeklychallenge-club-daa35d6745d3f1519aab69c3e42ec269ebb5e108.tar.gz perlweeklychallenge-club-daa35d6745d3f1519aab69c3e42ec269ebb5e108.tar.bz2 perlweeklychallenge-club-daa35d6745d3f1519aab69c3e42ec269ebb5e108.zip | |
Create 333_p1.lua
| -rw-r--r-- | challenge-333/hvukman/lua/333_p1.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-333/hvukman/lua/333_p1.lua b/challenge-333/hvukman/lua/333_p1.lua new file mode 100644 index 0000000000..af59673a14 --- /dev/null +++ b/challenge-333/hvukman/lua/333_p1.lua @@ -0,0 +1,18 @@ + +function Straight(x) + local dummy = true + -- calculated the determinant + -- https://de.wikipedia.org/wiki/Kollinearität#Analytische_Geometrie + local det = x[1][1]*x[2][2] + x[2][1]*x[3][2]+ + x[3][1]*x[1][2] - x[1][1]*x[3][2] - x[2][1]*x[1][2] + - x[3][1]*x[2][2] + print( det == 0) + + +end + +Straight({ {2,1},{2,3},{2,5},{2,3}}) +Straight({ {1,4},{3,4},{10,4}}) +Straight({ {0,0},{1,1},{2,3}}) +Straight({ {1,1},{1,1},{1,1}} ) +Straight({ {1000000, 1000000} , {2000000, 2000000}, {3000000, 3000000}}) |
