Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members

# Geometry.cc

Go to the documentation of this file.
```00001 /*
00002     File:           Geometry.cc
00003
00004     Function:       Implements Geometry.h
00005
00006     Author(s):      Andrew Willmott
00007
00008     Copyright:      (c) 1995-2000, Andrew Willmott
00009
00010     Notes:
00011
00012 */
00013
00014 #include "gcl/Geometry.h"
00015 #include "gcl/VecUtil.h"
00016
00017 #include <stdarg.h>
00018
00019 IndexList Indexes(Int first, ...)
00020 {
00021     IndexList result;
00022     va_list ap;
00023
00024     va_start(ap, first);
00025
00026     while (first != IDX_END)
00027     {
00028         result.Append(first);
00029         first = va_arg(ap, int);
00030     }
00031
00032     va_end(ap);
00033
00034     return(result);
00035 }
00036
00037 Transform Align(const Vector &xAxis, const Vector &yAxis, const Vector &zAxis)
00038 {
00039     Transform   align;
00040
00041     // Create a matrix which will align scene with the xAxis, yAxis, zAxis
00042     align[0] = MVector4(xAxis[0], yAxis[0], zAxis[0], 0.0);
00043     align[1] = MVector4(xAxis[1], yAxis[1], zAxis[1], 0.0);
00044     align[2] = MVector4(xAxis[2], yAxis[2], zAxis[2], 0.0);
00045     align[3] = vl_w;
00046 #ifdef VL_ROW_ORIENT
00047     align = trans(align);
00048 #endif
00049
00050     return(align);
00051 }
00052
00053 Transform AlignToDir(const Vector &dir)
00054 {
00055     Vector  x, y, z;
00056
00057     if (sqrlen(dir) == 0.0)
00058         return(vl_I);
00059     y = norm(dir);
00060     x = norm(FindOrthoVector(y));
00061     z = cross(x, y);
00062
00063     return(Align(x, y, z));
00064 }
00065
00066
00067 #ifdef CL_TMPL_INST
00068 template class Array<Vector>;
00069 #endif
```

Generated at Sat Aug 5 00:16:59 2000 for Graphics Class Library by 1.1.0 written by Dimitri van Heesch, © 1997-2000