Synopsis

void mth_GetPlanePntMatrix(MTH_3DPNT p1, MTH_3DPNT p2, MTH_3DPNT p3, double *r)

Purpose

Get the matrix for a plane defined by three points

Description

Determines the matrix that rotates the plane defined by three points to the XY plane, where the vector P2P1 is defined as the x axis in the space which R defines and the point P2 is the origin of the new space.

.IP 1) 4 Take the cross product of the vectors P2P1 and P2P3. This yields the normal to the XY plane we are defining. .IP 2) 4 Take the cross product of the above calculated vector and P2P1 to determine the Y axis of the plane we are defining. .IP 3) 4 Unitize the P2P1, normal, and Y axis vectors from above. .LP

Input

p1

First plane point

p2

Second plane point

p3

Third plane point

Output

r

The 3X3 rotation matrix.