I'm trying to calculate the distance between a central point on a cube and anywhere on the surface of the cube, depending on the location of a second 3D point.
I have two vertices in 3D;
Q is the centre of the cube,
P is a random point outside of the cube. I also have a known size of the cube, where distance across is
If I have the normalised vector of
u, which is
Q->P, how do I calculate the distance from the centre to where it hits the surface of the cube? I could not find the answer to this anywhere,on the Stack Exchange.