JuliaGeometry / JuliaGeometry/CoordinateTransformations.jl

Unexpected output types from `inv(transform)(x)`

Open
#81 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
185
Forks
24
PR merge metrics
No merged PRs in 30d

Description

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}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported behavior with the Julia snippet in the issue, focusing on the output types of the forward and inverse transformations. Compare the results for LinearMap, Rotations, Translation, and the composed transformation; done means the inverse behavior is understood and the inconsistent output types are addressed or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.