0
votes

I've been looking for a day now, and could not find help on what I need.

There's lots of suggestions and solutions regarding -lines- and -planes-, but there's little about -segments- and -planes- In particular, there's nothing regarding planes defined through a normal and a point. the general reference for a plane is through a normal and a distance, while my plane is a 3d point and a normal.

Basically, I need help understanding what I need to determine the on-plane intersection of the segment formed by two points.

Vector3 point1 = new Vector3 (-4,-5,-6);
Vector3 point2 = new Vector3 (5,3,2); 
                           //normal            //point
Plane plane1 = new plane ( new Vector3(0,0,1), new Vector3(4,2,1));

Vector3 intersection = ???

Determining if there's intersection is relatively easy thanks to dot product and point distances, but despite my efforts the intersection formula eludes me, since things are evidently different for a 'normal- distance' plane definition and a 'normal, point' plane definition like the one I have, given that the results I get are not 'on the plane' but rather significantly in front and behind of it.

Any help appreciated.

Thanks.

1

1 Answers

1
votes

You can convert the point+normal into normal+distance

Let N be the normal (normalized to unit length). The distance d = -n.p (dot product with the point you have). See here http://mathworld.wolfram.com/Plane.html

The segment is not really much different than the line. You can do the basic thing for the equation of line and plane intersection and then try to if the point, or set of points, the plane intersect belong also to your segment. There might be a more efficient way of doing it, but the easy way is to just add a check to see if the intersection result you get with a generic line contains the segment.