Mercurial > repos > public > sbplib_julia
diff src/Grids/geometry.jl @ 1969:7f4a5146c84c feature/grids/geometry_functions
Add tests and better constructor for Circle
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 14 Feb 2025 08:23:00 +0100 |
parents | 669361a8195a |
children | deeb61325320 |
line wrap: on
line diff
--- a/src/Grids/geometry.jl Wed Feb 12 15:45:37 2025 +0100 +++ b/src/Grids/geometry.jl Fri Feb 14 08:23:00 2025 +0100 @@ -64,9 +64,16 @@ return [LineSegment(ps[i], ps[mod1(i+1,n)]) for i ∈ eachindex(ps)] end -struct Circle{T,PT} +struct Circle{PT,T} c::PT r::T + + Circle{PT,T}(c,r) where {PT,T} = new{PT,T}(c,r) +end + +function Circle(c,r) + c = SVector{2}(c) + return Circle{typeof(c), typeof(r)}(c,r) end function (C::Circle)(θ)