How to locate touched tile in an isometric tile map?

Here is what I’ve been using for my own isometric engine. The tiles are setup like this image: http://garrypettet.com/images/forum_images/5%20col%20x%205%20rows.png with the tile (0,0) sitting on world coordinate (0,0) for simpler maths.

vec2f gridToWorld(vec2i gridpos)
{
    return  vec2f( (gridpos.x * XSPACING) - (gridpos.y * XSPACING) ,  -(gridpos.x * YSPACING) - (gridpos.y * YSPACING)  ); 
}

vec2i worldToGrid(vec2f worldpos)
{
    vec2i ret;
    ret.x = (int)( (-worldpos.y + (worldpos.x/2.0) ) / XSPACING + 0.5f);
    ret.y = (int)( (-worldpos.y - (worldpos.x/2.0) ) / XSPACING + 0.5f);
    return ret;
}