How to calculate intersection point of polyhedron and a line?

83 Views Asked by At

this is my first time in this forum. Please guide me if I do something wrong.

I need to make an algorithm to calculate intersection point of polyhedron and a line (in 3D space). The line is made from a point (say point A) inside polyhedron and origin (0,0,0). The intersection of interest (from two possible intersection) is the closest one to point A.

I know how to calculate the intersection of line and plane. My problem is how to get the plane of interest. Given polyhedron corner point coordinates, how to determine which 3 corner points which make plane to calculate the intersection?

My idea is using polar coordinate. So maybe I can find 3 corner points which have closest polar angles to point A, but I don't know how to calculate this for spherical polar coordinate (which has two angles for each point).

Thank you in advance.