Helps if our screen to iso-space transformation is accurate.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@971 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2010-08-10 22:48:27 +00:00
parent 57f020afb8
commit 4a60bbe64a
@@ -21,11 +21,30 @@ public class MisoMetricsTransformation implements IAxonometricTransformation
var zx :int = int(Math.floor(screenPt.x / _metrics.tilewid));
var zy :int = int(Math.floor(screenPt.y / _metrics.tilehei));
// these are the screen coordinates of the tile's top
var ox :int = (zx * _metrics.tilewid);
var oy :int = (zy * _metrics.tilehei);
// these are the tile coordinates
tpos.x = zy + zx;
tpos.y = zy - zx;
tpos.z = 0;
// these are the tile coordinates
tpos.x = zy + zx; tpos.y = zy - zx;
// now determine which of the four tiles our point occupies
var dx :int = screenPt.x - ox;
var dy :int = screenPt.y - oy;
if (Math.round(_metrics.slopeY * dx + _metrics.tilehei) <= dy) {
tpos.x += 1;
}
if (Math.round(_metrics.slopeX * dx) > dy) {
tpos.y -= 1;
}
return tpos;
}