<?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: Puzzler: Overlapping rectangles</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Quan Quach</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12132</link>
		<dc:creator>Quan Quach</dc:creator>
		<pubDate>Tue, 15 Jul 2008 21:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12132</guid>
		<description>Looks like it doesn&#039;t like my &quot;or&quot; symbol.  Now we will never know if I solved your puzzler :(</description>
		<content:encoded><![CDATA[<p>Looks like it doesn&#8217;t like my &#8220;or&#8221; symbol.  Now we will never know if I solved your puzzler :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quan Quach</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12131</link>
		<dc:creator>Quan Quach</dc:creator>
		<pubDate>Tue, 15 Jul 2008 21:15:30 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12131</guid>
		<description>Okay, trying again:

&lt;pre&gt;&lt;code&gt;

if min(ay) &gt; min(by)
  temp = ay;
  temp2 = ax;
  ay = by;
  ax = bx;
  by = temp;
  bx = temp;
  %swapping rectangle coordinates. too lazy to explain why
end

if max(ax) =max(bx)
  overlap = 0;
elseif max(ay) &gt;min(by)
  overlap = 1;
else
  overlap = 0;
end

&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Okay, trying again:</p>
<pre><code>

if min(ay) &gt; min(by)
  temp = ay;
  temp2 = ax;
  ay = by;
  ax = bx;
  by = temp;
  bx = temp;
  %swapping rectangle coordinates. too lazy to explain why
end

if max(ax) =max(bx)
  overlap = 0;
elseif max(ay) &gt;min(by)
  overlap = 1;
else
  overlap = 0;
end

</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12127</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Tue, 15 Jul 2008 18:53:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12127</guid>
		<description>Quan,

That did not seem to work, may have gotten garbled a bit since the first if statement has an assignment where it should have a ==.

Doug

PS. You are welcome for the puzzles!</description>
		<content:encoded><![CDATA[<p>Quan,</p>
<p>That did not seem to work, may have gotten garbled a bit since the first if statement has an assignment where it should have a ==.</p>
<p>Doug</p>
<p>PS. You are welcome for the puzzles!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quan Quach</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12125</link>
		<dc:creator>Quan Quach</dc:creator>
		<pubDate>Tue, 15 Jul 2008 17:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12125</guid>
		<description>I hate you for wasting my time on these puzzlers.  See blinkdagger post please, I have a recommendation for you!  

http://www.blinkdagger.com/blog/mathematical-body-art</description>
		<content:encoded><![CDATA[<p>I hate you for wasting my time on these puzzlers.  See blinkdagger post please, I have a recommendation for you!  </p>
<p><a href="http://www.blinkdagger.com/blog/mathematical-body-art" rel="nofollow">http://www.blinkdagger.com/blog/mathematical-body-art</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quan Quach</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12124</link>
		<dc:creator>Quan Quach</dc:creator>
		<pubDate>Tue, 15 Jul 2008 17:44:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12124</guid>
		<description>I think I&#039;ll give this a try:

&lt;pre&gt;&lt;code&gt;


if min(ay) &gt; min(by)
  temp = ay;
  temp2 = ax;
  ay = by;
  ax = bx;
  by = temp;
  bx = temp;
  %swapping rectangle coordinates. too lazy to explain why
end

if max(ax) = max(bx)
  overlap = 0;
elseif max(ay) &gt;min(by)
  overlap = 1;
else
  overlap = 0;
end
&lt;/code&gt;&lt;/pre&gt;

Man, that was a lot of work! Do I win a prize if my submission passes the stress test?  My old MATLAB t-shirt is getting worn down from wearing it so much.  Need new one!</description>
		<content:encoded><![CDATA[<p>I think I&#8217;ll give this a try:</p>
<pre><code>

if min(ay) &gt; min(by)
  temp = ay;
  temp2 = ax;
  ay = by;
  ax = bx;
  by = temp;
  bx = temp;
  %swapping rectangle coordinates. too lazy to explain why
end

if max(ax) = max(bx)
  overlap = 0;
elseif max(ay) &gt;min(by)
  overlap = 1;
else
  overlap = 0;
end
</code></pre>
<p>Man, that was a lot of work! Do I win a prize if my submission passes the stress test?  My old MATLAB t-shirt is getting worn down from wearing it so much.  Need new one!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12122</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Tue, 15 Jul 2008 15:26:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12122</guid>
		<description>Aigrette,

I did not know about that function, that is easy and clean.  I like seeing how many different solutions there are for these very simple problems.  It helps us all run into new techniques and functions.

Thanks all!
Doug</description>
		<content:encoded><![CDATA[<p>Aigrette,</p>
<p>I did not know about that function, that is easy and clean.  I like seeing how many different solutions there are for these very simple problems.  It helps us all run into new techniques and functions.</p>
<p>Thanks all!<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ArthurG</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12118</link>
		<dc:creator>ArthurG</dc:creator>
		<pubDate>Tue, 15 Jul 2008 13:12:01 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12118</guid>
		<description>Aigrette, I like that your solution uses the actual rectangle area.

Doug never specifically said whether the coordinates are sorted. Note that most of the posted solutions will fail if they aren&#039;t.</description>
		<content:encoded><![CDATA[<p>Aigrette, I like that your solution uses the actual rectangle area.</p>
<p>Doug never specifically said whether the coordinates are sorted. Note that most of the posted solutions will fail if they aren&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roy</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12117</link>
		<dc:creator>Roy</dc:creator>
		<pubDate>Tue, 15 Jul 2008 13:06:39 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12117</guid>
		<description>There is a File Exchange submission by Doug Schwarz to compute the intersections of two piecewise-linear curves here:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11837&amp;objectType=file

For each pair of line segments, the linear algebra to determine their intersection point is of course easy put expensive, so the code first checks to see if the smallest rectangles enclosing them overlap.  See lines 99-109 of the code.</description>
		<content:encoded><![CDATA[<p>There is a File Exchange submission by Doug Schwarz to compute the intersections of two piecewise-linear curves here:</p>
<p><a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11837&#038;objectType=file" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11837&#038;objectType=file</a></p>
<p>For each pair of line segments, the linear algebra to determine their intersection point is of course easy put expensive, so the code first checks to see if the smallest rectangles enclosing them overlap.  See lines 99-109 of the code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aigrette</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12115</link>
		<dc:creator>Aigrette</dc:creator>
		<pubDate>Tue, 15 Jul 2008 08:09:52 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12115</guid>
		<description>Alright, I think I have found the laziest solution. I should have lookfored &quot;area&quot; earlier...


&lt;pre&gt; &lt;code&gt;

% define rectangle 1
rect1 = [ax(1) ay(1) diff(ax) diff(ay)];

% define rectangle 2
rect2 = [bx(1) by(1) diff(bx) diff(by)];

% the lazy solution
overlap = (rectint(rect1,rect2)~=0)

&lt;/code&gt; &lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Alright, I think I have found the laziest solution. I should have lookfored &#8220;area&#8221; earlier&#8230;</p>
<pre> <code>

% define rectangle 1
rect1 = [ax(1) ay(1) diff(ax) diff(ay)];

% define rectangle 2
rect2 = [bx(1) by(1) diff(bx) diff(by)];

% the lazy solution
overlap = (rectint(rect1,rect2)~=0)

</code> </pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12114</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Tue, 15 Jul 2008 06:24:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/07/14/puzzler-overlapping-rectangles/#comment-12114</guid>
		<description>... or ...
&lt;pre&gt; &lt;code&gt;
voverlap =  (ax(1) &lt; bx(2) &amp; bx(1) &lt; ax(2)) &amp; (ay(1) &lt; by(2) &amp; by(1) &lt; ay(2));
&lt;pre&gt; &lt;code&gt;</description>
		<content:encoded><![CDATA[<p>&#8230; or &#8230;</p>
<pre> <code><br />
voverlap =  (ax(1) &lt; bx(2) &amp; bx(1) &lt; ax(2)) &amp; (ay(1) &lt; by(2) &amp; by(1) &lt; ay(2));
<pre> <code>
</code></pre></code></pre>]]></content:encoded>
	</item>
</channel>
</rss>

