Add sphere and plane utilities to engine

This commit is contained in:
Aaron Fenyes 2024-07-08 12:56:14 -07:00
parent 736ac50b07
commit 828498b3de

View File

@ -33,6 +33,19 @@ rand_on_shell(rng::AbstractRNG, shells::Array{T}) where T <: Number =
rand_on_shell(shells::Array{<:Number}) = rand_on_shell(Random.default_rng(), shells) rand_on_shell(shells::Array{<:Number}) = rand_on_shell(Random.default_rng(), shells)
# === elements ===
plane(normal, offset) = [normal; offset; offset]
function sphere(center, radius)
dist_sq = dot(center, center)
return [
center / radius;
0.5 * ((dist_sq - 1) / radius - radius);
0.5 * ((dist_sq + 1) / radius - radius)
]
end
# === Gram matrix realization === # === Gram matrix realization ===
# the Lorentz form # the Lorentz form