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>
This commit is contained in:
Jacopo Mondi
2024-09-24 14:14:36 +02:00
parent 8d22064082
commit 2f621920ea

View File

@@ -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
*/