Code covered by the BSD License  

Highlights from
straight line and plane intersection

5.0

5.0 | 3 ratings Rate this file 24 Downloads (last 30 days) File Size: 1.75 KB File ID: #17751

straight line and plane intersection

by Nassim Khaled

 

26 Nov 2007 (Updated 27 Nov 2007)

plane_line_intersect computes the intersection of a plane and a segment(or

| Watch this File

File Information
Description

%plane_line_intersect computes the intersection of a plane and a segment (or a straight line)
% Inputs:
% n: normal vector of the Plane
% V0: any point that belongs to the Plane
% P0: end point 1 of the segment P0P1
% P1: end point 2 of the segment P0P1
%
%Outputs:
% I is the point of interection
% Check is an indicator:
% 0 => disjoint (no intersection)
% 1 => the plane intersects P0P1 in the unique point I
% 2 => the segment lies in the plane
% 3=>the intersection lies outside the segment P0P1
%
% Example:
% Determine the intersection of following the plane x+y+z+3=0 with the segment P0P1:
% The plane is represented by the normal vector n=[1 1 1]
% and an arbitrary point that lies on the plane, ex: V0=[1 1 -5]
% The segment is represented by the following two points
% P0=[-5 1 -1]
%P1=[1 2 3]
% [I,check]=plane_line_intersect([1 1 1],[1 1 -5],[-5 1 -1],[1 2 3]);

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
01 Mar 2010 Chee Hou Kok

Dear Mr. Nassim Khaled,

Is it possible to find out whether a straight line is intersecting a rectangle using your file?

Say, I have a line made of points (0,0) and (5,5) and a rectangle of points (1,1) (3,1) (3,4) and (1,4). How do know that the line is intersecting the rectangle?

23 May 2011 Yasmin

I was using symbolic math toolbox earlier to solve this problem which doesnot get compiled when I use MCR. I used this code and it worked!!! Thanks so much!!

27 May 2011 Marwan N

thnx a lot man....i had a tough job battering my brains to get this job done....g8 work!!

05 Jan 2012 Bart Ribbens  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
straight line Nassim Khaled 22 Oct 2008 09:36:53
plane intersection Nassim Khaled 22 Oct 2008 09:36:53
3d Nassim Khaled 22 Oct 2008 09:36:53
space Nassim Khaled 22 Oct 2008 09:36:53

Contact us at files@mathworks.com