I'm trying to figure out how to align my 3D viewport to the line connecting two 3D points.
For example, say I want my 3D viewport to be oriented such that it looks directly along the line connecting (1, 2, 3) to (6, 5, 4). As an added constraint, say I wanted to position the viewpoint a distance of 10 from the point (1, 2, 3).
I know how to query the current view_location, view_matrix, view_distance, and view_rotation, but I am unfamiliar with how to transform it to be in the correct position and orientation.
C = bpy.context
viewports_3D = []
for area in C.screen.areas:
if area.type == 'VIEW_3D':
viewports_3D.append(area)
viewports_3D[0].spaces.active.region_3d.view_location
viewports_3D[0].spaces.active.region_3d.view_matrix
viewports_3D[0].spaces.active.region_3d.view_distance
viewports_3D[0].spaces.active.region_3d.view_rotation