@partikla86 To get a direction vector for a line either find a vector between 2 points that you know are on the line, or if you know a line parallel to it then you can use that parallel line's direction vector or any multiple of it.
The plane's equation is in scalar or Cartesian form so the [2,-3,1] vector is perpendicular to the plane. The direction vector of the line [3,6,-4] is parallel to the line. If the dot product of the line and the normal from the plane was equal to zero, then the line would run parallel to the plane. Since the dot product of the normal and direction vector isn't 0 then the line does not run parallel to the plane, so it must intersect the plane somewhere. Hope this helps, Al.
Hi! It has been 30+ years since I learned 3D intersections of lines and planes. With your videos I am once again able to find the point of intersection of lines and planes. Now, assuming someone drew a non right angle parallelogram on the plane. Is there a standard mechanism to determine whether the point of intersection is within that area of the plane? Fyi, for self edification I've written a 2D ray tracing program that I am trying to extend to 3D. The problem I'm foreseeing is if not all of all walls are right/plumb/rectangular, how can I detect whether the ray has hit the wall, or just the plane outside beyond the area of the wall on the plane. Any help would be greatly appreciated. Thanks, Don
Very interesting problem. let me make sure I understand your problem to solve before I respond. We have a parallelogram lying in a plane and want to find if some random line intersects the plane inside the parallelogram, through one of the sides of the parallelogram or outside the parallelogram. Is that correct?
Math not being my strong point I'm likely to get the terminology wrong but ill try to explain. One defines 4 points in 3D space. These are the 4 corners of a wall. These 4 points also define a plane in space. Somewhere there is a source emitting rays and I first want to determine if the ray hit the plane, and if it does, find the (x.y.z) point of intersection on the plane I'm good to here. The tricky part is knowing whether the point of intersection hits the wall, or another part of the plane. If the wall is rectangular, I think it is not too difficult, you can just compare if x,y,z of point is between min x, max x, min y, max y, min z, max z of the 4 points of the 4 corners of the wall. But if the wall is not rectangular I'm not sure how to figure this out. For instance, what if * is the point of intersection and the wall looks like this: ----------- \ \ \ \ *\ \ \ \ \ \ ------------ By eye I can see the point of intersection is to the left of the wall, but because there is a corner further left of the point, how do I determine with a program (especially in 3D space) whether the ray hit the wall or not... I just thought of another analogy. Think of a dart board on a wall. Did the ray hit the dart board (inside the 4 points) or did it just hit the wall. 😀 Does this expansion and picture help? Thanks, Don
Having slept on it I think I have come up with 2 answers that I will call the math answer and the programming answer. The "math" answer is: The given points on a plane are a, b, c, and d. These create line segments ab, bc, cd and da that define the "target". And let's say we have found a point P on the plane from a ray that intersected the plane. As long as the shape of the target is "regular" (discussed below) I think point P is inside the target if none of the lines Pa, Pb, Pc, Pd intersect any of the lines ab, bc, cd, da (allowing for the special case where any of the lines are the same line.) Is this correct? Now the "programming" answer (and this is really the original problem I was foreseeing.) In math a line is infinitely narrow. In computers, due to floating point rounding errors, when calculating the x, y, z coordinates of point P, rounding errors could make it such that while line Pa should intersect with (for instance) line bc, due to rounding errors when doing the floating point math on a computer, the computer calculation might say they do not intersect. I think the solution to this is instead to trying to calculate whether the lines intersect I think I need to calculate the minimum distance between all the lines Pa, Pb, Pc, and Pd, and all the lines ab, bc, cd, and da. Then I think if any of those distances are less than some "small" value, assume that the 2 lines intersect and that point P is outside the "target". Is this correct and/or do you see any easier/better solutions? Re: "regular" target shapes. I think the answers above will work for "regular" shapes, like parallelograms, rhombuses (or even circles), but not for "irregular shapes" (with bites taken out of them) like the following. Note: I've used dots to try to show straight lines ab and ad. Note: the * is point P a . . . . . . . . * . . . . . b . . d c . While the * (point P) is between lines ab and ad and is inside the target, the line Pc crosses line ab, so the solutions above would say P is not inside the target. So the solutions above would not work for shapes like this. (So I will add a constraint that shapes like this are not allowed. :-) ) Instead of "irregular" is there a proper name for shapes like this? Any comments / suggestions? Thanks, Don P.S. I studied intersections of 3D lines and surfaces in what was then grade 13 math in Ontario back in the 80s. That was a long time ago which is why this is all so fuzzy for me now.
I began my teaching career teaching OAC math courses (or grade 13) so I remember that and we still teach those topics in one of the grade 12 university stream courses. The irregular shape you drew last is called a convex polygon since angle abc is larger than 180 degrees. I thought of another solution last evening. If you find the equations for the planes through the pairs of points that are perpendicular to the plane a,b,c & d are on, those 4 planes will form an infinitely long 'corridor". Sort of like an infinitely long box. If you find the equation of the line for the shortest distance between opposite planes that go through point P, then if the distance from P to each opposite plane sums to the distance along that line segment, then P is between the planes. I'm not 100% sure yet how you'd write the program to determine which planes are opposite yet. My personal email is alrichards314@gmail.com, if it would be easier to correspond that way, rather than through TH-cam. It might be easier to because I could attached a diagram of my idea and it might make more sense.
@partikla86 To get a direction vector for a line either find a vector between 2 points that you know are on the line, or if you know a line parallel to it then you can use that parallel line's direction vector or any multiple of it.
Thx a lot Richard! Very clear and straightforward explaination!
The plane's equation is in scalar or Cartesian form so the [2,-3,1] vector is perpendicular to the plane. The direction vector of the line [3,6,-4] is parallel to the line. If the dot product of the line and the normal from the plane was equal to zero, then the line would run parallel to the plane. Since the dot product of the normal and direction vector isn't 0 then the line does not run parallel to the plane, so it must intersect the plane somewhere. Hope this helps, Al.
Excellent Richard, excellent!!!!!!!
Precise explanation sir. Thanks
How can I get the coordinates of the 2 line, if only equations are given. since coordinates are necessary to get the intersection
Great tutorial thanks a lot.
Hi!
It has been 30+ years since I learned 3D intersections of lines and planes. With your videos I am once again able to find the point of intersection of lines and planes.
Now, assuming someone drew a non right angle parallelogram on the plane. Is there a standard mechanism to determine whether the point of intersection is within that area of the plane?
Fyi, for self edification I've written a 2D ray tracing program that I am trying to extend to 3D. The problem I'm foreseeing is if not all of all walls are right/plumb/rectangular, how can I detect whether the ray has hit the wall, or just the plane outside beyond the area of the wall on the plane.
Any help would be greatly appreciated.
Thanks,
Don
Very interesting problem. let me make sure I understand your problem to solve before I respond. We have a parallelogram lying in a plane and want to find if some random line intersects the plane inside the parallelogram, through one of the sides of the parallelogram or outside the parallelogram. Is that correct?
Math not being my strong point I'm likely to get the terminology wrong but ill try to explain.
One defines 4 points in 3D space. These are the 4 corners of a wall. These 4 points also define a plane in space. Somewhere there is a source emitting rays and I first want to determine if the ray hit the plane, and if it does, find the (x.y.z) point of intersection on the plane I'm good to here.
The tricky part is knowing whether the point of intersection hits the wall, or another part of the plane. If the wall is rectangular, I think it is not too difficult, you can just compare if x,y,z of point is between min x, max x, min y, max y, min z, max z of the 4 points of the 4 corners of the wall.
But if the wall is not rectangular I'm not sure how to figure this out. For instance, what if * is the point of intersection and the wall looks like this:
-----------
\ \
\ \
*\ \
\ \
\ \
------------
By eye I can see the point of intersection is to the left of the wall, but because there is a corner further left of the point, how do I determine with a program (especially in 3D space) whether the ray hit the wall or not...
I just thought of another analogy. Think of a dart board on a wall. Did the ray hit the dart board (inside the 4 points) or did it just hit the wall. 😀
Does this expansion and picture help?
Thanks,
Don
I'm pretty sure I understand what you are asking/looking for. Let me think on this and get back to you
Having slept on it I think I have come up with 2 answers that I will call the math answer and the programming answer.
The "math" answer is: The given points on a plane are a, b, c, and d.
These create line segments ab, bc, cd and da that define the "target".
And let's say we have found a point P on the plane from a ray that intersected the plane.
As long as the shape of the target is "regular" (discussed below) I think point P is inside the target if none of the lines Pa, Pb, Pc, Pd intersect any of the lines ab, bc, cd, da (allowing for the special case where any of the lines are the same line.) Is this correct?
Now the "programming" answer (and this is really the original problem I was foreseeing.) In math a line is infinitely narrow. In computers, due to floating point rounding errors, when calculating the x, y, z coordinates of point P, rounding errors could make it such that while line Pa should intersect with (for instance) line bc, due to rounding errors when doing the floating point math on a computer, the computer calculation might say they do not intersect. I think the solution to this is instead to trying to calculate whether the lines intersect I think I need to calculate the minimum distance between all the lines Pa, Pb, Pc, and Pd, and all the lines ab, bc, cd, and da. Then I think if any of those distances are less than some "small" value, assume that the 2 lines intersect and that point P is outside the "target". Is this correct and/or do you see any easier/better solutions?
Re: "regular" target shapes. I think the answers above will work for "regular" shapes, like parallelograms, rhombuses (or even circles), but not for "irregular shapes" (with bites taken out of them) like the following.
Note: I've used dots to try to show straight lines ab and ad.
Note: the * is point P
a .
. .
. .
. .
. * .
. .
. .
b . . d
c .
While the * (point P) is between lines ab and ad and is inside the target, the line Pc crosses line ab, so the solutions above would say P is not inside the target. So the solutions above would not work for shapes like this. (So I will add a constraint that shapes like this are not allowed. :-) )
Instead of "irregular" is there a proper name for shapes like this?
Any comments / suggestions?
Thanks,
Don
P.S. I studied intersections of 3D lines and surfaces in what was then grade 13 math in Ontario back in the 80s. That was a long time ago which is why this is all so fuzzy for me now.
I began my teaching career teaching OAC math courses (or grade 13) so I remember that and we still teach those topics in one of the grade 12 university stream courses.
The irregular shape you drew last is called a convex polygon since angle abc is larger than 180 degrees.
I thought of another solution last evening. If you find the equations for the planes through the pairs of points that are perpendicular to the plane a,b,c & d are on, those 4 planes will form an infinitely long 'corridor". Sort of like an infinitely long box. If you find the equation of the line for the shortest distance between opposite planes that go through point P, then if the distance from P to each opposite plane sums to the distance along that line segment, then P is between the planes.
I'm not 100% sure yet how you'd write the program to determine which planes are opposite yet. My personal email is alrichards314@gmail.com, if it would be easier to correspond that way, rather than through TH-cam. It might be easier to because I could attached a diagram of my idea and it might make more sense.
Great tut
excellent... thnx..
Excellent! :]