Is there a mathematical formula for Gestalt’s Law of Proximity?

I would like to know if there are any math formulas that define the Gestalt's Law of Proximity. example of law of proximity

For example, in the picture above, at what distance of Y would the 4th square be perceived not a part of the group?