Skip to content

Commit 20215bf

Browse files
authored
Merge pull request #144 from hyrodium/bugfix/in_circle
update Base.in for HyperSphere
2 parents 77c41b2 + dd3ad6b commit 20215bf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/primitives/spheres.jl

+2-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ origin(c::HyperSphere) = c.center
3131
Base.minimum(c::HyperSphere{N,T}) where {N,T} = Vec{N,T}(origin(c)) - Vec{N,T}(radius(c))
3232
Base.maximum(c::HyperSphere{N,T}) where {N,T} = Vec{N,T}(origin(c)) + Vec{N,T}(radius(c))
3333

34-
function Base.in(x::AbstractPoint{2}, c::Circle)
35-
@inbounds ox, oy = origin(c)
36-
xD = abs(ox - x)
37-
yD = abs(oy - y)
38-
return xD <= c.r && yD <= c.r
34+
function Base.in(x::AbstractPoint, c::HyperSphere)
35+
return norm(origin(c) - x) radius(c)
3936
end
4037

4138
centered(S::Type{HyperSphere{N,T}}) where {N,T} = S(Vec{N,T}(0), T(0.5))

0 commit comments

Comments
 (0)