Correct Minkowski product; build chain of three spheres
This commit is contained in:
parent
c29000d912
commit
59a527af43
@ -78,7 +78,7 @@ 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
|
||||
struct LiesOn{T} <: Relation{T}
|
||||
@ -94,7 +94,7 @@ struct AlignsWithBy{T} <: Relation{T}
|
||||
elements::Vector{Element{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
|
||||
|
||||
equation(rel::AlignsWithBy) = dot(rel.elements[1].vec, rel.elements[2].vec) - rel.cos_angle
|
||||
@ -166,15 +166,28 @@ end
|
||||
|
||||
# ~~~ sandbox setup ~~~
|
||||
|
||||
a = Engine.Point{Rational{Int64}}()
|
||||
s = Engine.Sphere{Rational{Int64}}()
|
||||
a_on_s = Engine.LiesOn{Rational{Int64}}(a, s)
|
||||
ctx = Engine.Construction{Rational{Int64}}(elements = Set([a]), relations= Set([a_on_s]))
|
||||
CoeffType = Rational{Int64}
|
||||
|
||||
a = Engine.Point{CoeffType}()
|
||||
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)
|
||||
|
||||
b = Engine.Point{Rational{Int64}}()
|
||||
b_on_s = Engine.LiesOn{Rational{Int64}}(b, s)
|
||||
b = Engine.Point{CoeffType}()
|
||||
b_on_s = Engine.LiesOn{CoeffType}(b, s)
|
||||
Engine.push!(ctx, b)
|
||||
Engine.push!(ctx, s)
|
||||
Engine.push!(ctx, b_on_s)
|
||||
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))
|
Loading…
Reference in New Issue
Block a user