Added objectFootprintsOverlap(). It's used by the editor, but IsoUtil

seemed like the right place for it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@949 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-06 23:34:17 +00:00
parent 554d11c62b
commit 1b7b8e5737
@@ -1,5 +1,5 @@
//
// $Id: IsoUtil.java,v 1.17 2001/12/18 08:38:57 mdb Exp $
// $Id: IsoUtil.java,v 1.18 2002/02/06 23:34:17 mdb Exp $
package com.threerings.miso.scene.util;
@@ -142,6 +142,19 @@ public class IsoUtil
return boundsPoly;
}
/**
* Returns true if the footprints of the two object tiles overlap when
* the objects occupy the specified coordinates, false if not.
*/
public boolean objectFootprintsOverlap (ObjectTile tile1, int x1, int y1,
ObjectTile tile2, int x2, int y2)
{
return !(x2 > x1 - tile1.getBaseWidth() &&
x1 > x2 - tile2.getBaseWidth() &&
y2 > y1 - tile1.getBaseHeight() &&
y1 > y2 - tile2.getBaseHeight());
}
/**
* Given two points in screen pixel coordinates, return the
* compass direction that point B lies in from point A from an