Program: MKPERPVECT
mkperpvect: construct perpendicular vector of line through 2 points
call: n=mkperpvect(a,b);
a: (number triple)
a(1) is x coordinate of point A
a(2) is y coordinate of point A
a(3) is z coordinate of point A
b: (number triple)
coordinates of point B, analoguous to A
result: n: vector that is perpendicular to the line defined by
points A and B. (vector has unit length by constrution)
n(1) is the x coordinate
n(2) is the y coordinate
The direction of the line through A and B is defined by the difference
vector b-a.
The direction of n is then defined by the condition that the dot product
of n and b-a is zero when they are perpendicular. As additional
condition, n is required to have unit length. (two equations are needed
since a direction in a plane has to be defined)
The resulting vector is in the plane defined by the vectors from
coordinate origin to points A and B. In case you search the bisectors of
a 3D triangle, this bisector is usually NOT in the plane of that
triangle!
If the 3D triangle is ABC and you want the perpendicular bisector for
side AB, you have t shift the coordinate origin into point C, what makes
the sides AC and BC the vectors from coordinate origin to points A and B.
Martin Knapmeyer, 02.12.2004
Read M-File Source Code
eof.