Subversion Repositories gelsvn

Rev

Rev 461 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 461 Rev 595
-
 
1
/* ----------------------------------------------------------------------- *
-
 
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
-
 
3
 * Copyright (C) the authors and DTU Informatics
-
 
4
 * For license and list of authors, see ../../doc/intro.pdf
-
 
5
 * ----------------------------------------------------------------------- */
-
 
6
 
-
 
7
/** @file ArithVec3Int.h
-
 
8
  * Abstract 3D integer vector class.
-
 
9
  */
-
 
10
 
1
#ifndef __CGLA__ARITHVEC3INT_H__
11
#ifndef __CGLA__ARITHVEC3INT_H__
2
#define __CGLA__ARITHVEC3INT_H__
12
#define __CGLA__ARITHVEC3INT_H__
3
 
13
 
4
#include "ArithVecInt.h"
14
#include "ArithVecInt.h"
5
 
15
 
6
namespace CGLA {
16
namespace CGLA {
7
 
17
 
8
	template<class T, class V>
18
	template<class T, class V>
9
	class ArithVec3Int: public ArithVecInt<T,V,3>
19
	class ArithVec3Int: public ArithVecInt<T,V,3>
10
	{
20
	{
11
	public:
21
	public:
12
 
22
 
13
		/// Construct a 3D int vector.
23
		/// Construct a 3D int vector.
14
		ArithVec3Int(T a, T b, T c): ArithVecInt<T,V,3>(a,b,c) {}
24
		ArithVec3Int(T a, T b, T c): ArithVecInt<T,V,3>(a,b,c) {}
15
 
25
 
16
		/// Construct a 3D int vector.
26
		/// Construct a 3D int vector.
17
		ArithVec3Int() {}
27
		ArithVec3Int() {}
18
		
28
		
19
	};
29
	};
20
 
30
 
21
	/// Returns cross product of arguments
31
	/// Returns cross product of arguments
22
	template<class T, class V>
32
	template<class T, class V>
23
	inline V cross( const ArithVec3Int<T,V>& x, 
33
	inline V cross( const ArithVec3Int<T,V>& x, 
24
									const ArithVec3Int<T,V>& y ) 
34
									const ArithVec3Int<T,V>& y ) 
25
	{
35
	{
26
		return V( x[1] * y[2] - x[2] * y[1], 
36
		return V( x[1] * y[2] - x[2] * y[1], 
27
							x[2] * y[0] - x[0] * y[2], 
37
							x[2] * y[0] - x[0] * y[2], 
28
							x[0] * y[1] - x[1] * y[0] );
38
							x[0] * y[1] - x[1] * y[0] );
29
	}
39
	}
30
 
40
 
31
}
41
}
32
 
42
 
33
#endif
43
#endif
34
 
44
 
35
 
45