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

vec.h File Reference

#include <math.h>
#include "xvector.h"

Include dependency graph for vec.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define QFLOAT   float
#define XSQRT   sqrtf
#define XVector   Vector
#define YVector   QVector
#define QFLOAT   double
#define XSQRT   sqrt
#define XVector   QVector
#define YVector   Vector

Functions

template<class XVector, class DoItType> void forEach3dVector (XVector first, XVector last, DoItType DoIt, XVector increment)
 forEach3dvector will cycle through all the possible Vectors in a given region, calling DoIt's () operator on each Vector. More...

template<class XVector, class DoItType> void forEach2dVector (XVector first, XVector last, DoItType DoIt, XVector increment)
 for_each_2d_vector will cycle through all the possible Vectors in a given 2-dimensional region, calling DoIt's () operator on each Vector. More...


Define Documentation

#define QFLOAT   double
 

#define QFLOAT   float
 

#define XSQRT   sqrt
 

#define XSQRT   sqrtf
 

#define XVector   QVector
 

#define XVector   Vector
 

#define YVector   Vector
 

#define YVector   QVector
 


Function Documentation

template<class XVector, class DoItType>
void forEach2dVector XVector    first,
XVector    last,
DoItType    DoIt,
XVector    increment
[inline]
 

for_each_2d_vector will cycle through all the possible Vectors in a given 2-dimensional region, calling DoIt's () operator on each Vector.

for_each_2d_vector takes in a first and a last Vector: The first contains the starting coordinates adn the last contains the ending coordinates. first and last can either be of type Vector or QVector. Increment is a Vector which specifies how much to increment all of the different values. DoIt can be of any type, and is only required to have an operator() function that takes in a Vector. NOTE: If the z (k) value is required, use the for_each_vector function instead.

00083                                                                                                                                      {
00084     first.Set(floor(first.i/increment.i)*increment.i,
00085               floor(first.j/increment.j)*increment.j,
00086               first.k);
00087     last.Set(ceil(last.i/increment.i)*increment.i,
00088               ceil(last.j/increment.j)*increment.j,
00089               last.k);
00090     XVector xvec (first);
00091     for (first.j=xvec.j;first.j<last.j;first.j+=increment.j) {
00092         for (first.i=xvec.i;first.i<last.i;first.i+=increment.i) {
00093             DoIt(first);
00094         }
00095     }
00096 }

template<class XVector, class DoItType>
void forEach3dVector XVector    first,
XVector    last,
DoItType    DoIt,
XVector    increment
[inline]
 

forEach3dvector will cycle through all the possible Vectors in a given region, calling DoIt's () operator on each Vector.

forEach3dVector takes in a first and a last Vector: The first contains the starting coordinates adn the last contains the ending coordinates. first and last can either be of type Vector or QVector. Increment is a Vector which specifies how much to increment all of the different values. DoIt can be of any type, and is only required to have an operator() function that takes in a Vector. NOTE: If the z (k) value is not needed, use the for_each_3d_vector function instead.

00059                                                                                                                                      {
00060     first.Set(floor(first.i/increment.i)*increment.i,
00061               floor(first.j/increment.j)*increment.j,
00062               floor(first.k/increment.k)*increment.k);
00063     last.Set(ceil(last.i/increment.i)*increment.i,
00064              ceil(last.j/increment.j)*increment.j,
00065              ceil(last.k/increment.k)*increment.k);
00066     XVector xvec (first);
00067     for (first.k=xvec.k;first.k<last.k;first.k+=increment.k) {
00068         for (first.j=xvec.j;first.j<last.j;first.j+=increment.j) {
00069             for (first.i=xvec.i;first.i<last.i;first.i+=increment.i) {
00070                 DoIt(first);
00071             }
00072         }
00073     }
00074 }


Generated on Mon Jul 7 21:13:50 2003 for Ethereal by doxygen1.2.15