pepe
pepe

Reputation: 9919

Find a point on a line perpendicular and through the middle of another line

In the diagram below

Do you know how this can be solved? Glad to provide additional info if needed.

enter image description here

Upvotes: 1

Views: 759

Answers (1)

knedlsepp
knedlsepp

Reputation: 6084

It's a simple use of the cross-product and scalar-product:

You first find a normal vector N of the plane spanned by those points. This is done via the cross product of B-A and O-A. Then the directional vector AP can be found as the cross product of N and B-A. For finding the angle we take the scalar product of the normalized vectors AP and AO, apply acos and convert to degrees.

%// Example data
A = [0,0,0];
B = [-1,0,0];
C = [1,0,0];
O = [-1,-1,0];
%// Computation
normalize = @(X) X/norm(X);
N = normalize(cross(B-A,O-A));
AP = cross(N,B-A);
phi = (180/pi)*acos(dot(normalize(AP),normalize(O-A)))

Upvotes: 4

Related Questions