diff --git a/engine-proto/engine.jl b/engine-proto/engine.jl new file mode 100644 index 0000000..8b82b47 --- /dev/null +++ b/engine-proto/engine.jl @@ -0,0 +1,34 @@ +module Engine + +export Construction, Sphere, mprod, point + +using LinearAlgebra +using Groebner + +mutable struct Construction + nextid::Int64 + + Construction(; nextid = 0) = new(nextid) +end + +struct Sphere{T<:Number} + vec::Vector{T} + id + + function Sphere(vec::Vector{T}, ctx::Construction) where T <: Number + id = ctx.nextid + ctx.nextid += 1 + new{T}(vec, id) + end +end + +function mprod(sv::Sphere, sw::Sphere) + v = sv.vec + w = sw.vec + v[1]*w[2] + v[2]*w[1] - dot(v[3:end], w[3:end]) +end + +point(pt::Vector{<:Number}, ctx::Construction) = + Sphere([one(eltype(pt)), dot(pt, pt), pt...], ctx) + +end \ No newline at end of file