Builds a 4x4 transform whose rows are the world-space basis
(right, up, forward). Use with transform_mesh() (rotation) and
translate_mesh() (position).
4x4 numeric matrix. The upper-left 3x3 is the rotation used by
transform_mesh(). The last column contains pos for convenience, but
translation should be applied via translate_mesh().
if(run_documentation()) {
m = sphere_mesh(radius = 0.5)
pos = c(-1,0,0) # place Moon on the left
look = c(0,0,0) # look toward the origin (e.g., Earth/camera)
up = c(0,1,0)
M = lookat_transform(pos = pos, look = look, up = up)
m |>
transform_mesh(M) |>
translate_mesh(pos) |>
rasterize_scene(lookfrom = c(0,0,0), lookat = pos,
light_info = directional_light(direction = c(1,0,0)))
}