summaryrefslogtreecommitdiff
path: root/web/src/math
diff options
context:
space:
mode:
authorJosh Kingsley <josh@joshkingsley.me>2025-10-26 21:50:23 +0200
committerJosh Kingsley <josh@joshkingsley.me>2025-10-26 21:50:23 +0200
commited566a3f657e8256df9aabd107c199e6971a8f96 (patch)
tree4cabda5caf337cf787f0049d28dfa6a33a88fa3f /web/src/math
parent5e56338bb3e9bb1bcf1ef1c1fe6afb9c7391d976 (diff)
feat(web): subdivide cells
Diffstat (limited to 'web/src/math')
-rw-r--r--web/src/math/Ratio.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/src/math/Ratio.ts b/web/src/math/Ratio.ts
index d8e1149..0cca966 100644
--- a/web/src/math/Ratio.ts
+++ b/web/src/math/Ratio.ts
@@ -50,6 +50,13 @@ export default class Ratio {
);
}
+ subtract(other: Ratio): Ratio {
+ return new Ratio(
+ this.numerator * other.denominator - other.numerator * this.denominator,
+ this.denominator * other.denominator,
+ );
+ }
+
compare(other: Ratio): number {
const left = this.numerator * other.denominator;
const right = other.numerator * this.denominator;