Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atan2 return value seems wrong #43

Open
Keno opened this issue Sep 20, 2015 · 3 comments
Open

atan2 return value seems wrong #43

Keno opened this issue Sep 20, 2015 · 3 comments

Comments

@Keno
Copy link

Keno commented Sep 20, 2015

julia> (pivot,opposite)
(FixedSizeArrays.Point{2,Int32}((506,432)),FixedSizeArrays.Point{2,Int32}((282,350)))

julia> atan2(pivot, opposite)
FixedSizeArrays.Point{2,Float64}((1.0623564415840052,0.8898756879564043))

julia> atan2(pivot[1]-opposite[1],pivot[2]-opposite[2])
1.219876329384468
@SimonDanisch
Copy link
Owner

It applies it vectorized like in base:

julia> p, o = convert(Array, pivot), convert(Array, opposite)
julia> atan2(p, o)
2-element Array{Float64,1}:
 1.06236
 0.889876

Another problem is, that on master I switched back to not let functions change the return type.
So it will do Vec{2, Int32}(atan2(a[1], b[1]), atan2(a[2], b[2])) which will result in an InexactError.
I should change that back at some point, but I need to do this cleanly. Otherwise type inference will cry.

@Keno
Copy link
Author

Keno commented Sep 20, 2015

That makes sense for Vecs, but I don't really like that behavior for Points.

@SimonDanisch
Copy link
Owner

Ah I see your point!
I haven't implemented any Point specific methods yet, so it behaves identical to Vec.
If we start doing things like that, -, +, * need their own definition as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants