GLMakie: Length of the arrows

Is there better way to align the tip of the red arrow head to the surface of the sphere?

It seems arrows() draws arrow tail (the straight line) and adds the arrow head. Thus the total length of the arrow is the direction + the length of the head.

I’ve checked attributes for arrows() but couldn’t find anything I can use. What am I missing?

This is the best I came up with; subtract the length of the head from the direction.

using GLMakie
using GeometryBasics

head_len = 0.2

pos = [Point3f(0, 0, 0)]
dir1 = [Point3f(1, 0, 0)]
dir2 = [Point3f(1 - head_len, 0, 0)]
sphere = GeometryBasics.Sphere(Point3f(0), 1)
f, a, p = wireframe(sphere, color=:gray, transparency=true)
arrows!(a, pos, dir2,
        linewidth = 0.05,
        arrowsize = Vec3f(0.1, 0.1, head_len),
        normalize = false,
        color = :red)

1 Like

As of this writing, arrows() doesn’t do it.
Refer to an issue at github:
https://github.com/JuliaPlots/Makie.jl/issues/1206