summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2024-09-24 14:14:36 +0200
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2024-10-01 20:56:40 +0200
commit2f621920eaf084b29ce3ad15204b989e868df826 (patch)
tree6bbaeae2ed8197087fabff88ffa910ed77a3ed14
parent8d22064082aa2c8b451a6a4cc1ea6078aa1d1ce7 (diff)
libcamera: geometry: Clarify Rectangle's top-left corner
The libcamera::Rectangle class allows defining rectangles regardless of the orientation of the reference system where a rectangle is used in. This implies that, depending on the reference system in use, the rectangle's top-left corner, as defined by libcamera, doesn't correspond to the visual top-left position. ^ | | ------------------- | ^ | h | | | y| o---->------------- | w -------------------------------> (0,0) x (0,0) x ------------------------------> | w y| o---->------------- | | | h | v | | ------------------- | V Clarify that a Rectangle's top-left corner corresponds to the point with the smaller x and y coordinates and that the horizontal and vertical dimensions are obtained by positive increments along the corresponding axes. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
-rw-r--r--src/libcamera/geometry.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
index 00015136..85a7f53a 100644
--- a/src/libcamera/geometry.cpp
+++ b/src/libcamera/geometry.cpp
@@ -594,6 +594,8 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)
*
* Rectangles are used to identify an area of an image. They are specified by
* the coordinates of top-left corner and their horizontal and vertical size.
+ * By convention, the top-left corner is defined as the corner with the lowest
+ * x and y coordinates, regardless of the origin and direction of the axes.
*
* The measure unit of the rectangle coordinates and size, as well as the
* reference point from which the Rectangle::x and Rectangle::y displacements
@@ -611,6 +613,8 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)
* \param[in] x The horizontal coordinate of the top-left corner
* \param[in] y The vertical coordinate of the top-left corner
* \param[in] size The size
+ *
+ * The rectangle's top-left corner is the point with the smaller x and y values.
*/
/**
@@ -620,6 +624,8 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)
* \param[in] y The vertical coordinate of the top-left corner
* \param[in] width The width
* \param[in] height The height
+ *
+ * The rectangle's top-left corner is the point with the smaller x and y values.
*/
/**
@@ -632,11 +638,15 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)
/**
* \var Rectangle::x
* \brief The horizontal coordinate of the rectangle's top-left corner
+ *
+ * The rectangle's top-left corner is the point with the smaller x and y values.
*/
/**
* \var Rectangle::y
* \brief The vertical coordinate of the rectangle's top-left corner
+ *
+ * The rectangle's top-left corner is the point with the smaller x and y values.
*/
/**
@@ -685,6 +695,9 @@ Point Rectangle::center() const
/**
* \fn Point Rectangle::topLeft() const
* \brief Retrieve the coordinates of the top left corner of this Rectangle
+ *
+ * The rectangle's top-left corner is the point with the smaller x and y values.
+ *
* \return The Rectangle's top left corner
*/