Say I have a rectangle with a center world position of x1, y1, z1, a width of w (x) and a height of h (y), together with a rotation around y and x axis -
what is the minimum distance to another point with a x2,y2,z2 position? Most related problems deal with planes, which are a different situation. I think the solution relies in reducing the problem to vectors (so you can reduce to triangles), but I can't seem to connect the dots.
Also, (how/)would the formula change if the rectangle is a box (ie. has a z/depth)?
Find the point $H$ in the rectangle plane which is nearest to $P_2=(x_2,y_2,z_2)$, that is the intersection between the plane and the perpendicular to it passing through $P_2$.
Then the problem is reduced to find the minimum distance $d_p$ on the plane between $H$ and the rectangle. The minimum distance between $P_2$ and rectangle is then $\sqrt{HP_2^2+d_p^2}$.