diff options
author | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-01-02 20:49:51 +0100 |
---|---|---|
committer | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-01-02 20:49:51 +0100 |
commit | 3818aa044af80968e55d5d6638583a236e39294e (patch) | |
tree | e07a705ffe81308ff3d98badfd4627d398bd4e16 /aoc-2022-dotnet/Common | |
parent | 806ca36af8773c71c6f4d2ac77fc35ac0aa3b5a0 (diff) | |
download | gleam_aoc2020-3818aa044af80968e55d5d6638583a236e39294e.tar.gz gleam_aoc2020-3818aa044af80968e55d5d6638583a236e39294e.zip |
Finish last exercise from 2022
Diffstat (limited to 'aoc-2022-dotnet/Common')
-rw-r--r-- | aoc-2022-dotnet/Common/Vec2.fs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/aoc-2022-dotnet/Common/Vec2.fs b/aoc-2022-dotnet/Common/Vec2.fs index 8183083..24af9bb 100644 --- a/aoc-2022-dotnet/Common/Vec2.fs +++ b/aoc-2022-dotnet/Common/Vec2.fs @@ -73,6 +73,10 @@ type Vec2 = static member inline cross (Vec2 (x1, y1)) (Vec2 (x2, y2)) = x1 * y2 - y1 * x2 static member inline sign = Vec2._map sign static member inline lengthSquared v = Vec2.dot v v + static member inline rotateLeft(Vec2 (x, y)) = Vec2(-y, x) + static member inline rotateRight(Vec2 (x, y)) = Vec2(y, -x) + static member inline flip = Vec2.op_UnaryNegation + static member manhattanDist (Vec2 (x1, y1)) (Vec2 (x2, y2)) = abs (x2 - x1) + abs (y2 - y1) static member chebyshevDist (Vec2 (x1, y1)) (Vec2 (x2, y2)) = max (abs <| x2 - x1) (abs <| y2 - y1) |