diff --git a/src/geometries/primitives/ball.jl b/src/geometries/primitives/ball.jl index 22e991eb2..2ef1919e3 100644 --- a/src/geometries/primitives/ball.jl +++ b/src/geometries/primitives/ball.jl @@ -43,11 +43,10 @@ function (b::Ball{𝔼{2}})(ρ, φ) end c = b.center r = b.radius - l = T(ρ) * r - sφ, cφ = sincospi(2 * T(φ)) - x = l * cφ - y = l * sφ - c + Vec(x, y) + ρ′ = T(ρ) * r + φ′ = T(φ) * 2 * T(π) * u"rad" + p = Point(convert(crs(b), Polar(ρ′, φ′))) + p + to(c) end function (b::Ball{𝔼{3}})(ρ, θ, φ) @@ -57,11 +56,9 @@ function (b::Ball{𝔼{3}})(ρ, θ, φ) end c = b.center r = b.radius - l = T(ρ) * r - sθ, cθ = sincospi(T(θ)) - sφ, cφ = sincospi(2 * T(φ)) - x = l * sθ * cφ - y = l * sθ * sφ - z = l * cθ - c + Vec(x, y, z) + ρ′ = T(ρ) * r + θ′ = T(θ) * T(π) * u"rad" + φ′ = T(φ) * 2 * T(π) * u"rad" + p = Point(convert(crs(b), Spherical(ρ′, θ′, φ′))) + p + to(c) end diff --git a/src/geometries/primitives/sphere.jl b/src/geometries/primitives/sphere.jl index c04a7ddbd..e5d960204 100644 --- a/src/geometries/primitives/sphere.jl +++ b/src/geometries/primitives/sphere.jl @@ -80,10 +80,9 @@ function (s::Sphere{𝔼{2}})(φ) end c = s.center r = s.radius - sφ, cφ = sincospi(2 * T(φ)) - x = r * cφ - y = r * sφ - c + Vec(x, y) + φ′ = T(φ) * 2 * T(π) * u"rad" + p = Point(convert(crs(s), Polar(r, φ′))) + p + to(c) end function (s::Sphere{𝔼{3}})(θ, φ) @@ -93,10 +92,8 @@ function (s::Sphere{𝔼{3}})(θ, φ) end c = s.center r = s.radius - sθ, cθ = sincospi(T(θ)) - sφ, cφ = sincospi(2 * T(φ)) - x = r * sθ * cφ - y = r * sθ * sφ - z = r * cθ - c + Vec(x, y, z) + θ′ = T(θ) * T(π) * u"rad" + φ′ = T(φ) * 2 * T(π) * u"rad" + p = Point(convert(crs(s), Spherical(r, θ′, φ′))) + p + to(c) end