Skip to content

Unexpected output types from inv(transform)(x)  #81

@jonalm

Description

@jonalm

Consider the following

using CoordinateTransformations
using GeometryBasics
using LinearAlgebra
using Rotations

# define transformations
s = LinearMap(Diagonal(Vec3f(1,1,2)))
r = LinearMap(RotX(0.5f0 * π))
t = Translation(Vec3f(0,1,0))
srt = t  r  s

# vector to be transformed
p = Vec3f(1,2,3)

# display type of transformation output
@show typeof(s(p))
@show typeof(r(p))
@show typeof(t(p))
@show typeof(srt(p))
@show typeof(inv(s)(p))
@show typeof(inv(r)(p))
@show typeof(inv(t)(p))
@show typeof(inv(srt)(p))

I was expecting that the output types of all transformations above would be Vec{3, Float32}, but for the inverse transformations I see multiple different output types.

typeof(s(p)) = Vec{3, Float32}
typeof(r(p)) = Vec{3, Float32}
typeof(t(p)) = Vec{3, Float32}
typeof(srt(p)) = Vec{3, Float32}
typeof((inv(s))(p)) = StaticArrays.MVector{3, Float32}
typeof((inv(r))(p)) = Vec{3, Float32}
typeof((inv(t))(p)) = Vec{3, Float32}
typeof((inv(srt))(p)) = Vector{Float32}

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