Engine prototype #13

Merged
glen merged 133 commits from engine-proto into main 2024-10-21 03:18:48 +00:00
5 changed files with 19 additions and 7 deletions
Showing only changes of commit bde42ebac0 - Show all commits

View File

@ -4,6 +4,8 @@ using Blink
using Colors
using Printf
using Main.Engine
export ConstructionViewer, display!, opentools!, closetools!
# === Blink utilities ===
@ -133,7 +135,7 @@ mprod(v, w) =
function display!(viewer::ConstructionViewer, elements::Matrix)
# load elements
elements_full = []
for elt in eachcol(elements)
for elt in eachcol(Engine.unmix * elements)
if mprod(elt, elt) < 0.5
elt_full = [0; elt; fill(0, 26)]
else
@ -206,7 +208,7 @@ end
# ~~~ sandbox setup ~~~
# in the default view, e4 + e5 is the point at infinity
elements = sqrt(0.5) * BigFloat[
elements = Engine.nullmix * sqrt(0.5) * BigFloat[
1 1 -1 -1 0;
1 -1 1 -1 0;
1 -1 -1 1 0;

View File

@ -39,11 +39,16 @@ rand_on_shell(shells::Array{<:Number}) = rand_on_shell(Random.default_rng(), she
# === elements ===
## [temp] in light cone coordinates
point(pos) = [pos; 1; dot(pos, pos)]
## [temp] in standard coordinates
plane(normal, offset) = [normal; offset; offset]
## [temp] in standard coordinates
function sphere(center, radius)
dist_sq = dot(center, center)
return [
[
center / radius;
0.5 * ((dist_sq - 1) / radius - radius);
0.5 * ((dist_sq + 1) / radius - radius)
@ -52,8 +57,13 @@ end
# === Gram matrix realization ===
# basis changes
nullmix = [Matrix{Int64}(I, 3, 3) zeros(Int64, 3, 2); zeros(Int64, 2, 3) [1 -1; 1 1]//2]
unmix = [Matrix{Int64}(I, 3, 3) zeros(Int64, 3, 2); zeros(Int64, 2, 3) [1 1; -1 1]]
# the Lorentz form
Q = diagm([1, 1, 1, 1, -1])
## [old] Q = diagm([1, 1, 1, 1, -1])
Q = [Matrix{Int64}(I, 3, 3) zeros(Int64, 3, 2); zeros(Int64, 2, 3) [0 2; 2 0]]
# project a matrix onto the subspace of matrices whose entries vanish at the
# given indices

View File

@ -55,7 +55,7 @@ gram = sparse(J, K, values)
## guess = Engine.rand_on_shell(fill(BigFloat(-1), 8))
# set initial guess
guess = hcat(
guess = Engine.nullmix * hcat(
Engine.plane(BigFloat[0, 0, 1], BigFloat(0)),
Engine.sphere(BigFloat[0, 0, 0], BigFloat(1//2)),
Engine.plane(BigFloat[1, 0, 0], BigFloat(1)),

View File

@ -36,7 +36,7 @@ gram[1, 6] = gram[6, 1]
# in this initial guess, the mutual tangency condition is satisfied for spheres
# 1 through 5
Random.seed!(50793)
guess = hcat(
guess = Engine.nullmix * hcat(
sqrt(1/BigFloat(2)) * BigFloat[
1 1 -1 -1 0;
1 -1 1 -1 0;

View File

@ -41,7 +41,7 @@ gram = sparse(J, K, values)
# set initial guess
Random.seed!(99230)
guess = hcat(
guess = Engine.nullmix * hcat(
sqrt(1/BigFloat(3)) * BigFloat[
1 1 -1 -1 0
1 -1 1 -1 0