Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Line, plane intersection Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

September 07, 1999, 05:39 PM

How can i find intersection of a line with a plane,
given plane equation and 2 end-points ?
And, where can i fine information on binary space patitioning ?

Kurt Miller

September 07, 1999, 06:18 PM

Ken wrote:
>>How can i find intersection of a line with a plane,
>>given plane equation and 2 end-points ?
>>And, where can i fine information on binary space patitioning ?

In line with what Jaap said in response to the previous question on
this message board, do people actually read any documents or articles
before asking questions? :) That's what they're there for. Boards like
these are here to help out when you have specific problems implementing
something that isn't overly documented or for comments/ideas/feedback on
something that you're working on. Answers to both of your questions can
very easily be found on this site and various others. For example, search the
resource section for "bsp".



September 07, 1999, 06:20 PM

First, i'll give you a math overhaul, then i'll give you the actual working example:

You find the parameter t of the line at the plane by the following equation:



t -> is the line parameter at the intersection
q -> is the free component in the plane equation(see below)
DP1 -> is the dot product of the beginning of the line with the plane normal
DP2 -> is the dot product of the end of the line with the plane normal

Explanation of equations:

a line segment can be defined analytically as:



P1, P2 -> the beginning and end points of the segment, respectively
t -> the parameter(a number from 0 to 1)

a plane is defined by:

Ax+By+Cz+q=0, or in vector math: Np+q=0


N -> the normal vector. N=(A, B, C)
q -> the free component(see above)

now, to put all this to work(pseudo-code, but this works, it's cut/paste-ed right out of my engine with dereferencing and all):



so much for coordinates, but you ask why didn't we just plug in the line equation into the plane equation? this is why:

// Color

// Texture

And it magically clips a line and all of its parameters to a plane! Now, if this doesn't work then make sure your t is between 0 and 1.

As to BSP-trees, here's a link to get a nice crash course in them:

This has several tutorials on interesting stuff(like radiosity), and the guy even wrote a column for flipcode. Overall this gives a great crashcourse in these areas, but you still need to do some research to actually get a live engine out of it. Like a person smarter than me said(and there's a lot of those, ohoh!) no pain no gain:)


September 08, 1999, 12:46 AM

Thanks a lot Raven, that really helped.

This thread contains 4 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.