INTERSECTLINEPLANE Intersection point between a 3D line and a plane.
PT = intersectLinePlane(LINE, PLANE)
Returns the intersection point of the given line and the given plane.
LINE: [x0 y0 z0 dx dy dz]
PLANE: [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2]
PT: [xi yi zi]
If LINE and PLANE are parallel, return [NaN NaN NaN].
If LINE (or PLANE) is a matrix with 6 (or 9) columns and N rows, result
is an array of points with N rows and 3 columns.
PT = intersectLinePlane(LINE, PLANE, TOL)
Specifies the tolerance factor to test if a line is parallel to a
plane. Default is 1e-14.
Example
% define horizontal plane through origin
plane = [0 0 0 1 0 0 0 1 0];
% intersection with a vertical line
line = [2 3 4 0 0 1];
intersectLinePlane(line, plane)
ans =
2 3 0
% intersection with a line "parallel" to plane
line = [2 3 4 1 2 0];
intersectLinePlane(line, plane)
ans =
NaN NaN NaN
See also:
lines3d, planes3d, points3d, clipLine3d
Package: matgeom