spatial representation algorithm