Hello stephan,
the transform matrix can be constructed in following manner, starting from a given position vector (X, Y, Z) and orientation vector (Yaw, Pitch, Roll):
#define point of view (position, orientation)
import Metashape as ps
position = ps.Vector((6.566944698204851,46.59323523897216,735.2981091487283)) # position vector X, Y, Z in chunk.crs 'WGS 84 + EGM96 height (EPSG::9707)'
orientation = ps.Vector((7.997216319444453,55.883424713290765,-4.79245619778298)) # orientation vector Yaw, Pitch, Roll in chunk.crs
#calculate relevant transform matrix t
chunk = ps.app.document.chunk
position = chunk.crs.unproject(position) # position in ECEF
orientation = chunk.crs.geogcs.localframe(position).rotation().t() * ps.Utils.ypr2mat(orientation) # orientation matrix in ECEF
transform = ps.Matrix.Translation(position) * ps.Matrix.Rotation(orientation)
transform = chunk.transform.matrix.inv() * transform * ps.Matrix.Diag((1, -1, -1, 1))
t = ps.Matrix.Translation(transform.translation()) * ps.Matrix.Rotation(transform.rotation()) # 4x4 transform matrix 3 translations and 3 rotations
Hope this is helpful,