Reputation: 575
I have two lines (L1, L2)
in 3D.
L
has the following starting and ending coordinates : P1(x1, y1, z1)
and P2(x2, y2, z2)
.
L2
has P3(x3, y3, z3)
and P2(x2, y2, z2)
. Notice how both L1
's and L2
's P2
are same: meaning they intersect at this specific point.
Now I want to find a point P(x,y,z)
at any distance from P2 that line (P,P2)
is perpendicular to plane on which points (P1,P2,P3)
are placed.
Upvotes: 1
Views: 2040
Reputation: 416
The cross product is the way of calculating perpendicularity relative to your two lines. You need to make vectors of your line parameters, simples way would be this:
vecL1 = (x1-x2, y1-y2, z1-z2) and
vecL2 = (x3-x2, y3-y2, z3-z2)
Cross product you can google how to calculate, but in this scenario:
//Replacing the new x,y,z's with i, j, k to avoid naming confusion.
vecL3 = vecL1 x vecL2 = (j1*k2 - j2*k1, k1*i2 - k2*i1, i1*j2 - j1*i2)
Now the cross product per definition is a new vector (line) that is strictly perpendicular to the two lines/vectors you used to calculate this with. But vectors lack position, so you need to add the intersection point to this vector in order to find some point.
//i3, j3, k3 being the third vector's parameters
P3(i3+x2, j3+y2, k3+z2)
PS: The distance from your P2 to P3 is per definition (how cross products work) to the area of a parallelogram that the two lines are sides of, I found a link to illustrate:
Normalizing the 3rd vector will make the distance equal to 1 from P2.
Upvotes: 1
Reputation: 183
If you have any line AB then an arbitrary point C will always be perpendicular to AB IFF triangle ABC has no angle larger than π/2
That means there will always be a point D on line AB such that CD is perpendicular to AB
Upvotes: 0
Reputation: 4850
The cross product will give you a perpendicular vector to the plane described by two other vectors, in pseudo-code:
normal = cross(normalize(P1-P2), normalize(P3-P2))
Since you've defined P2
as the point of intersection, you can simply add this normal vector to P2
to get your perpendicular point.
Upvotes: 1