Here's what I have:
-- for a plane defined by coordinates (Px1, Py1, Pz1), (Px2, Py2, Pz2), and (Px3, Py3, Pz3)
-- and a line defined by coordinates (Lx1, Ly1, Lz1), (Lx2, Ly2, Lz2)
-- find the X, Y, and Z coordinates at which they intersect
-- first get 2 vectors along the plane
-- ("PV1x" stands for Plane Vector #1, X-coordinate)
PV1x = Px2 - Px1
PV1y = Py2 - Py1
PV1z = Pz2 - Pz1
PV2x = Px3 - Px1
PV2y = Py3 - Py1
PV2z = Pz3 - Pz1
-- now find the cross product
-- PV1 X PV2 = normal vector!
i = (PV1y * PV2z) - (PV1z * PV2y)
j = (PV1z * PV2x) - (PV1x * PV2z)
k = (PV1x * PV2y) - (PV1y * PV2x)
-- define d
planex = i
planey = j
planek = k
d = (i * PV1x) + (j * PV1y) + (k * PV1z)
-- for the line, calculate tx, ty, tz
tx = Lx2 - Lx1
ty = Ly2 - Ly1
tz = Lz2 - Lz1
-- calculate t
t = (i * (tx + PV1x)) + (j * (ty + PV1y)) + (k * (tz + PV1z))
-- calculate intersection coordinates
intersectX = t * tx
intersectY = t * ty
intersectZ = t * tz
It doesn't work perfectly. There's something wrong. But what..? :>