<?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: working with isometric maps</title>
	<atom:link href="http://www.athanazio.com/2008/02/21/working-with-isometric-maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/</link>
	<description>Nada é Simples, Mas Tudo é Possível</description>
	<lastBuildDate>Thu, 02 Sep 2010 22:11:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Ray Johannessen</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-3179</link>
		<dc:creator>Ray Johannessen</dc:creator>
		<pubDate>Sat, 04 Jul 2009 13:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-3179</guid>
		<description>I&#039;ve been working on an isometric engine for the last couple months. I found what seems to be the best method for screen-to-map conversions. I know it works with diamond-type isometric maps, not sure about other types (like staggered and slide).

It&#039;s a simple algebraic equation, rather than having to mess with sqrts and angles, as I know they&#039;re not the most efficient calculations cpu-wise.

Point tileID;
tileID.X = ((tileWidth * mouse.Y) + (tileHeight * mouse.X)) /
                           (tileWidth* tileHeight);
tileID.Y = ((tileWidth * mouse.Y) - (tileHeight * mouse.X)) /
                           (tileWidth* tileHeight);</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">I&#8217;ve been working on an isometric engine for the last couple months. I found what seems to be the best method for screen-to-map conversions. I know it works with diamond-type isometric maps, not sure about other types (like staggered and slide).</p>
<p>It&#8217;s a simple algebraic equation, rather than having to mess with sqrts and angles, as I know they&#8217;re not the most efficient calculations cpu-wise.</p>
<p>Point tileID;<br />
tileID.X = ((tileWidth * mouse.Y) + (tileHeight * mouse.X)) /<br />
                           (tileWidth* tileHeight);<br />
tileID.Y = ((tileWidth * mouse.Y) &#8211; (tileHeight * mouse.X)) /<br />
                           (tileWidth* tileHeight);</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jörn</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-3049</link>
		<dc:creator>Jörn</dc:creator>
		<pubDate>Fri, 03 Apr 2009 12:54:21 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-3049</guid>
		<description>Great help for a tricky problem! Thanks! And also thanks for the comments that helped aswell!!</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">Great help for a tricky problem! Thanks! And also thanks for the comments that helped aswell!!</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: athanazio</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-2738</link>
		<dc:creator>athanazio</dc:creator>
		<pubDate>Thu, 08 Jan 2009 23:59:54 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-2738</guid>
		<description>great job yepke !</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">great job yepke !</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: yepke</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-2737</link>
		<dc:creator>yepke</dc:creator>
		<pubDate>Thu, 08 Jan 2009 23:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-2737</guid>
		<description>I think you are doing a lot of extra calculations! You can usde much more maths.
It took me all day, but I get the same results now:
public void getTileAt(int screenX, int screenY){
		
 //adjustment will be 4*tileWidth in your example.
                double x = screenX - tileWidth;
		
                //Y*2 -&gt; squares instead of diamonds =&gt; 90° = PI/2
                //easyer calculations!
                double y = screenY*2;
		
                //distance from origin to point in ISO
		double r = Math.sqrt((x*x) + (y*y));
		double theta = Math.atan2(x, y);
		double angle = (Math.PI/4) - theta;
		
                //length of the side of one tile (128/64 are mine)
		double rr = Math.sqrt(2*64*64);

                //&#039;real x&#039; is the projection of screen distance by the angles cos
		double rx = Math.floor(r* Math.cos(angle) / rr);

                //&#039;real x&#039; is the projection of screen distance by the angles sin
		double ry =  Math.floor(r* Math.sin(angle) / rr);
		
		System.out.printf(&quot;(%.0f,%.0f)\n&quot;,rx,ry);
	}</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">I think you are doing a lot of extra calculations! You can usde much more maths.<br />
It took me all day, but I get the same results now:<br />
public void getTileAt(int screenX, int screenY){</p>
<p> //adjustment will be 4*tileWidth in your example.<br />
                double x = screenX &#8211; tileWidth;</p>
<p>                //Y*2 -&gt; squares instead of diamonds =&gt; 90° = PI/2<br />
                //easyer calculations!<br />
                double y = screenY*2;</p>
<p>                //distance from origin to point in ISO<br />
		double r = Math.sqrt((x*x) + (y*y));<br />
		double theta = Math.atan2(x, y);<br />
		double angle = (Math.PI/4) &#8211; theta;</p>
<p>                //length of the side of one tile (128/64 are mine)<br />
		double rr = Math.sqrt(2*64*64);</p>
<p>                //&#8217;real x&#8217; is the projection of screen distance by the angles cos<br />
		double rx = Math.floor(r* Math.cos(angle) / rr);</p>
<p>                //&#8217;real x&#8217; is the projection of screen distance by the angles sin<br />
		double ry =  Math.floor(r* Math.sin(angle) / rr);</p>
<p>		System.out.printf(&#8220;(%.0f,%.0f)\n&#8221;,rx,ry);<br />
	}</p></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Athanazio &#187; thinking about sioti</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-2397</link>
		<dc:creator>Athanazio &#187; thinking about sioti</dc:creator>
		<pubDate>Wed, 03 Sep 2008 02:27:11 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-2397</guid>
		<description>[...] my isometric efforts, I will follow my friend advice, and make plain 2D, lets see If I can make it [...]</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">[...] my isometric efforts, I will follow my friend advice, and make plain 2D, lets see If I can make it [...]</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: athanazio</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-1932</link>
		<dc:creator>athanazio</dc:creator>
		<pubDate>Sat, 21 Jun 2008 13:49:26 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-1932</guid>
		<description>hehehe Its true Lis, is almost isometric, but what made me happy on that is the fact that I figure it out how to map the screen to the points =)
but thx for pointing me that</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">hehehe Its true Lis, is almost isometric, but what made me happy on that is the fact that I figure it out how to map the screen to the points =)<br />
but thx for pointing me that</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lis</title>
		<link>http://www.athanazio.com/2008/02/21/working-with-isometric-maps/comment-page-1/#comment-1931</link>
		<dc:creator>Lis</dc:creator>
		<pubDate>Sat, 21 Jun 2008 12:12:49 +0000</pubDate>
		<guid isPermaLink="false">http://athanazio.wordpress.com/?p=68#comment-1931</guid>
		<description>What you created isn&#039;t an isometric view - with computers the angle is different from the actual isometric angle. You have to go two pixels across, one pixel up every time to create an isometric line.</description>
		<content:encoded><![CDATA[<div id="HOTWordsTxt" name="HOTWordsTxt">What you created isn&#8217;t an isometric view &#8211; with computers the angle is different from the actual isometric angle. You have to go two pixels across, one pixel up every time to create an isometric line.</div>
]]></content:encoded>
	</item>
</channel>
</rss>
