<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QPoint overlap]]></title><description><![CDATA[<p dir="auto">Hi, i have a question.<br />
I have a function that creates many QPoint with random coordinates. My question is, how can i prevent that they overlap?</p>
]]></description><link>https://forum.qt.io/topic/139196/qpoint-overlap</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 02:15:05 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139196.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Sep 2022 14:21:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QPoint overlap on Fri, 09 Sep 2022 19:37:11 GMT]]></title><description><![CDATA[<p dir="auto">To add to what <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> wrote, you have to check that the distance between a new point (center of circle) and every other point (circle centers) is greater than 2*radius (assuming they all have the same radius).</p>
]]></description><link>https://forum.qt.io/post/728104</link><guid isPermaLink="true">https://forum.qt.io/post/728104</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Fri, 09 Sep 2022 19:37:11 GMT</pubDate></item><item><title><![CDATA[Reply to QPoint overlap on Fri, 09 Sep 2022 19:25:14 GMT]]></title><description><![CDATA[<p dir="auto">Then rember all your points and check if your new circle is not inside another circle - simple math.</p>
<blockquote>
<p dir="auto">vector = Point1 - Point2<br />
distance = sqrt(vector.x * vector.x + vector.y * vector.y)</p>
</blockquote>
]]></description><link>https://forum.qt.io/post/728100</link><guid isPermaLink="true">https://forum.qt.io/post/728100</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 09 Sep 2022 19:25:14 GMT</pubDate></item><item><title><![CDATA[Reply to QPoint overlap on Fri, 09 Sep 2022 19:07:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> ok let me explain better. My function (namend very surprisingly paint() ) creates randomly a QPoint and then draws a circle of radius 5 with the center in the QPoint. I want to avoid the situation described in the figure.</p>
]]></description><link>https://forum.qt.io/post/728098</link><guid isPermaLink="true">https://forum.qt.io/post/728098</guid><dc:creator><![CDATA[Davide00]]></dc:creator><pubDate>Fri, 09 Sep 2022 19:07:26 GMT</pubDate></item><item><title><![CDATA[Reply to QPoint overlap on Fri, 09 Sep 2022 18:20:34 GMT]]></title><description><![CDATA[<p dir="auto">These are not two points but two circles. You asked about two points being the same. So what's your real question?</p>
]]></description><link>https://forum.qt.io/post/728094</link><guid isPermaLink="true">https://forum.qt.io/post/728094</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 09 Sep 2022 18:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to QPoint overlap on Fri, 09 Sep 2022 18:19:02 GMT]]></title><description><![CDATA[<p dir="auto">Maybe i explained not in the best way, i already have a function that checks if 2 QPoint have the same centre, what i wanto to avoid is a situation like the one in the figure<img src="https://ddgobkiprc33d.cloudfront.net/f0034fc2-cc7c-4995-9403-572bb73fc1f9.jpg" alt="intersec.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/728093</link><guid isPermaLink="true">https://forum.qt.io/post/728093</guid><dc:creator><![CDATA[Davide00]]></dc:creator><pubDate>Fri, 09 Sep 2022 18:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to QPoint overlap on Fri, 09 Sep 2022 15:01:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/davide00">@<bdi>Davide00</bdi></a> said in <a href="/post/728077">QPoint overlap</a>:</p>
<blockquote>
<p dir="auto">how can i prevent that they overlap?</p>
</blockquote>
<p dir="auto">Put all your points in a QSet (or a std::set). This will ensure that there are no duplicates.</p>
]]></description><link>https://forum.qt.io/post/728078</link><guid isPermaLink="true">https://forum.qt.io/post/728078</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Fri, 09 Sep 2022 15:01:19 GMT</pubDate></item></channel></rss>