.TH GenRotateMatrix 3 "IRIT Version 7.0" 
.SH NAME
GenRotateMatrix()
.SH SYNOPSIS
.nf
.ft B
geom_lib/convex.c:102

.nf
.ft B
void GenRotateMatrix(MatrixType Mat, VectorType Dir)
.SH DESCRIPTION
Routine to prepare a transformation martix to rotate such that Dir is
parallel to the Z axes. Used by the convex decomposition to rotate the
polygons to be XY plane parallel.
Algorithm: form a 4 by 4 matrix from Dir as follows:
                |  Tx  Ty  Tz  0 |   A transformation which takes the coord
                |  Bx  By  Bz  0 |  system into T, N & B as required.
 [X  Y  Z  1] * |  Nx  Ny  Nz  0 |
                |  0   0   0   1 |
N is exactly Dir, but we got freedom on T & B which must be on
a plane perpendicular to N and perpendicular between them but thats all!
T is therefore selected using this (heuristic ?) algorithm:
Let P be the axis of which the absolute N coefficient is the smallest.
Let B be (N cross P) and T be (B cross N).
.SH PARAMETERS:

Mat: To place the constructed homogeneous transformation.

Dir: To derive a transformation such that Dir goes to Z axis.
.SH FUNCTION RETURN VALUE
void
.LP
.SH ORIGIN
(C) Copyright 1989/90-97 Gershon Elber, Technion, IIT
