Skip to content

Commit 5a0fab1

Browse files
authored
separate circle orientation sign function (#78)
1 parent 2bd698e commit 5a0fab1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Domains/Circle.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,24 @@ function tocanonical(d::Circle{T},ζ) where T<:SVector
5757
_tocanonical(v)
5858
end
5959

60+
orientationsign(d::Circle) = d.orientation ? 1 : -1
6061

6162
fromcanonical(d::Circle{T,V,Complex{V}},θ) where {T<:Number,V<:Real} =
62-
d.radius*exp((d.orientation ? 1 : -1)*1.0im*θ) + d.center
63+
d.radius * cis(orientationsign(d) * θ) + d.center
6364
fromcanonicalD(d::Circle{T},θ) where {T<:Number} =
64-
(d.orientation ? 1 : -1)*d.radius*1.0im*exp((d.orientation ? 1 : -1)*1.0im*θ)
65+
orientationsign(d) * d.radius * 1.0im * cis(orientationsign(d) * θ)
6566

6667

6768
fromcanonical(d::Circle{T}::Number) where {T<:SVector} =
68-
d.radius*SVector(cos((d.orientation ? 1 : -1)*θ),sin((d.orientation ? 1 : -1)*θ)) + d.center
69+
d.radius*SVector(cos(orientationsign(d)*θ),sin(orientationsign(d)*θ)) + d.center
6970
fromcanonicalD(d::Circle{T}::Number) where {T<:SVector} =
70-
d.radius*(d.orientation ? 1 : -1)*SVector(-sin((d.orientation ? 1 : -1)*θ),cos((d.orientation ? 1 : -1)*θ))
71+
d.radius*orientationsign(d)*SVector(-sin(orientationsign(d)*θ),cos(orientationsign(d)*θ))
7172

7273

7374
indomain(z,d::Circle) = norm(z-d.center) d.radius
7475

7576
arclength(d::Circle) = 2π*d.radius
76-
complexlength(d::Circle) = (d.orientation ? 1 : -1)*im*arclength(d) #TODO: why?
77+
complexlength(d::Circle) = orientationsign(d)*im*arclength(d) #TODO: why?
7778

7879

7980
==(d::Circle,m::Circle) = d.center == m.center && d.radius == m.radius && d.orientation == m.orientation

0 commit comments

Comments
 (0)