[go: up one dir, main page]

Menu

[r6199]: / trunk / ethereal / vec.h  Maximize  Restore  History

Download this file

66 lines (60 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _3DMANIP_H_
#define _3DMANIP_H_
#include <math.h>
#define QFLOAT float
#define XSQRT sqrtf
#define XVector Vector
#define YVector QVector
#include "xvector.h"
#undef QFLOAT
#undef XVector
#undef YVector
#undef XSQRT
#define QFLOAT double
#define XSQRT sqrt
#define XVector QVector
#define YVector Vector
#include "xvector.h"
#undef XSQRT
#undef QFLOAT
#undef XVector
#undef YVector
inline Vector QVector::operator =(const Vector &a) {
i=a.i;
j=a.j;
k=a.k;
return a;
}
inline QVector::QVector (const Vector &a) {
i=a.i;
j=a.j;
k=a.k;
}
inline QVector Vector::operator = (const QVector &a) {
i=a.i;
j=a.j;
k=a.k;
return a;
}
inline Vector::Vector (const QVector &a) {
i=a.i;
j=a.j;
k=a.k;
}
inline QVector Vector::Cast() const{
return QVector (i,j,k);
}
inline Vector QVector::Cast() const{
return Vector (i,j,k);
}
template <class XVector, class DoItType> inline void for_each_vector (const XVector &first, const XVector &last, DoItType DoIt, XVector increment=XVector(1.0,1.0,1.0)) {
XVector xvec (first.i, first.j, first.k); //Just in case.
for (xvec.k=first.k;xvec.k<=last.k;xvec.k+=increment.k) {
for (xvec.j=first.j;xvec.j<=last.j;xvec.j+=increment.j) {
for (xvec.i=first.i;xvec.i<=last.i;xvec.i+=increment.i) {
DoIt(xvec);
}
}
}
}
#endif