Calculate distance, knowing actual and perceived size What's equation would I use to calculate distance to an object, if I know it's actual and perceived size?

Say there is a line, and I know it's actual length is 65 (units), I perceive it as 62 (units).

I found various angular size equations on wikipedia and calculators like http://www.1728.org/angsize.htm however I don't know angle.
Suppose objects $X$ and $Y$ appear to be the same size. $X$ is actually of size $s_X$ and at distance $d_X$, and $Y$ is actually of size $s_Y$ and at distance $d_Y$.  Then:

$${s_X\over s_Y} = {d_X \over d_Y}$$

or equivalently:

$${d_X\over s_X} = {d_Y\over s_Y}$$

Any three of these will determine the fourth.

For example, a U.S. quarter dollar coin is about 2.5 cm in diameter. Held at a distance of 275 cm, it appears to just cover the full moon.  We can conclude that the  distance to the moon, divided by the diameter of the moon, is equal to about 275 cm / 2.5 cm = 110.

If we somehow know that the distance to the moon is around 385,000 km, then this tells us that the diameter of the moon is around 3500 km, or vice versa, but we cannot get either one without the other.

Similarly, we know from the existence of total solar eclipses that 

$${d_☉\over s_☉} = {d_☾\over s_☾} $$

where ☉ is the sun and ☾ is the moon. So we know that ${d_☉\over s_☉}\approx 110$ also. Again, if we know that the distance to the sun is about $150·10^6$ km, we can conclude that the sun's diameter is about $1.36·10^6$ km, and if we know the diameter of the sun instead we can estimate its distance. But without one we can't get the other.
I looked at a 4 inch object which measured 800 inches away. At 12 inches from my eyes it measured 1/16th of an inch. For the perception cslculation factor (12 ÷ by .06 = 200). Then (800 ÷ by 200 = 4 inches). The formula matches good.