All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Shapes
Distance through a cube (Posted on 2022-10-20) Difficulty: 3 of 5
Let point A be on a diagonal of one side of a cube. Let point B be on a diagonal of an adjacent side of the cube such that the two diagonals do not meet at a vertex.

Minimize the distance AB.

No Solution Yet Submitted by Jer    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
First a program to explore the territory:

range=0:.05:1 ;
z1=0; y2=1;
for t1=range
  x1=t1; y1=t1;
  fprintf('%5.3f  ',t1)
  for t2=range
    z2=t2; x2=t2;
    dist=sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2);
    fprintf(' %5.3f',dist);  
  end
  fprintf('\n');
end

where t1 and t1 are the parameters for the respective parametric equations of the two lines.

0.000   1.000 1.002 1.010 1.022 1.039 1.061 1.086 1.116 1.149 1.185 1.225 1.267 1.311 1.358 1.407 1.458 1.510 1.564 1.619 1.675 1.732
0.050   0.951 0.951 0.957 0.967 0.982 1.002 1.027 1.056 1.089 1.125 1.164 1.206 1.251 1.298 1.347 1.398 1.451 1.505 1.560 1.617 1.675
0.100   0.906 0.903 0.906 0.914 0.927 0.946 0.970 0.997 1.030 1.065 1.105 1.147 1.192 1.239 1.288 1.340 1.393 1.447 1.503 1.560 1.619
0.150   0.863 0.857 0.857 0.863 0.875 0.892 0.914 0.941 0.972 1.007 1.046 1.089 1.134 1.181 1.231 1.283 1.336 1.391 1.447 1.505 1.564
0.200   0.825 0.815 0.812 0.815 0.825 0.840 0.860 0.886 0.917 0.951 0.990 1.032 1.077 1.125 1.175 1.227 1.281 1.336 1.393 1.451 1.510
0.250   0.791 0.778 0.771 0.771 0.778 0.791 0.809 0.834 0.863 0.897 0.935 0.977 1.022 1.070 1.120 1.173 1.227 1.283 1.340 1.398 1.458
0.300   0.762 0.745 0.735 0.731 0.735 0.745 0.762 0.784 0.812 0.846 0.883 0.925 0.970 1.017 1.068 1.120 1.175 1.231 1.288 1.347 1.407
0.350   0.738 0.718 0.704 0.696 0.696 0.704 0.718 0.738 0.765 0.797 0.834 0.875 0.919 0.967 1.017 1.070 1.125 1.181 1.239 1.298 1.358
0.400   0.721 0.696 0.678 0.667 0.663 0.667 0.678 0.696 0.721 0.752 0.787 0.828 0.872 0.919 0.970 1.022 1.077 1.134 1.192 1.251 1.311
0.450   0.711 0.682 0.660 0.644 0.636 0.636 0.644 0.660 0.682 0.711 0.745 0.784 0.828 0.875 0.925 0.977 1.032 1.089 1.147 1.206 1.267
0.500   0.707 0.675 0.648 0.628 0.616 0.612 0.616 0.628 0.648 0.675 0.707 0.745 0.787 0.834 0.883 0.935 0.990 1.046 1.105 1.164 1.225
0.550   0.711 0.675 0.644 0.620 0.604 0.596 0.596 0.604 0.620 0.644 0.675 0.711 0.752 0.797 0.846 0.897 0.951 1.007 1.065 1.125 1.185
0.600   0.721 0.682 0.648 0.620 0.600 0.587 0.583 0.587 0.600 0.620 0.648 0.682 0.721 0.765 0.812 0.863 0.917 0.972 1.030 1.089 1.149
0.650   0.738 0.696 0.660 0.628 0.604 0.587 0.579 0.579 0.587 0.604 0.628 0.660 0.696 0.738 0.784 0.834 0.886 0.941 0.997 1.056 1.116
0.700   0.762 0.718 0.678 0.644 0.616 0.596 0.583 0.579 0.583 0.596 0.616 0.644 0.678 0.718 0.762 0.809 0.860 0.914 0.970 1.027 1.086
0.750   0.791 0.745 0.704 0.667 0.636 0.612 0.596 0.587 0.587 0.596 0.612 0.636 0.667 0.704 0.745 0.791 0.840 0.892 0.946 1.002 1.061
0.800   0.825 0.778 0.735 0.696 0.663 0.636 0.616 0.604 0.600 0.604 0.616 0.636 0.663 0.696 0.735 0.778 0.825 0.875 0.927 0.982 1.039
0.850   0.863 0.815 0.771 0.731 0.696 0.667 0.644 0.628 0.620 0.620 0.628 0.644 0.667 0.696 0.731 0.771 0.815 0.863 0.914 0.967 1.022
0.900   0.906 0.857 0.812 0.771 0.735 0.704 0.678 0.660 0.648 0.644 0.648 0.660 0.678 0.704 0.735 0.771 0.812 0.857 0.906 0.957 1.010
0.950   0.951 0.903 0.857 0.815 0.778 0.745 0.718 0.696 0.682 0.675 0.675 0.682 0.696 0.718 0.745 0.778 0.815 0.857 0.903 0.951 1.002
1.000   1.000 0.951 0.906 0.863 0.825 0.791 0.762 0.738 0.721 0.711 0.707 0.711 0.721 0.738 0.762 0.791 0.825 0.863 0.906 0.951 1.000



range=.6666664:.00000001:.6666668 ;
z1=0; y2=1;
for t1=range
  x1=t1; y1=t1;
  fprintf('%13.8f  ',t1)
  prev=99;
  for t2=.33333:.00000000001:.4
    z2=t2; x2=t2;
    dist=sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2);
    if dist>prev
      fprintf('%17.14f',prev,prevt2,t2);
      break
    end
    prev=dist; prevt2=t2;
  end
  fprintf('\n');
end

is a final stage in narrowing down where the solution lies. 

The t1 parameter identifies the fraction of the way along one line, and the t2 parameter for the other line.

The output shows

  fractional                       fractional
   position         minimal         position
   along one                       along other        next sample
      line          distance           line              point
   0.66666640   0.57735026919019 0.33333267658000 0.33333267659000
   0.66666641   0.57735026919046 0.33333254643000 0.33333254644000
   0.66666642   0.57735026919052 0.33333252294000 0.33333252295000
   0.66666643   0.57735026919020 0.33333267926000 0.33333267927000
   0.66666644   0.57735026919036 0.33333260144000 0.33333260145000
   0.66666645   0.57735026919067 0.33333247128000 0.33333247129000
   0.66666646   0.57735026919028 0.33333263968000 0.33333263969000
   0.66666647   0.57735026919074 0.33333245183000 0.33333245184000
   0.66666648   0.57735026919022 0.33333267926000 0.33333267927000
   0.66666649   0.57735026919029 0.33333264505000 0.33333264506000
   0.66666650   0.57735026919034 0.33333262626000 0.33333262627000
   0.66666651   0.57735026919015 0.33333272019000 0.33333272020000
   0.66666652   0.57735026919035 0.33333262626000 0.33333262627000
   0.66666653   0.57735026919065 0.33333250684000 0.33333250685000
   0.66666654   0.57735026919075 0.33333247128000 0.33333247129000
   0.66666655   0.57735026919072 0.33333248806000 0.33333248807000
   0.66666656   0.57735026919048 0.33333258400000 0.33333258401000
   0.66666657   0.57735026919057 0.33333255179000 0.33333255180000
   0.66666658   0.57735026919083 0.33333246055000 0.33333246056000
   0.66666659   0.57735026919051 0.33333258400000 0.33333258401000
   0.66666660   0.57735026919073 0.33333250282000 0.33333250283000
   0.66666661   0.57735026919026 0.33333270073000 0.33333270074000
   0.66666662   0.57735026919059 0.33333256320000 0.33333256321000
   0.66666663   0.57735026919068 0.33333253569000 0.33333253570000
   0.66666664   0.57735026919065 0.33333255179000 0.33333255180000
   0.66666665   0.57735026919058 0.33333258400000 0.33333258401000
   0.66666666   0.57735026919069 0.33333254643000 0.33333254644000
   0.66666667   0.57735026919026 0.33333273160000 0.33333273161000
   0.66666668   0.57735026919037 0.33333268597000 0.33333268598000
   0.66666669   0.57735026919012 0.33333281009000 0.33333281010000
   0.66666670   0.57735026919020 0.33333277588000 0.33333277589000
   0.66666671   0.57735026919053 0.33333263230000 0.33333263231000
   0.66666672   0.57735026919038 0.33333270208000 0.33333270209000
   0.66666673   0.57735026919058 0.33333262559000 0.33333262560000
   0.66666674   0.57735026919039 0.33333270744000 0.33333270745000
   0.66666675   0.57735026919051 0.33333266383000 0.33333266384000
   0.66666676   0.57735026919048 0.33333268396000 0.33333268397000
   0.66666677   0.57735026919062 0.33333263096000 0.33333263097000
   0.66666678   0.57735026919084 0.33333255716000 0.33333255717000
   0.66666679   0.57735026919088 0.33333255179000 0.33333255180000
   0.66666680   0.57735026919089 0.33333255179000 0.33333255180000
   
where the minimum distance seems to be 2/3 of the way from one end to the other of one of the diagonals, and 1/3 of the way from the other. Of course this depends on which end your starting from, but if you start from the ends that together are the ends of a space diagonal, its 2/3 of the way from the end of each.

The distance apart is shown as about  0.5773502691906 which Wolfram Alpha identifies as 1/sqrt(3), as we're using coordinates in the distance calculation. If the cube is a unit cube, this is the actual distance, and the location of the endpoints of the location, being referenced by it's coordinates, is sqrt(2)/3 from one end of each face diagonal and 2*sqrt(2)/3 from the other, being in a face diagonals of length sqrt(2).

  Posted by Charlie on 2022-10-20 11:12:32
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information