Thanks! I guess I cannot assume this particular value Vec3f(-st * cp, -st * sp, ct)
of upvector
for the general case, but we can easily invert these spherical coordinates (with theta
defined as the angle from the xy plane) based on lookat
and eyeposition
:
v = normalize(cam.eyeposition[] - cam.lookat[])
phi = atan(v[2], v[1]) # azimuth
theta = asin(v[3]) # elevation (between -π/2 and π/2)
It could be nice to have a helper function for that in Makie?