From 8f5c1c1e2070337b2a13ebdeabc556be264e45dd Mon Sep 17 00:00:00 2001
From: Lumi Pakkanen
Date: Fri, 29 Sep 2023 20:26:25 +0300
Subject: [PATCH] Implement SVG tool for visualizing 23-limit JI lattices
Co-authored-by: diegovdc
---
src/App.vue | 1 +
src/components/ScaleLattice.vue | 342 ++++++++++++++++++++++++++++++++
src/router/index.ts | 5 +
src/utils.ts | 21 ++
src/views/AboutView.vue | 4 +-
src/views/LatticeView.vue | 40 ++++
6 files changed, 412 insertions(+), 1 deletion(-)
create mode 100644 src/components/ScaleLattice.vue
create mode 100644 src/views/LatticeView.vue
diff --git a/src/App.vue b/src/App.vue
index c441d41b..4ba32701 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -929,6 +929,7 @@ watch(degreeDownCode, (newValue) =>
Build Scale
Analysis
+ Lattice
Virtual Keyboard
Virtual QWERTY
diff --git a/src/components/ScaleLattice.vue b/src/components/ScaleLattice.vue
new file mode 100644
index 00000000..9f68c8cd
--- /dev/null
+++ b/src/components/ScaleLattice.vue
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/router/index.ts b/src/router/index.ts
index ce43c333..24a999d2 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -42,6 +42,11 @@ const router = createRouter({
name: "analysis",
component: () => import("../views/AnalysisView.vue"),
},
+ {
+ path: "/lattice",
+ name: "lattice",
+ component: () => import("../views/LatticeView.vue"),
+ },
{
path: "/midi",
name: "midi",
diff --git a/src/utils.ts b/src/utils.ts
index 9cfd7061..8d6e469c 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -238,3 +238,24 @@ export function computedAndError(
const error = computed(() => valueAndError.value[1]);
return [value, error];
}
+
+// Calculates euclidean distance for monzos, as it assumes that if points are not of the same dimension, then the missing dimensions have a value of zero.
+export function monzoEuclideanDistance(
+ equavePrimeIndex: number,
+ point1: number[],
+ point2: number[]
+): number {
+ // Ensure that both points have the same dimension
+ const maxDimension = Math.max(point1.length, point2.length);
+ // Pad the shorter point with zeroes to match the longer point's dimension
+ const point1_ = point1.concat(Array(maxDimension - point1.length).fill(0));
+ const point2_ = point2.concat(Array(maxDimension - point2.length).fill(0));
+
+ const distance = Math.hypot(
+ ...point1_.map((coord1, index) => {
+ return index === equavePrimeIndex ? 0 : point2_[index] - coord1;
+ })
+ );
+
+ return distance;
+}
diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue
index aedeea0e..9a79254b 100644
--- a/src/views/AboutView.vue
+++ b/src/views/AboutView.vue
@@ -37,7 +37,9 @@
Sevish - UI/UX designer
Vincenzo Sicurella - developer
Lajos Mészáros - developer
- Forrest Cahoon - developer
+ Forrest Cahoon - developer
+ Videco - developer
+ Kraig Grady - lattice advisor
diff --git a/src/views/LatticeView.vue b/src/views/LatticeView.vue
new file mode 100644
index 00000000..1e348080
--- /dev/null
+++ b/src/views/LatticeView.vue
@@ -0,0 +1,40 @@
+
+
+
+
+ Lattice visualization
+
+
+
+
+