mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-03 04:06:45 +02:00
[ui] scene3D: Add getRotatedCameraViewVector
function
This commit is contained in:
parent
39b7dfd512
commit
9df260ac6c
1 changed files with 17 additions and 1 deletions
|
@ -355,6 +355,22 @@ class Transformations3DHelper(QObject):
|
||||||
|
|
||||||
return U.toEulerAngles()
|
return U.toEulerAngles()
|
||||||
|
|
||||||
|
@Slot(QVector3D, QVector3D, float, float, result=QVector3D)
|
||||||
|
def getRotatedCameraViewVector(self, camereViewVector, cameraUpVector, pitch, yaw):
|
||||||
|
""" Compute the rotated camera view vector with given pitch and yaw (in degrees).
|
||||||
|
Args:
|
||||||
|
camereViewVector (QVector3D): Camera view vector, the displacement from the camera position to its target
|
||||||
|
cameraUpVector (QVector3D): Camera up vector, the direction the top of the camera is facing
|
||||||
|
pitch (float): Rotation pitch (in degrees)
|
||||||
|
yaw (float): Rotation yaw (in degrees)
|
||||||
|
Returns:
|
||||||
|
QVector3D: rotated camera view vector
|
||||||
|
"""
|
||||||
|
cameraSideVector = QVector3D.crossProduct(camereViewVector, cameraUpVector)
|
||||||
|
yawRot = QQuaternion.fromAxisAndAngle(cameraUpVector, yaw)
|
||||||
|
pitchRot = QQuaternion.fromAxisAndAngle(cameraSideVector, pitch)
|
||||||
|
return (yawRot * pitchRot).rotatedVector(camereViewVector)
|
||||||
|
|
||||||
@Slot(QVector3D, QMatrix4x4, Qt3DRender.QCamera, QSize, result=float)
|
@Slot(QVector3D, QMatrix4x4, Qt3DRender.QCamera, QSize, result=float)
|
||||||
def computeScaleUnitFromModelMatrix(self, axis, modelMat, camera, windowSize):
|
def computeScaleUnitFromModelMatrix(self, axis, modelMat, camera, windowSize):
|
||||||
""" Compute the length of the screen projected vector axis unit transformed by the model matrix.
|
""" Compute the length of the screen projected vector axis unit transformed by the model matrix.
|
||||||
|
|
Loading…
Add table
Reference in a new issue