Skip to content

Error in the SphericalFromCartesian function #92

@LingyiZou

Description

@LingyiZou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions