Currently the 3d plots output by CairoMakie is bad because of the dense meshes.
Flat arrows should be used instead:
"""Flat 2D arrow in 3D: line shaft + triangular mesh head."""
function arrow_flat!(
ax, origin, direction, tip_width, tip_length,
plane_normal; color=:black, linewidth=2,
)
o = collect(Float64, origin)
d = collect(Float64, direction)
pn = collect(Float64, plane_normal)
dir = normalize(d)
len = norm(d)
shaft_end = o + (len - tip_length) * dir
tip_apex = o + len * dir
perp = cross(dir, pn)
if norm(perp) < 1e-6
perp = abs(dir[3]) < 0.9 ?
cross(dir, [0.0, 0.0, 1.0]) :
cross(dir, [1.0, 0.0, 0.0])
end
perp = normalize(perp) * tip_width
shaft_vis = o + (len - tip_length * 0.7) * dir
lines!(ax,
[Point3f(o...), Point3f(shaft_vis...)],
color=color, linewidth=linewidth)
tri = [
Point3f((shaft_end - perp)...),
Point3f((shaft_end + perp)...),
Point3f(tip_apex...),
]
mesh!(ax, tri, [1 2 3], color=color, shading=NoShading)
end
Currently the 3d plots output by CairoMakie is bad because of the dense meshes.
Flat arrows should be used instead: