<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Detecting Clicks on Rotated Rectangles	</title>
	<atom:link href="https://joshuawoehlke.com/detecting-clicks-rotated-rectangles/feed/" rel="self" type="application/rss+xml" />
	<link>https://joshuawoehlke.com/detecting-clicks-rotated-rectangles/</link>
	<description>Developer</description>
	<lastBuildDate>Fri, 17 May 2024 00:28:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>
		By: Jack Stein		</title>
		<link>https://joshuawoehlke.com/detecting-clicks-rotated-rectangles/#comment-108310</link>

		<dc:creator><![CDATA[Jack Stein]]></dc:creator>
		<pubDate>Thu, 24 Mar 2022 18:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://joshuawoehlke.com/?p=730#comment-108310</guid>

					<description><![CDATA[I used this  code as a prototype for what I need and it worked with the mods that Christian pointed out.

Thank you.

Jack]]></description>
			<content:encoded><![CDATA[<p>I used this  code as a prototype for what I need and it worked with the mods that Christian pointed out.</p>
<p>Thank you.</p>
<p>Jack</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: How do I rotate, scale and translate on Html5 Canvas? - Tutorial Guruji		</title>
		<link>https://joshuawoehlke.com/detecting-clicks-rotated-rectangles/#comment-102773</link>

		<dc:creator><![CDATA[How do I rotate, scale and translate on Html5 Canvas? - Tutorial Guruji]]></dc:creator>
		<pubDate>Thu, 24 Jun 2021 09:37:46 +0000</pubDate>
		<guid isPermaLink="false">http://joshuawoehlke.com/?p=730#comment-102773</guid>

					<description><![CDATA[[&#8230;] If I have time tomorrow I will try to implement the following to your code but I can provide you with a working example of how to get mouse collision precision on a rotated rectangle. I had the same struggle with this and finally found a good explanation and code that I was able to get to work. Check out this website [&#8230;]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] If I have time tomorrow I will try to implement the following to your code but I can provide you with a working example of how to get mouse collision precision on a rotated rectangle. I had the same struggle with this and finally found a good explanation and code that I was able to get to work. Check out this website [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Me		</title>
		<link>https://joshuawoehlke.com/detecting-clicks-rotated-rectangles/#comment-102460</link>

		<dc:creator><![CDATA[Me]]></dc:creator>
		<pubDate>Fri, 11 Jun 2021 13:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://joshuawoehlke.com/?p=730#comment-102460</guid>

					<description><![CDATA[Great tutorial! I was able to hack this into my own code. I calculate my vertices differently but using your triangleArea and clickHit functions got the results needed. Thanks a bunch!]]></description>
			<content:encoded><![CDATA[<p>Great tutorial! I was able to hack this into my own code. I calculate my vertices differently but using your triangleArea and clickHit functions got the results needed. Thanks a bunch!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Christian		</title>
		<link>https://joshuawoehlke.com/detecting-clicks-rotated-rectangles/#comment-100631</link>

		<dc:creator><![CDATA[Christian]]></dc:creator>
		<pubDate>Sat, 27 Feb 2021 14:55:13 +0000</pubDate>
		<guid isPermaLink="false">http://joshuawoehlke.com/?p=730#comment-100631</guid>

					<description><![CDATA[First of all, thank you so much for this in-depth explanation! This is so easy to consume and, following this guide, makes it a breeze to actually understand what&#039;s going on.

I found two things that didn&#039;t work for me and needed changes in code, which may be due to my specific implementation, but seem to be generic:

In findRectVertices, line 15, you&#039;re calculating the center point:
var center = [ right - left, bottom - top ];

However, this code just yields the width &#038; height, and doesn&#039;t take into account the position  of the rectangle. I made it work by changing it to this:
var center = [ left + size[0] / 2, top + size[1] / 2 ];

Finally, in the clickHit-function you return true if the triangle areas are larger than the rectangle:
if (triArea &#062; rectArea) {
		return true;
	}
	return false;

In my case, that returns true if there wasn&#039;t a hit, and false if there was a hit, so I changed it to this:
      return (triArea &#060;= elArea);

Thank you again for this post, you&#039;ve really helped me out!]]></description>
			<content:encoded><![CDATA[<p>First of all, thank you so much for this in-depth explanation! This is so easy to consume and, following this guide, makes it a breeze to actually understand what&#8217;s going on.</p>
<p>I found two things that didn&#8217;t work for me and needed changes in code, which may be due to my specific implementation, but seem to be generic:</p>
<p>In findRectVertices, line 15, you&#8217;re calculating the center point:<br />
var center = [ right &#8211; left, bottom &#8211; top ];</p>
<p>However, this code just yields the width &amp; height, and doesn&#8217;t take into account the position  of the rectangle. I made it work by changing it to this:<br />
var center = [ left + size[0] / 2, top + size[1] / 2 ];</p>
<p>Finally, in the clickHit-function you return true if the triangle areas are larger than the rectangle:<br />
if (triArea &gt; rectArea) {<br />
		return true;<br />
	}<br />
	return false;</p>
<p>In my case, that returns true if there wasn&#8217;t a hit, and false if there was a hit, so I changed it to this:<br />
      return (triArea &lt;= elArea);</p>
<p>Thank you again for this post, you&#039;ve really helped me out!</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
