Skip to content

Commit c613b09

Browse files
committed
disk canonical is unit disk
1 parent 6b18c5f commit c613b09

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Domains/Disk.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ const 𝔻 = Disk()
2424

2525
isambiguous(d::Disk) = isnan(d.radius) && all(isnan,d.center)
2626

27+
polar(r,θ) = Vec(r*cos(θ),r*sin(θ))
28+
ipolar(x,y) = Vec(sqrt(abs2(x)+abs2(y)), atan(y,x))
29+
polar(rθ::Vec) = polar(rθ...)
30+
ipolar(xy::Vec) = ipolar(xy...)
2731

28-
#canonical is rectangle [r,0]x[-π,π]
29-
# we assume radius and centre are zero for now
30-
fromcanonical(D::Disk{T},x,t) where {T<:Real} =
31-
Vec(D.radius*x*cos(t)+D.center[1],D.radius*x*sin(t)+D.center[2])
32-
tocanonical(D::Disk{T},x,y) where {T<:Real} =
33-
Vec(sqrt((x-D.center[1])^2+(y-D.center[2])^2)/D.radius,
34-
atan(y-D.center[2],x-D.center[1]))
35-
checkpoints(d::Disk) = [fromcanonical(d,(.1,.2243));fromcanonical(d,(-.212423,-.3))]
32+
fromcanonical(D::Disk{T},xy::Vec) where {T<:Vec} = Vec((D.radius.*xy .+ D.center)...)
33+
tocanonical(D::Disk{T},x,y) where {T<:Vec} = Vec((xy .- D.center)./D.radius)
34+
35+
checkpoints(d::Disk) = [fromcanonical(d,Vec(.1,.2243)),fromcanonical(d,Vec(-.212423,-.3))]
3636

3737
# function points(d::Disk,n,m,k)
3838
# ptsx=0.5*(1-gaussjacobi(n,1.,0.)[1])

0 commit comments

Comments
 (0)