i'm tryng to find a way to compute the coordinates of the point of intersection between a cube and a segment in 3D. I know the dimension of the cube, which is centered in the origin, and the point (x,y,z) which individuates the segment in the space connected to the origin (0,0,0). I was able to solve graphically the problem by using a funcion "plotcube" found in the Matlab forum, but from the graph i'm not able to compute the coordinates of the point of intersection between the cube and the segment. How can i do that?
P.S. the segment which i'm referring to is the red one in the graph, the blue ones are just the axes centered in the origin.