Add sphere and plane utilities to engine
This commit is contained in:
parent
736ac50b07
commit
828498b3de
@ -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)
|
||||
|
||||
# === 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 ===
|
||||
|
||||
# the Lorentz form
|
||||
|
Loading…
Reference in New Issue
Block a user