Correct Minkowski product; build chain of three spheres

This commit is contained in:
Aaron Fenyes 2024-01-29 12:28:45 -05:00
parent c29000d912
commit 59a527af43

View File

@ -78,7 +78,7 @@ end
abstract type Relation{T} end abstract type Relation{T} end
mprod(v, w) = v[1]*w[2] + w[1]*v[2] - dot(v[3:end], w[3:end]) mprod(v, w) = (v[1]*w[2] + w[1]*v[2]) / 2 - dot(v[3:end], w[3:end])
# elements: point, sphere # elements: point, sphere
struct LiesOn{T} <: Relation{T} struct LiesOn{T} <: Relation{T}
@ -94,7 +94,7 @@ struct AlignsWithBy{T} <: Relation{T}
elements::Vector{Element{T}} elements::Vector{Element{T}}
cos_angle::T cos_angle::T
LiesOn{T}(sph1::Point{T}, sph2::Sphere{T}, cos_angle::T) where T = new{T}([sph1, sph2], cos_angle) AlignsWithBy{T}(sph1::Sphere{T}, sph2::Sphere{T}, cos_angle::T) where T = new{T}([sph1, sph2], cos_angle)
end end
equation(rel::AlignsWithBy) = dot(rel.elements[1].vec, rel.elements[2].vec) - rel.cos_angle equation(rel::AlignsWithBy) = dot(rel.elements[1].vec, rel.elements[2].vec) - rel.cos_angle
@ -166,15 +166,28 @@ end
# ~~~ sandbox setup ~~~ # ~~~ sandbox setup ~~~
a = Engine.Point{Rational{Int64}}() CoeffType = Rational{Int64}
s = Engine.Sphere{Rational{Int64}}()
a_on_s = Engine.LiesOn{Rational{Int64}}(a, s) a = Engine.Point{CoeffType}()
ctx = Engine.Construction{Rational{Int64}}(elements = Set([a]), relations= Set([a_on_s])) s = Engine.Sphere{CoeffType}()
a_on_s = Engine.LiesOn{CoeffType}(a, s)
ctx = Engine.Construction{CoeffType}(elements = Set([a]), relations= Set([a_on_s]))
eqns_a_s = Engine.realize(ctx) eqns_a_s = Engine.realize(ctx)
b = Engine.Point{Rational{Int64}}() b = Engine.Point{CoeffType}()
b_on_s = Engine.LiesOn{Rational{Int64}}(b, s) b_on_s = Engine.LiesOn{CoeffType}(b, s)
Engine.push!(ctx, b) Engine.push!(ctx, b)
Engine.push!(ctx, s) Engine.push!(ctx, s)
Engine.push!(ctx, b_on_s) Engine.push!(ctx, b_on_s)
eqns_ab_s = Engine.realize(ctx) eqns_ab_s = Engine.realize(ctx)
spheres = [Engine.Sphere{CoeffType}() for _ in 1:3]
tangencies = [
Engine.AlignsWithBy{CoeffType}(
spheres[n],
spheres[mod1(n+1, length(spheres))],
-1//1
)
for n in 1:3
]
ctx_chain = Engine.Construction{CoeffType}(elements = Set(spheres), relations = Set(tangencies))