I'm building a 3D scatter graph for a magnetometer calibration tool. The graph is centered on [0,0,0], I'd like to make sure the camera points through the most recent point (call it v) to [0,0,0].
I'm struggling finding the right incantation. I'm not really sure how CameraXRotation and CameraYRotation should relate to the euler angles of v. Here's my latest effort (which doesn't work):
QVector3D v = QVector3D(x,y,z);
v.normalize();
// camera vector
QVector3D camera = QVector3D(0,1,0); // camera along y axis
// compute rotation
QQuaternion rotation = QQuaternion::rotationTo(camera,v);
rotation.getEulerAngles(&pitch,&yaw,&roll);
// set camera rotation
graph->setCameraXRotation(roll);
graph->setCameraYRotation(pitch);