Clean up examples

Declare JavaScript variables. Revise Julia comments to match new code.
This commit is contained in:
Aaron Fenyes 2024-06-25 02:07:39 -07:00
parent 3c34481519
commit 3b10c95d5f
2 changed files with 18 additions and 22 deletions

View File

@ -19,14 +19,14 @@
<body> <body>
<script> <script>
// in the default view, e4 + e5 is the point at infinity // in the default view, e4 + e5 is the point at infinity
CGA3 = Algebra(4, 1); let CGA3 = Algebra(4, 1);
v1 = CGA3.inline(() => 1e1 + 1e5)(); let v1 = CGA3.inline(() => 1e1 + 1e5)();
v2 = CGA3.inline(() => 1e2 + 1e5)(); let v2 = CGA3.inline(() => 1e2 + 1e5)();
v3 = CGA3.inline(() => 1e3 + 1e5)(); let v3 = CGA3.inline(() => 1e3 + 1e5)();
w1 = CGA3.inline(() => 1e1 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)(); let w1 = CGA3.inline(() => 1e1 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
w2 = CGA3.inline(() => 1e2 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)(); let w2 = CGA3.inline(() => 1e2 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
w3 = CGA3.inline(() => 1e3 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)(); let w3 = CGA3.inline(() => 1e3 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
s = CGA3.inline(() => -Math.sqrt(1.2)*1e4 + Math.sqrt(0.2)*1e5); let s = CGA3.inline(() => -Math.sqrt(1.2)*1e4 + Math.sqrt(0.2)*1e5);
document.body.appendChild(CGA3.graph( document.body.appendChild(CGA3.graph(
[ [

View File

@ -25,20 +25,16 @@ canvas {
} }
""" """
# the "points spheres plane" example from the Ganja coffee shop graph_script = """
#
# https://enkimute.github.io/ganja.js/examples/coffeeshop.html#cga3d_points_spheres_planes
#
sphere_example = """
// in the default view, e4 + e5 is the point at infinity // in the default view, e4 + e5 is the point at infinity
CGA3 = Algebra(4, 1); let CGA3 = Algebra(4, 1);
v1 = CGA3.inline(() => 1e1 + 1e5)(); let v1 = CGA3.inline(() => 1e1 + 1e5)();
v2 = CGA3.inline(() => 1e2 + 1e5)(); let v2 = CGA3.inline(() => 1e2 + 1e5)();
v3 = CGA3.inline(() => 1e3 + 1e5)(); let v3 = CGA3.inline(() => 1e3 + 1e5)();
w1 = CGA3.inline(() => 1e1 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)(); let w1 = CGA3.inline(() => 1e1 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
w2 = CGA3.inline(() => 1e2 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)(); let w2 = CGA3.inline(() => 1e2 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
w3 = CGA3.inline(() => 1e3 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)(); let w3 = CGA3.inline(() => 1e3 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
s = CGA3.inline(() => -Math.sqrt(1.2)*1e4 + Math.sqrt(0.2)*1e5); let s = CGA3.inline(() => -Math.sqrt(1.2)*1e4 + Math.sqrt(0.2)*1e5);
document.body.appendChild(CGA3.graph( document.body.appendChild(CGA3.graph(
[ [
@ -70,4 +66,4 @@ loadjs!(win, "https://unpkg.com/ganja.js")
# launch Ganja visualization # launch Ganja visualization
body!(win, "", async=false) body!(win, "", async=false)
js(win, JSString(sphere_example)) js(win, JSString(graph_script))