Creating a plane/disk perpendicular to a line segment

Written by Paul Bourke
February 1997

Contribution by Dan Wills in MEL (Maya Embedded Language): source2.mel.


There are a number of 3D geometric construction techniques that require a coordinate system perpendicular to a line segment, some examples are:

A straightforward method will be described which facilitiates each of these. The key is deriving a pair of orthonormal vectors on the plane perpendicular to a line segment P1, P2.

Procedure

1. Choose any point P randomly which doesn't lie on the line through P1 and P2
2. Calculate the vector R as the cross product between the vectors P - P1 and P2 - P1. This vector R is now perpendicular to P2 - P1. (If R is 0 then 1. wasn't satisfied)
3. Calculate the vector S as the cross product between the vectors R and P2 - P1. This vector S is now perpendicular to both R and the P2 - P1.
4. The unit vectors ||R|| and ||S|| are two orthonormal vectors in the plane perpendicular to P2 - P1.

Points on the plane through P1 and perpendicular to n = P2 - P1 can be found from linear combinations of the unit vectors R and S, for example, a point Q might be

A disk of radius r, centered at P1, with normal n = P2 - P1 is described as follows

Example

The following is a simple example of a disk and the C source stub that generated it.