diff --git a/.forgejo/setup-trunk/action.yaml b/.forgejo/setup-trunk/action.yaml
index 6007527..85e8a31 100644
--- a/.forgejo/setup-trunk/action.yaml
+++ b/.forgejo/setup-trunk/action.yaml
@@ -10,7 +10,7 @@ runs:
using: "composite"
steps:
- run: rustup target add wasm32-unknown-unknown
-
+
# install the Trunk binary to `ci-bin` within the workspace directory, which
# is determined by the `github.workspace` label and reflected in the
# `GITHUB_WORKSPACE` environment variable. then, make the `trunk` command
diff --git a/.forgejo/workflows/continuous-integration.yaml b/.forgejo/workflows/continuous-integration.yaml
index f3b0130..6b53b3a 100644
--- a/.forgejo/workflows/continuous-integration.yaml
+++ b/.forgejo/workflows/continuous-integration.yaml
@@ -24,6 +24,6 @@ jobs:
# workspace directory (action variable `github.workspace`, environment
# variable `$GITHUB_WORKSPACE`):
- uses: https://code.forgejo.org/actions/checkout@v4
-
+
- uses: ./.forgejo/setup-trunk
- - run: RUSTFLAGS='-D warnings' cargo test
\ No newline at end of file
+ - run: RUSTFLAGS='-D warnings' cargo test
diff --git a/README.md b/README.md
index cf3e589..16b0d35 100644
--- a/README.md
+++ b/README.md
@@ -12,11 +12,11 @@ Note that currently this is just the barest beginnings of the project, more of a
### Implementation goals
-* Comfortable, intuitive UI
+* Provide a comfortable, intuitive UI
-* Able to run in browser (so implemented in WASM-compatible language)
+* Allow execution in browser (so implemented in WASM-compatible language)
-* Produce scalable graphics of 3D diagrams, and maybe STL files (or other fabricatable file format) as well.
+* Produce scalable graphics of 3D diagrams, and maybe STL files (or other fabricatable file format) as well
## Prototype
@@ -24,64 +24,66 @@ The latest prototype is in the folder `app-proto`. It includes both a user inter
### Install the prerequisites
-1. Install [`rustup`](https://rust-lang.github.io/rustup/): the officially recommended Rust toolchain manager
- - It's available on Ubuntu as a [Snap](https://snapcraft.io/rustup)
-2. Call `rustup default stable` to "download the latest stable release of Rust and set it as your default toolchain"
- - If you forget, the `rustup` [help system](https://github.com/rust-lang/rustup/blob/d9b3601c3feb2e88cf3f8ca4f7ab4fdad71441fd/src/errors.rs#L109-L112) will remind you
-3. Call `rustup target add wasm32-unknown-unknown` to add the [most generic 32-bit WebAssembly target](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-unknown-unknown.html)
-4. Call `cargo install wasm-pack` to install the [WebAssembly toolchain](https://rustwasm.github.io/docs/wasm-pack/)
-5. Call `cargo install trunk` to install the [Trunk](https://trunkrs.dev/) web-build tool
+1. Install [`rustup`](https://rust-lang.github.io/rustup/): the officially recommended Rust toolchain manager.
+ - It's available on Ubuntu as a [Snap](https://snapcraft.io/rustup).
+2. Call `rustup default stable` to "download the latest stable release of Rust and set it as your default toolchain".
+ - If you forget, the `rustup` [help system](https://github.com/rust-lang/rustup/blob/d9b3601c3feb2e88cf3f8ca4f7ab4fdad71441fd/src/errors.rs#L109-L112) will remind you.
+3. Call `rustup target add wasm32-unknown-unknown` to add the [most generic 32-bit WebAssembly target](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-unknown-unknown.html).
+4. Call `cargo install wasm-pack` to install the [WebAssembly toolchain](https://rustwasm.github.io/docs/wasm-pack/).
+5. Call `cargo install trunk` to install the [Trunk](https://trunkrs.dev/) web-build tool.
+ - In the future, `trunk` can be updated with the same command. (You may need the `--locked` flag if your ambient version of `rustc` does not match that required by `trunk`.)
6. Add the `.cargo/bin` folder in your home directory to your executable search path
- - This lets you call Trunk, and other tools installed by Cargo, without specifying their paths
- - On POSIX systems, the search path is stored in the `PATH` environment variable
+ - This lets you call Trunk, and other tools installed by Cargo, without specifying their paths.
+ - On POSIX systems, the search path is stored in the `PATH` environment variable.
+ - Alternatively, if you don't want to adjust your `PATH`, you can install `trunk` in another directory `DIR` via `cargo install --root DIR trunk`.
### Play with the prototype
-1. From the `app-proto` folder, call `trunk serve --release` to build and serve the prototype
- - The crates the prototype depends on will be downloaded and served automatically
- - For a faster build, at the expense of a much slower prototype, you can call `trunk serve` without the `--release` flag
+1. From the `app-proto` folder, call `trunk serve --release` to build and serve the prototype.
+ - The crates the prototype depends on will be downloaded and served automatically.
+ - For a faster build, at the expense of a much slower prototype, you can call `trunk serve` without the `--release` flag.
- If you want to stay in the top-level folder, you can call `trunk serve --config app-proto [--release]` from there instead.
-3. In a web browser, visit one of the URLs listed under the message `INFO 📡 server listening at:`
- - Touching any file in the `app-proto` folder will make Trunk rebuild and live-reload the prototype
-4. Press *ctrl+C* in the shell where Trunk is running to stop serving the prototype
+3. In a web browser, visit one of the URLs listed under the message `INFO 📡 server listening at:`.
+ - Touching any file in the `app-proto` folder will make Trunk rebuild and live-reload the prototype.
+4. Press *ctrl+C* in the shell where Trunk is running to stop serving the prototype.
### Run the engine on some example problems
-1. Use `sh` to run the script `tools/run-examples.sh`
- - The script is location-independent, so you can do this from anywhere in the dyna3 repository
+1. Use `sh` to run the script `tools/run-examples.sh`.
+ - The script is location-independent, so you can do this from anywhere in the dyna3 repository.
- The call from the top level of the repository is:
-
+
```bash
sh tools/run-examples.sh
```
- - For each example problem, the engine will print the value of the loss function at each optimization step
- - The first example that prints is the same as the Irisawa hexlet example from the Julia version of the engine prototype. If you go into `engine-proto/gram-test`, launch Julia, and then
-
+ - For each example problem, the engine will print the value of the loss function at each optimization step.
+ - The first example that prints is the same as the Irisawa hexlet example from the Julia version of the engine prototype. If you go into `engine-proto/gram-test`, launch Julia, and then execute
+
```julia
include("irisawa-hexlet.jl")
for (step, scaled_loss) in enumerate(history_alt.scaled_loss)
println(rpad(step-1, 4), " | ", scaled_loss)
end
```
-
- you should see that it prints basically the same loss history until the last few steps, when the lower default precision of the Rust engine really starts to show
+
+ you should see that it prints basically the same loss history until the last few steps, when the lower default precision of the Rust engine really starts to show.
### Run the automated tests
-1. Go into the `app-proto` folder
-2. Call `cargo test`
+1. Go into the `app-proto` folder.
+2. Call `cargo test`.
### Deploy the prototype
-1. From the `app-proto` folder, call `trunk build --release`
- - Building in [release mode](https://doc.rust-lang.org/cargo/reference/profiles.html#release) produces an executable which is smaller and often much faster, but harder to debug and more time-consuming to build
- - If you want to stay in the top-level folder, you can call `trunk build --config app-proto --release` from there instead
+1. From the `app-proto` folder, call `trunk build --release`.
+ - Building in [release mode](https://doc.rust-lang.org/cargo/reference/profiles.html#release) produces an executable which is smaller and often much faster, but harder to debug and more time-consuming to build.
+ - If you want to stay in the top-level folder, you can call `trunk build --config app-proto --release` from there instead.
2. Use `sh` to run the packaging script `tools/package-for-deployment.sh`.
- - The script is location-independent, so you can do this from anywhere in the dyna3 repository
+ - The script is location-independent, so you can do this from anywhere in the dyna3 repository.
- The call from the top level of the repository is:
```bash
sh tools/package-for-deployment.sh
```
- - This will overwrite or replace the files in `deploy/dyna3`
+ - This will overwrite or replace the files in `deploy/dyna3`.
3. Put the contents of `deploy/dyna3` in the folder on your server that the prototype will be served from.
- - To simplify uploading, you might want to combine these files into an archive called `deploy/dyna3.zip`. Git has been set to ignore this path
\ No newline at end of file
+ - To simplify uploading, you might want to combine these files into an archive called `deploy/dyna3.zip`. Git has been set to ignore this path.
diff --git a/app-proto/Cargo.lock b/app-proto/Cargo.lock
index 4f75c45..731dd84 100644
--- a/app-proto/Cargo.lock
+++ b/app-proto/Cargo.lock
@@ -255,6 +255,7 @@ dependencies = [
"charming",
"console_error_panic_hook",
"dyna3",
+ "enum-iterator",
"itertools",
"js-sys",
"lazy_static",
@@ -271,6 +272,26 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+[[package]]
+name = "enum-iterator"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4549325971814bda7a44061bf3fe7e487d447cba01e4220a4b454d630d7a016"
+dependencies = [
+ "enum-iterator-derive",
+]
+
+[[package]]
+name = "enum-iterator-derive"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "685adfa4d6f3d765a26bc5dbc936577de9abf756c1feeb3089b01dd395034842"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "equivalent"
version = "1.0.1"
diff --git a/app-proto/Cargo.toml b/app-proto/Cargo.toml
index 1230b47..d5221a1 100644
--- a/app-proto/Cargo.toml
+++ b/app-proto/Cargo.toml
@@ -10,6 +10,7 @@ default = ["console_error_panic_hook"]
dev = []
[dependencies]
+enum-iterator = "2.3.0"
itertools = "0.13.0"
js-sys = "0.3.70"
lazy_static = "1.5.0"
diff --git a/app-proto/examples/irisawa-hexlet.rs b/app-proto/examples/irisawa-hexlet.rs
index 0d710ff..d7dd5fc 100644
--- a/app-proto/examples/irisawa-hexlet.rs
+++ b/app-proto/examples/irisawa-hexlet.rs
@@ -15,9 +15,9 @@ fn main() {
for k in 4..9 {
println!(" {} sun", 1.0 / config[(3, k)]);
}
-
+
// print the completed Gram matrix
print::gram_matrix(&config);
}
print::loss_history(&realization.history);
-}
\ No newline at end of file
+}
diff --git a/app-proto/examples/kaleidocycle.rs b/app-proto/examples/kaleidocycle.rs
index ae4eb07..4a9ad7e 100644
--- a/app-proto/examples/kaleidocycle.rs
+++ b/app-proto/examples/kaleidocycle.rs
@@ -14,7 +14,7 @@ fn main() {
// print the completed Gram matrix and the realized configuration
print::gram_matrix(&config);
print::config(&config);
-
+
// find the kaleidocycle's twist motion by projecting onto the tangent
// space
const N_POINTS: usize = 12;
@@ -29,4 +29,4 @@ fn main() {
let normalization = 5.0 / twist_motion[(2, 0)];
println!("\nTwist motion:{}", (normalization * twist_motion).to_string().trim_end());
}
-}
\ No newline at end of file
+}
diff --git a/app-proto/index.html b/app-proto/index.html
index 4fbe52f..c312b51 100644
--- a/app-proto/index.html
+++ b/app-proto/index.html
@@ -6,7 +6,7 @@
-
+