Subversion Repositories gelsvn

Rev

Rev 595 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
595 jab 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
 
2 bj 11
#ifndef __CGLA__ARITHVEC3INT_H__
12
#define __CGLA__ARITHVEC3INT_H__
13
 
14
#include "ArithVecInt.h"
15
 
16
namespace CGLA {
17
 
18
	template<class T, class V>
19
	class ArithVec3Int: public ArithVecInt<T,V,3>
20
	{
21
	public:
22
 
23
		/// Construct a 3D int vector.
24
		ArithVec3Int(T a, T b, T c): ArithVecInt<T,V,3>(a,b,c) {}
25
 
26
		/// Construct a 3D int vector.
27
		ArithVec3Int() {}
28
 
29
	};
30
 
31
	/// Returns cross product of arguments
32
	template<class T, class V>
33
	inline V cross( const ArithVec3Int<T,V>& x, 
34
									const ArithVec3Int<T,V>& y ) 
35
	{
36
		return V( x[1] * y[2] - x[2] * y[1], 
37
							x[2] * y[0] - x[0] * y[2], 
38
							x[0] * y[1] - x[1] * y[0] );
39
	}
40
 
41
}
42
 
43
#endif
44