Is a Scala/ScalaJS library for Algorithmic Design. The visualizer run on any Browser with JS. Scala's RELP can be used to interact with the visualizer via WS to develop your designs.
The webbapp visualizer uses the threejs library on the background.
┌───────┐ ┌───────┐ ┌────────────┐
│ Model │ │ Proto │ │ ThreeUtils │
└────┬──┘ └─┬──┬──┘ │ NOT USED │
│ ┌───┘ └────┐ └─────────┬──┘
├───┼─────────┐ │ ?
│ │ │ │
┌─▼───▼──┐ ┌─▼─▼──────────┐
│ syntax │ │ geometryCore │
└┬──┬───┬┘ └──────────┬───┘
┌----┐ │ │ │ │
|DEMO◄─┘ │ └─────┬────────┐ │
└----┘ │ │ │ │
┌─────────▼──┐ ┌────▼─────┐ │ │
│ controller │ │ prebuild │ │ │
└───▲────┬───┘ └─┬──────┬─┘ │ │
│ │ │ │ │ │
│ └──┐ ┌─┘ └──┐ │ │
│ │ │ │ │ │
│ ┌─▼──▼─┐ ┌─▼─▼─▼──┐
│ │ repl │ │ webapp │
│ └──────┘ └───┬────┘
└────────────────────────┘
┌┐└┼┘├┤►▲▼◄^<v>
flowchart TD;
subgraph library
Model --> syntax;
Model --> geometryCore;
Proto --> syntax;
Proto --> geometryCore;
ThreeUtils;
syntax --> controller;
syntax --> prebuild;
syntax --> webapp;
geometryCore --> webapp;
controller --> repl;
prebuild --> repl;
prebuild --> webapp;
webapp ==>|use| controller;
end
subgraph library client
syntax -.->|import lib| demo;
end
(We will make a release the future)
If you want to try I recommend to clone this repository and run it yourself with SBT.
In the future I will publish the Scala3 version!
The old version in publish on: https://repo1.maven.org/maven2/app/fmgp/scala-threejs_sjs1.0-RC2_2.13/
libraryDependencies += "app.fmgp" % "fmgp-threejs_2.13" % "0.1-M1"
On sbt controller/reStart "Revolver"
(this will run the server on the background)
Open http://localhost:8888
on your browser.
We suggest to develop your geometric algorithm designs, in a separate main, and having the controller (server) running.
Your code must post the geometric model to the controller via http. See an example in the main class SingleRequest.scala.
On sbt: ~repl/run fmgp.SingleRequest
Note: ~
will hot reload a your main every time a change is made to the code.
The role of the controller is to keep the websocket allways open to the browser. This way the geometric model is reload almost instantaneous. Its also possible to open a websocket communicating and directly with the browser. But it takes time for the webapp to try to reconnect.
Use the scala REPL (“Read-Evaluate-Print-Loop”) to develop your geometric algorithm designs.
repl/console //start REPL from the console module
//This will starting the controller server and import the DSL
> :load script.sc //load a file. Equivalent to copy-paste ever line from script.sc
> //your code...
On sbt core/fastOptJS::webpack
Open file:///.../modules/02-core/index-dev.html
on your browser.
On sbt webapp/fastOptJS::webpack
Open file:///.../modules/04-webapp/index-fastopt.html
on your browser.
For the GRPC and protubuf you need to have envoy runing.
docker run --rm -ti --net=host -v $PWD/envoy.yaml:/etc/envoy/envoy.yaml envoyproxy/envoy:v1.17.0
This project is licensed under the MIT license, available at http://opensource.org/licenses/mit-license.php and also in the LICENSE file.
Copyright the Fabio Pinheiro, 2021.