summaryrefslogtreecommitdiff
path: root/src/libcamera/camera_sensor.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-10-19 16:01:27 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-10-23 16:05:59 +0300
commitb54c935dd764ac3348bcedb9ff67d53a26cfaceb (patch)
treece558e390a37d6a92cde7c77d60f8387f0a4b053 /src/libcamera/camera_sensor.cpp
parent250577878bff825516ea5a942aea1b3339acb15c (diff)
libcamera: transform: Invert operator*() operands
The current definition of operator*(Transform t1, Transform t0) follows the function composition notion, where t0 is applied first then t1 is applied last. In order to introduce operator*(Orientation, Transform) where a Transform is applied on top of an Orientation, invert the operand order of operator*(Transform, Transform) so that usage of operator* with both Orientation and Transform can be made associative. For example: Orientation o; Transform t = t1 * t2 Orientation o1 = o * t = o * (t1 * t2) = (o * t1) * t2 = o * t1 * t2 Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/camera_sensor.cpp')
-rw-r--r--src/libcamera/camera_sensor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 8ff72b42..521a1997 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -1136,7 +1136,7 @@ Transform CameraSensor::validateTransform(Transform *transform) const
* Combine the requested transform to compensate the sensor mounting
* rotation.
*/
- Transform combined = *transform * rotationTransform_;
+ Transform combined = rotationTransform_ * *transform;
/*
* We combine the platform and user transform, but must "adjust away"
@@ -1165,7 +1165,7 @@ Transform CameraSensor::validateTransform(Transform *transform) const
* If the sensor can do no transforms, then combined must be
* changed to the identity. The only user transform that gives
* rise to this is the inverse of the rotation. (Recall that
- * combined = transform * rotationTransform.)
+ * combined = rotationTransform * transform.)
*/
*transform = -rotationTransform_;
combined = Transform::Identity;