Makie.jl
Makie.jl copied to clipboard
3D marker transformations wrong in CairoMakie
This is sort of a continuation of #2270.
With transform_marker = true, rotate! (as well as other transformations) applies not only to the position of the marker but also the quad the marker draws on. If the rotational axis is not parallel to the x, y or z direction (e.g. if it is (1, 1, 0)) this leads to a shear transformation. Since CairoMakie uses a 2D rotation, translation and scale for scatter, this can't be displayed correctly.
In text this was solved by using a transformation matrix instead: https://github.com/MakieOrg/Makie.jl/blob/36ad29f180518fe87d09eba299db5dc31386ccd1/CairoMakie/src/primitives.jl#L474-L491
but it's going through FreeType (?) font matrices. Cairo should also have its own transform matrix (see https://www.cairographics.org/manual/cairo-Transformations.html#cairo-transform) but Cairo.jl does not seem to export it.
Note that this is also true for the rotation keyword in scatter, regardless of transform_marker.
As an example you can compare scatter(rand(Point3f, 10), markersize = 20, rotation = Quaternionf(0.3, 0.4, 0.5, 0.4)) between GLMakie and CairoMakie.