Engine prototype #13
@ -210,13 +210,17 @@ function realize(ctx::Construction{T}) where T
|
|||||||
[elt.rel for (_, elt) in eltenum if !isnothing(elt.rel)]
|
[elt.rel for (_, elt) in eltenum if !isnothing(elt.rel)]
|
||||||
)
|
)
|
||||||
|
|
||||||
# add relations to center and orient the construction
|
# add relations to center, orient, and scale the construction
|
||||||
if !isempty(ctx.points)
|
if !isempty(ctx.points)
|
||||||
append!(eqns, [sum(pt.coords[k] for pt in ctx.points) for k in 1:3])
|
append!(eqns, [sum(pt.coords[k] for pt in ctx.points) for k in 1:3])
|
||||||
end
|
end
|
||||||
if !isempty(ctx.spheres)
|
if !isempty(ctx.spheres)
|
||||||
append!(eqns, [sum(sph.coords[k] for sph in ctx.spheres) for k in 3:4])
|
append!(eqns, [sum(sph.coords[k] for sph in ctx.spheres) for k in 3:4])
|
||||||
end
|
end
|
||||||
|
n_elts = length(ctx.points) + length(ctx.spheres)
|
||||||
|
if n_elts > 0
|
||||||
|
push!(eqns, sum(elt.vec[2] for elt in Iterators.flatten((ctx.points, ctx.spheres))) - n_elts)
|
||||||
|
end
|
||||||
|
|
||||||
(Generic.Ideal(coordring, eqns), eqns)
|
(Generic.Ideal(coordring, eqns), eqns)
|
||||||
end
|
end
|
||||||
@ -305,10 +309,14 @@ for through_trivial in [false, true]
|
|||||||
## [verbose] display(cut_offset)
|
## [verbose] display(cut_offset)
|
||||||
cut_subspace = LinearSubspace(cut_matrix, cut_offset)
|
cut_subspace = LinearSubspace(cut_matrix, cut_offset)
|
||||||
else
|
else
|
||||||
cut_subspace = LinearSubspace(cut_matrix, fill(0, 3))
|
cut_subspace = LinearSubspace(cut_matrix, fill(0, freedom))
|
||||||
end
|
end
|
||||||
wtns = witness_set(system, cut_subspace)
|
wtns = witness_set(system, cut_subspace)
|
||||||
for soln in filter(is_nontrivial, solution.(filter(isreal, results(wtns))))
|
real_solns = solution.(filter(isreal, results(wtns)))
|
||||||
|
nontrivial_solns = filter(is_nontrivial, real_solns)
|
||||||
|
println("$(length(real_solns) - length(nontrivial_solns)) trivial solutions found")
|
||||||
|
for soln in nontrivial_solns
|
||||||
|
##[test] for soln in filter(is_nontrivial, solution.(filter(isreal, results(wtns))))
|
||||||
if all(norm2(soln - samp) > 1e-4*length(gens(coordring)) for samp in samples)
|
if all(norm2(soln - samp) > 1e-4*length(gens(coordring)) for samp in samples)
|
||||||
push!(samples, soln)
|
push!(samples, soln)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user