Engine prototype #13

Open
Vectornaut wants to merge 117 commits from engine-proto into main
5 changed files with 33 additions and 31 deletions
Showing only changes of commit 2038103d80 - Show all commits

View File

@ -207,14 +207,16 @@ end
# ~~~ sandbox setup ~~~ # ~~~ sandbox setup ~~~
# in the default view, e4 + e5 is the point at infinity elements = begin
elements = Engine.nullmix * sqrt(0.5) * BigFloat[ const a = sqrt(BigFloat(3)/2)
1 1 -1 -1 0; sqrt(0.5) * BigFloat[
1 -1 1 -1 0; 1 1 -1 -1 0
1 -1 -1 1 0; 1 -1 1 -1 0
0 0 0 0 -sqrt(6); 1 -1 -1 1 0
1 1 1 1 2 -0.5 -0.5 -0.5 -0.5 -a-1
0.5 0.5 0.5 0.5 -a+1
] ]
end
# show construction # show construction
viewer = Viewer.ConstructionViewer() viewer = Viewer.ConstructionViewer()

View File

@ -29,7 +29,7 @@ function rand_on_shell(rng::AbstractRNG, shell::T) where T <: Number
space_part = rand_on_sphere(rng, T, 4) space_part = rand_on_sphere(rng, T, 4)
rapidity = randn(rng, T) rapidity = randn(rng, T)
sig = sign(shell) sig = sign(shell)
[sconh(rapidity, sig)*space_part; sconh(rapidity, -sig)] nullmix * [sconh(rapidity, sig)*space_part; sconh(rapidity, -sig)]
end end
rand_on_shell(rng::AbstractRNG, shells::Array{T}) where T <: Number = rand_on_shell(rng::AbstractRNG, shells::Array{T}) where T <: Number =
@ -39,19 +39,16 @@ rand_on_shell(shells::Array{<:Number}) = rand_on_shell(Random.default_rng(), she
# === elements === # === elements ===
## [temp] in light cone coordinates
point(pos) = [pos; 1; dot(pos, pos)] point(pos) = [pos; 1; dot(pos, pos)]
## [temp] in standard coordinates plane(normal, offset) = [normal; 0; offset]
plane(normal, offset) = [normal; offset; offset]
## [temp] in standard coordinates
function sphere(center, radius) function sphere(center, radius)
dist_sq = dot(center, center) dist_sq = dot(center, center)
[ [
center / radius; center / radius;
0.5 * ((dist_sq - 1) / radius - radius); -0.5 / radius;
0.5 * ((dist_sq + 1) / radius - radius) 0.5 * (dist_sq / radius - radius)
] ]
end end

View File

@ -55,7 +55,7 @@ gram = sparse(J, K, values)
## guess = Engine.rand_on_shell(fill(BigFloat(-1), 8)) ## guess = Engine.rand_on_shell(fill(BigFloat(-1), 8))
# set initial guess # set initial guess
guess = Engine.nullmix * hcat( guess = hcat(
Engine.plane(BigFloat[0, 0, 1], BigFloat(0)), Engine.plane(BigFloat[0, 0, 1], BigFloat(0)),
Engine.sphere(BigFloat[0, 0, 0], BigFloat(1//2)), Engine.sphere(BigFloat[0, 0, 0], BigFloat(1//2)),
Engine.plane(BigFloat[1, 0, 0], BigFloat(1)), Engine.plane(BigFloat[1, 0, 0], BigFloat(1)),
@ -64,7 +64,7 @@ guess = Engine.nullmix * hcat(
Engine.sphere(BigFloat[-1, 0, 0], BigFloat(1//5)), Engine.sphere(BigFloat[-1, 0, 0], BigFloat(1//5)),
Engine.sphere(BigFloat[cos(-pi/3), sin(-pi/3), 0], BigFloat(1//5)), Engine.sphere(BigFloat[cos(-pi/3), sin(-pi/3), 0], BigFloat(1//5)),
Engine.sphere(BigFloat[cos(pi/3), sin(pi/3), 0], BigFloat(1//5)), Engine.sphere(BigFloat[cos(pi/3), sin(pi/3), 0], BigFloat(1//5)),
BigFloat[0, 0, 0, 1, 1] BigFloat[0, 0, 0, 0, 1]
) )
frozen = [CartesianIndex(j, 9) for j in 4:5] frozen = [CartesianIndex(j, 9) for j in 4:5]
#= #=

View File

@ -36,16 +36,19 @@ gram[1, 6] = gram[6, 1]
# in this initial guess, the mutual tangency condition is satisfied for spheres # in this initial guess, the mutual tangency condition is satisfied for spheres
# 1 through 5 # 1 through 5
Random.seed!(50793) Random.seed!(50793)
guess = Engine.nullmix * hcat( guess = begin
const a = sqrt(BigFloat(3)/2)
hcat(
sqrt(1/BigFloat(2)) * BigFloat[ sqrt(1/BigFloat(2)) * BigFloat[
1 1 -1 -1 0; 1 1 -1 -1 0
1 -1 1 -1 0; 1 -1 1 -1 0
1 -1 -1 1 0; 1 -1 -1 1 0
0 0 0 0 -sqrt(BigFloat(6)); -0.5 -0.5 -0.5 -0.5 -a-1
1 1 1 1 2; 0.5 0.5 0.5 0.5 -a+1
] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)), ] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)),
Engine.rand_on_shell(fill(BigFloat(-1), 2)) Engine.rand_on_shell(fill(BigFloat(-1), 2))
) )
end
# complete the gram matrix # complete the gram matrix
#= #=

View File

@ -41,15 +41,15 @@ gram = sparse(J, K, values)
# set initial guess # set initial guess
Random.seed!(99230) Random.seed!(99230)
guess = Engine.nullmix * hcat( guess = hcat(
sqrt(1/BigFloat(3)) * BigFloat[ sqrt(1/BigFloat(3)) * BigFloat[
1 1 -1 -1 0 1 1 -1 -1 0
1 -1 1 -1 0 1 -1 1 -1 0
1 -1 -1 1 0 1 -1 -1 1 0
1 1 1 1 -2 0 0 0 0 -1.5
1 1 1 1 1 1 1 1 1 -0.5
] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)), ] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)),
BigFloat[0, 0, 0, 1, 1] BigFloat[0, 0, 0, 0, 1]
) )
frozen = [CartesianIndex(j, 6) for j in 1:5] frozen = [CartesianIndex(j, 6) for j in 1:5]