#### Archived

This topic is now archived and is closed to further replies.

# Line / Plane intersection

This topic is 6070 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I desperately need someone to explain to me how I can find where a line and plane intersects (If I have the coordinates of the line, the normal of the plane, and a coordinate of the plane). It''s for my BSP Compiler. I''ve made posts on newsgroups and other things, and no one has been able to help me at all. Thanks.

##### Share on other sites
d = -plane.normal.i * plane.coordinate.x - plane.normal.j * plane.coordinate.y - plane.normal.k * plane.coordinate.z;

a = ( -plane.normal.i * line.coordinate.x - plane.normal.j * line.coordinate.y - plane.normal.k * line.coordinate.z - d) / plane.normal.i * line.vector.i + plane.normal.j * line.vektor.j + plane.normal.k * line.vektor.k);

if (a < 0) NO_INTERSECTION;

intersection.x = line.coordinate.x + line.vector.i * a;
intersection.y = line.coordinate.y + line.vector.j * a;
intersection.z = line.coordinate.z + line.vector.k * a;

##### Share on other sites
first before you calc intersection point on plane
you need to ensure, your line is really intersecting
with plane, you can do it that way, i''ve no time to
explain how to calculate exact intersection point on plane,
but it''s not tough job and very standard.

/*assumes precalculated plane''s D and normal*/

float distance1, distance2;
distance1 =distance2 =0;

distance1 = DOTPRODUCT (normal, line1)+D;
distance2 = DOTPRODUCT (normal, line2)+D;

if (distance1*distance2 >=0) { return 0; } /*no intersection occured*/
return 1;
/*yes*/

##### Share on other sites
thanks for the posts... Im assuming with the anonymous poster, that ijk is xyz.....

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631782
• Total Posts
3002325
×