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

Error in the SphericalFromCartesian function #92

Open
LingyiZou opened this issue Dec 8, 2023 · 0 comments
Open

Error in the SphericalFromCartesian function #92

LingyiZou opened this issue Dec 8, 2023 · 0 comments

Comments

@LingyiZou
Copy link

The results of the following function seem wrong to me,

function (::SphericalFromCartesian)(x::AbstractVector)
length(x) == 3 || error("Spherical transform takes a 3D coordinate")

Spherical(hypot(x[1], x[2], x[3]), atan(x[2], x[1]), atan(x[3], hypot(x[1], x[2])))

end

Should the fourth line be changed to this?

function (::SphericalFromCartesian)(x::AbstractVector)
length(x) == 3 || error("Spherical transform takes a 3D coordinate")

Spherical(hypot(x[1], x[2], x[3]), atan(x[2], x[1]), atan(hypot(x[1], x[2]), x[3]))

end

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

1 participant