[{"id":31524,"web_url":"https://patchwork.libcamera.org/comment/31524/","msgid":"<20241002114434.GA10158@pendragon.ideasonboard.com>","date":"2024-10-02T11:44:34","subject":"Re: [PATCH v10 1/5] libcamera: geometry: Clarify Rectangle's\n\ttop-left corner","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Oct 02, 2024 at 07:49:58AM +0200, Jacopo Mondi wrote:\n> The libcamera::Rectangle class allows defining rectangles regardless of\n> the orientation of the reference system where a rectangle is used in.\n> \n> This implies that, depending on the reference system in use, the\n> rectangle's top-left corner, as defined by libcamera, doesn't correspond\n> to the visual top-left position.\n> \n>          ^\n>          |\n>          |      -------------------\n>          |      ^                 | h\n>          |      |                 |\n>         y|      o---->-------------\n>          |               w\n>           ------------------------------->\n>          (0,0)  x\n> \n>          (0,0)  x\n>            ------------------------------>\n>           |              w\n>          y|     o---->-------------\n>           |     |                 | h\n>           |     v                 |\n>           |     -------------------\n>           |\n>           V\n> \n> Clarify that a Rectangle's top-left corner corresponds to the point\n> with the smaller x and y coordinates and that the horizontal and\n> vertical dimensions are obtained by positive increments along the\n> corresponding axes.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/libcamera/geometry.cpp | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n> \n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 000151364c7f..85a7f53a6f6c 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -594,6 +594,8 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)\n>   *\n>   * Rectangles are used to identify an area of an image. They are specified by\n>   * the coordinates of top-left corner and their horizontal and vertical size.\n> + * By convention, the top-left corner is defined as the corner with the lowest\n> + * x and y coordinates, regardless of the origin and direction of the axes.\n>   *\n>   * The measure unit of the rectangle coordinates and size, as well as the\n>   * reference point from which the Rectangle::x and Rectangle::y displacements\n> @@ -611,6 +613,8 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)\n>   * \\param[in] x The horizontal coordinate of the top-left corner\n>   * \\param[in] y The vertical coordinate of the top-left corner\n>   * \\param[in] size The size\n> + *\n> + * The rectangle's top-left corner is the point with the smaller x and y values.\n\nYou could skip this, it doesn't have to be repeated everywhere. The\ndocumentation in the \\class is good enough.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>   */\n>  \n>  /**\n> @@ -620,6 +624,8 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)\n>   * \\param[in] y The vertical coordinate of the top-left corner\n>   * \\param[in] width The width\n>   * \\param[in] height The height\n> + *\n> + * The rectangle's top-left corner is the point with the smaller x and y values.\n>   */\n>  \n>  /**\n> @@ -632,11 +638,15 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)\n>  /**\n>   * \\var Rectangle::x\n>   * \\brief The horizontal coordinate of the rectangle's top-left corner\n> + *\n> + * The rectangle's top-left corner is the point with the smaller x and y values.\n>   */\n>  \n>  /**\n>   * \\var Rectangle::y\n>   * \\brief The vertical coordinate of the rectangle's top-left corner\n> + *\n> + * The rectangle's top-left corner is the point with the smaller x and y values.\n>   */\n>  \n>  /**\n> @@ -685,6 +695,9 @@ Point Rectangle::center() const\n>  /**\n>   * \\fn Point Rectangle::topLeft() const\n>   * \\brief Retrieve the coordinates of the top left corner of this Rectangle\n> + *\n> + * The rectangle's top-left corner is the point with the smaller x and y values.\n> + *\n>   * \\return The Rectangle's top left corner\n>   */\n>  \n> -- \n> 2.46.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 62D99BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Oct 2024 11:44:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0821863525;\n\tWed,  2 Oct 2024 13:44:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 385D063510\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Oct 2024 13:44:38 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 71FB55A5;\n\tWed,  2 Oct 2024 13:43:05 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tFnyLyWQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727869385;\n\tbh=dg/XTjpJwueP41G/Ot4uNQ+1XBdgoktt8+2AJLiGcRE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tFnyLyWQnRbTPD4JeL3UZh+88CTu0A8JSJu8TiVYezXtpjUSbc6aeKF69mQvKXZ0/\n\t0m5soioTB63+8uI2nbl9FXekqJTNNlUhFJi6pxPGxua8oNlR1XYkqG0w+VcYihlzqw\n\tF4hrA9owT1VYwKV6f49r+XiJSAhnKfWf6d1R6+KA=","Date":"Wed, 2 Oct 2024 14:44:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tHarvey Yang <chenghaoyang@google.com>, \n\tHarvey Yang <chenghaoyang@chromium.org>,\n\tDavid Plowman <david.plowman@raspberrypi.com>","Subject":"Re: [PATCH v10 1/5] libcamera: geometry: Clarify Rectangle's\n\ttop-left corner","Message-ID":"<20241002114434.GA10158@pendragon.ideasonboard.com>","References":"<20241001191354.55056-1-jacopo.mondi@ideasonboard.com>\n\t<20241002055002.6271-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241002055002.6271-1-jacopo.mondi@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]