Commit Graph

54 Commits

Author SHA1 Message Date
Aaron Fenyes
a06d5942e3 Separate test and example for Irisawa hexlet
Put shared code in the conditionally compiled `engine::irisawa` module.
2024-11-09 11:22:15 -08:00
Aaron Fenyes
4094301318 Factor out the realization of the Irisawa hexlet 2024-11-09 01:04:44 -08:00
Aaron Fenyes
3a0f3a8d1c Streamline Gram matrix setup for Irisawa hexlet 2024-11-09 00:34:15 -08:00
Aaron Fenyes
27f88455fb Turn assertionless tests into Cargo examples 2024-11-08 19:48:26 -08:00
Aaron Fenyes
fc39f2a5f3 Switch font to Fira Sans
It has tabular numbers, and it's nice and big too.
2024-11-01 23:58:45 -07:00
Aaron Fenyes
6e42681b71 Stop Assembly::realize from reacting to itself
Previously, `realize` both tracked and updated the element vectors, so
calling it in a reactive context could start a feedback loop.
2024-11-01 20:49:00 -07:00
Aaron Fenyes
327a1267d5 Test representation validity in realization effect 2024-11-01 20:40:25 -07:00
Aaron Fenyes
e12f4332fe Use tabular numbers for element vectors 2024-11-01 19:11:33 -07:00
Aaron Fenyes
5ce5f855d5 Make element vectors reactive 2024-11-01 19:01:14 -07:00
Aaron Fenyes
e42b8da897 Add an element constructor 2024-11-01 18:56:11 -07:00
Aaron Fenyes
bbeebe4464 Simplify memos 2024-11-01 04:43:30 -07:00
Aaron Fenyes
fb292d8b5b Render constraint lists dynamically 2024-11-01 04:32:33 -07:00
Aaron Fenyes
a3fce9d298 Correct typo in comment 2024-10-31 01:24:06 -07:00
Aaron Fenyes
5b522c12ee Include vector representation in element diff key 2024-10-31 01:23:22 -07:00
Aaron Fenyes
1f3a6eea3b Round element vectors to three decimal places 2024-10-30 23:57:15 -07:00
Aaron Fenyes
35d3e4a6f8 Specify fonts
This should help the interface look more consistent across platforms.
The font choices are just placeholders: consistency is the main goal.
2024-10-30 23:29:48 -07:00
Aaron Fenyes
0a13c062f4 Flag constraints with invalid input 2024-10-30 21:12:40 -07:00
Aaron Fenyes
9555d8f784 Update title and authors 2024-10-30 16:06:38 -07:00
Aaron Fenyes
df6db983ba Factor out element outline item 2024-10-30 16:01:19 -07:00
Aaron Fenyes
7f595ff27a Factor out constraint outline item 2024-10-30 15:49:01 -07:00
Aaron Fenyes
9c191ae586 Polish log messages 2024-10-30 00:27:16 -07:00
Aaron Fenyes
9e31037e17 Spread web-sys imports over multiple lines 2024-10-30 00:19:44 -07:00
Aaron Fenyes
c2e3c64d4a Remove debug log from Lorentz product input 2024-10-30 00:16:34 -07:00
Aaron Fenyes
76ad4245d5 Factor out Lorentz product input 2024-10-29 23:43:41 -07:00
Aaron Fenyes
a46ef2c8d6 Work around data binding bug in number input
Setting `bind:value` or `bind:valueAsNumber` for a number input seems to
restrict what you can type in it. We work around this by switching to
text inputs for now. We should probably switch back to number inputs if
we can, though, because they let us take advantage of the browser's
parsing and validation.
2024-10-29 22:53:48 -07:00
Aaron Fenyes
e0880d2ad2 Make constraints editable 2024-10-29 22:32:00 -07:00
Aaron Fenyes
e5f4d523f9 Update the realization when a constraint is activated
Sycamore probably has a better way to do this, but this way works for
now.
2024-10-29 13:46:15 -07:00
Aaron Fenyes
a37c71153d Enforce constraints in the editor 2024-10-26 23:51:27 -07:00
Aaron Fenyes
ce33bbf418 Record optimization history 2024-10-26 01:07:17 -07:00
Aaron Fenyes
9f8632efb3 Port the Irisawa hexlet test to Rust
In the process, notice that the tolerance scale adjustment was ported
wrong, and correct it.
2024-10-25 21:43:53 -07:00
Aaron Fenyes
9fe03264ab Port the Gram matrix realization routine to Rust
Validate with the process inspection example tests, which print out
their results and optimization histories when run one at a time in
`--nocapture` mode.
2024-10-25 17:34:29 -07:00
Aaron Fenyes
e59d60bf77 Reorganize search state; remove unused variables 2024-10-25 17:17:49 -07:00
Aaron Fenyes
16df161fe7 Test alternate projection technique 2024-10-24 19:51:10 -07:00
86fa682b31 feat: Application prototype (#14)
Creates a prototype user interface for dyna3 in the `app-proto` folder. The interface is dynamically constructed using [Sycamore](https://sycamore.dev).

The prototype includes:

  * An application state model (the `AppState` type)
    * A constraint problem model (the `Assembly` type), used in the application state
  * Two views
    * A 3D rendering of the assembly (the `Display` component)
    * A list of elements and constraints (the `Outline` component)

The following features confirm that the views can reflect and send input to the model:

  * You can select elements by clicking and shift-clicking them in the outline. The selected elements are highlighted in the display.
  * You can add elements using a button above the outline. The new elements appear in the display.

Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo>
Reviewed-on: #14
Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net>
Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net>
2024-10-21 23:38:27 +00:00
b92be312e8 Engine prototype (#13)
This PR adds code for a Julia-language prototype of a configuration solver, in the `engine-proto` folder. It uses Julia version 1.10.0.

### Approaches
Development of this PR tried two broad approaches to the constraint geometry problem. Each one suggested various solution techniques. The Gram matrix approach, with the low-rank factorization technique, seems the most promising.

- **Algebraic** *(In the `alg-test` subfolder).* Write the constraints as polynomials in the inversive coordinates of the elements, and use computational algebraic geometry techniques to solve the resulting system. We tried the following techniques.
  - **Gröbner bases** *(`Engine.Algebraic.jl`).* Symbolic. Find a Gröbner basis for the ideal generated by the constraint equations. Information about the solution variety, like its codimension, is then relatively easy to extract.
  - **Homotopy continuation** *(`Engine.Numerical.jl`).* Numerical. Cut the solution set along a random hyperplane to get a generic zero-dimensional slice, and then use a fancy homotopy technique to approximate the points in that slice.

  A few notes about our experiences can be found on the [engine prototype](wiki/Engine-prototype) wiki page.
- **Gram matrix** *(in the `gram-test` subfolder).* A construction is described completely, up to conformal transformations, by the Gram matrix of the vectors representing its elements. Express the constraints as fixed entries of the Gram matrix, and use numerical linear algebra techniques to find a list of vectors whose Gram matrix fits the bill. We tried the following techniques.
  - **LDL decomposition** *(`gram-test.sage`, `gram-test.jl`, `overlap-test.jl`).* Find a cluster of up to five elements whose Gram matrix is completely filled in by the constraints. Use LDL decomposition to find a list of vectors with that Gram matrix. This technique can be made algebraic, as seen in `overlap-test.jl`.
  - **Low-rank factorization** *(source files listed in findings section).* Write down a quadratic loss function that says how far a set of vectors is from meeting the Gram matrix constraints. Use a smooth optimization technique like Newton's method or gradient descent to find a zero of the loss function. In addition to the polished prototype described in the results section, we have an early prototype using an off-the-shelf factorization package (`low-rank-test.jl`) and an visualization of the loss function landscape near global minima (`basin-shapes.jl`).

  The [Gram matrix parameterization](wiki/Gram-matrix-parameterization) wiki page contains detailed notes on this approach.

### Findings

With the algebraic approach, we hit a performance wall pretty quickly as our constructions grew. It was often hard to find real solutions of the polynomial system, since the techniques we use work most naturally in the complex world.

With the Gram matrix approach, on the other hand, we could solve interesting problems in acceptably short times using the low-rank factorization technique. We put the optimization routine in its own module (`Engine.jl`) and used it to solve five example problems:
- `overlapping-pyramids.jl`
- `circles-in-triangle.jl`
- `sphere-in-tetrahedron.jl`
- `tetrahedron-radius-ratio.jl`
- `irisawa-hexlet.jl`

We plan to use low-rank factorization of the Gram matrix in our first app prototype.

### Visualizations

We used the visualizer in the `ganja-test` folder to visually check our low-rank factorization results. The visualizer runs [Ganja.js](https://enkimute.github.io/ganja.js/) in an Electron app, made with [Blink](https://github.com/JuliaGizmos/Blink.jl). Although Ganja.js makes beautiful pictures under most circumstances, we found two obstacles to using it in production.

- It seems to have precision problems with low-curvature spheres.
- We couldn't figure out how to customize its clipping and transparency settings, and the default settings often obscure construction details.

Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo>
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Reviewed-on: #13
Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net>
Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net>
2024-10-21 03:18:47 +00:00
c48d685ad6 doc: Extend comments on coordinatization; add a theory.md notes file 2023-11-07 17:06:19 -08:00
15159302c3 doc: Add Aaron's observations on inversive coords 2023-11-06 11:47:53 -08:00
daed435826 doc: Add a few implementation goals to README 2023-11-01 13:08:20 -07:00
2cfcfacb5a doc: Add new notes directory with design notes 2023-11-01 12:58:08 -07:00
Glen Whitney
fce8be5b56 Adjust lighting and camera for decent initial rendering of polyhedra
Note that the version of three.js also incidentally bumped, since it's set
  to take the latest
2019-12-31 07:20:33 -08:00
9c2038e3c9 Enable mouse rotate, pan, and zoom with TrackballControls 2019-12-12 14:04:11 -05:00
c7f2feab1f First pass at coordinate axes 2019-12-12 02:44:33 -05:00
413a8b5b81 Switch to good old make to reduce redundancies in build 2019-12-12 00:33:59 -05:00
2c17758987 0.1.1 2019-12-11 13:21:01 -05:00
6717a76f21 Copy only the production dependencies to the site directory 2019-12-11 13:20:31 -05:00
5fef463aba 0.1.0 2019-12-11 12:43:50 -05:00
c3995d6fcb Set up testing with Ava 2019-12-11 12:07:43 -05:00
eb81cee609 Generate documentation by assembling markdown and litcoffee files 2019-12-09 20:52:42 -05:00
83318c7884 Set up npm run build to build dyna3 2019-12-09 12:08:05 -05:00
660f42b31f Automatically generate externals.js from package-lock.json
This commit adds a utility to parse package-lock.json and write the proper
  contents of externals.js to standard output. In addition, if the utility
  (src/helpers/pkglock_to_externals.litcoffee) is invoked with a --doc option,
  it instead emits a Markdown bulleted list of all of the external dependencies.
2019-12-08 23:22:52 -05:00