{"id":21466,"url":"https://patchwork.libcamera.org/api/patches/21466/?format=json","web_url":"https://patchwork.libcamera.org/patch/21466/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241002055002.6271-1-jacopo.mondi@ideasonboard.com>","date":"2024-10-02T05:49:58","name":"[v10,1/5] libcamera: geometry: Clarify Rectangle's top-left corner","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"1c3170213ca13d1c7587375ded4b89bae26b85b6","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21466/mbox/","series":[{"id":4647,"url":"https://patchwork.libcamera.org/api/series/4647/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4647","date":"2024-10-01T19:13:44","name":"Add Face Detection Controls","version":10,"mbox":"https://patchwork.libcamera.org/series/4647/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21466/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21466/checks/","tags":{},"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 82600BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Oct 2024 05:50:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6CF963528;\n\tWed,  2 Oct 2024 07:50:17 +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 1366B6350B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Oct 2024 07:50:14 +0200 (CEST)","from ideasonboard.com (unknown [5.77.88.238])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 134F263F;\n\tWed,  2 Oct 2024 07:48:39 +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=\"Y/fALEiG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727848121;\n\tbh=ZmVN2B7zYL3NekOhgCe3US8FkMSisJ8m755y49T2gqg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Y/fALEiGHdnAh/RY8FFu68kLN89Q1aat5CfXU7DDAqjD/6odJFZXyqQeeloTrb1RX\n\tU4D+gmk9RFiGEuENA57lqoBWApMs32rxS1JUdM8yXyFvVqlV21Lb73mlcyWB7UXtQw\n\thEJ9+ZENAZk8p18GojdtTYcHOX3RyOminp5841uI=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Harvey Yang <chenghaoyang@google.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tHarvey Yang <chenghaoyang@chromium.org>,\n\tDavid Plowman <david.plowman@raspberrypi.com>","Subject":"[PATCH v10 1/5] libcamera: geometry: Clarify Rectangle's top-left\n\tcorner","Date":"Wed,  2 Oct 2024 07:49:58 +0200","Message-ID":"<20241002055002.6271-1-jacopo.mondi@ideasonboard.com>","X-Mailer":"git-send-email 2.46.1","In-Reply-To":"<20241001191354.55056-1-jacopo.mondi@ideasonboard.com>","References":"<20241001191354.55056-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>"},"content":"The libcamera::Rectangle class allows defining rectangles regardless of\nthe orientation of the reference system where a rectangle is used in.\n\nThis implies that, depending on the reference system in use, the\nrectangle's top-left corner, as defined by libcamera, doesn't correspond\nto 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\nClarify that a Rectangle's top-left corner corresponds to the point\nwith the smaller x and y coordinates and that the horizontal and\nvertical dimensions are obtained by positive increments along the\ncorresponding axes.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Harvey Yang <chenghaoyang@chromium.org>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/geometry.cpp | 13 +++++++++++++\n 1 file changed, 13 insertions(+)","diff":"diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex 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  */\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","prefixes":["v10","1/5"]}