The overlap of two unit squares is a rectangle with area 1/16.
Find the minimum distance between their centers.
for y=0:.1:1
h=1-y;
w=(1/16)/h;
x=1-w;
dist=sqrt(x^2+y^2);
fprintf('%11.9f %11.9f %15.13f\n',x,y,dist)
end
takes the center of the first square as the origin and places y in a range of possible places and computes the x value to produce an area of 1/16.
The table produced:
x y distance
0.937500000 0.000000000 0.9375000000000
0.930555556 0.100000000 0.9359132662674
0.921875000 0.200000000 0.9433204734474
0.910714286 0.300000000 0.9588537480784
0.895833333 0.400000000 0.9810796915190
0.875000000 0.500000000 1.0077822185373
0.843750000 0.600000000 1.0353328269209
0.791666667 0.700000000 1.0567573567812
0.687500000 0.800000000 1.0548252224895
0.375000000 0.900000000 0.9750000000000
-Inf 1.000000000 Inf
shows promising areas at the beginning and the end, which is understandable as x and y can be flipped. It's not symmetric as only y was guaranteed to be an integral multiple of 1/10.
The range of y values was narrowe:
for y=0.933012508-.000001:.0000001:0.933012508+.000001
h=1-y;
w=(1/16)/h;
x=1-w;
dist=sqrt(x^2+y^2);
fprintf('%11.9f %11.9f %15.13f\n',x,y,dist)
end
>> unitSquareOverlapI
0.067003927 0.933011508 0.9354143468208
0.067002534 0.933011608 0.9354143468004
0.067001141 0.933011708 0.9354143467817
0.066999748 0.933011808 0.9354143467649
0.066998355 0.933011908 0.9354143467498
0.066996963 0.933012008 0.9354143467365
0.066995570 0.933012108 0.9354143467250
0.066994177 0.933012208 0.9354143467153
0.066992784 0.933012308 0.9354143467073
0.066991391 0.933012408 0.9354143467012
0.066989999 0.933012508 0.9354143466968
0.066988606 0.933012608 0.9354143466943
0.066987213 0.933012708 0.9354143466935 *
0.066985820 0.933012808 0.9354143466945
0.066984427 0.933012908 0.9354143466973
0.066983035 0.933013008 0.9354143467019
0.066981642 0.933013108 0.9354143467082
0.066980249 0.933013208 0.9354143467164
0.066978856 0.933013308 0.9354143467263
0.066977463 0.933013408 0.9354143467380
0.066976070 0.933013508 0.9354143467515
giving the numerical value of 0.9354143466935 as the minimum distance between the centers.
|
Posted by Charlie
on 2023-05-12 13:49:09 |