Skip to content

@cast on functions with tuples as lvalues #61

@prittjam

Description

@prittjam

is there a way to use tensor cast for functions that return tuples? e.g.,

function axis_to_random_rotation3(x::AbstractVector)
    x′ = similar(x)
    x′ .= rand(eltype(x),3)
    y = cross(x,x′)
    z = cross(x,y)
    R = [x y z]
    R .= R./norm.(eachcol(R))'

    return R
end

renorm!(n) = n ./= norm(n)

@views function plane_to_random_pose(Π)
    renorm!(Π)
    R = axis_to_random_rotation3(Π[1:3])
    t = -Π[4].*Π[1:3]
    
    return R, t
end

Here I want to use tensor cast to shape the returned pose from a set of planes e.g.

Π = rand(4,100)
@cast something something  := plane_to_random_pose(Π[:,j])[i]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions