A Distance-based Technique for non-Manhattan Layout Analysis