Subversion Repositories gelsvn

Rev

Rev 2 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 461
1
#ifndef __CGLA__ARITHVEC3INT_H__
1
#ifndef __CGLA__ARITHVEC3INT_H__
2
#define __CGLA__ARITHVEC3INT_H__
2
#define __CGLA__ARITHVEC3INT_H__
3
 
3
 
4
#include "ArithVecInt.h"
4
#include "ArithVecInt.h"
5
 
5
 
6
namespace CGLA {
6
namespace CGLA {
7
 
7
 
8
	template<class T, class V>
8
	template<class T, class V>
9
	class ArithVec3Int: public ArithVecInt<T,V,3>
9
	class ArithVec3Int: public ArithVecInt<T,V,3>
10
	{
10
	{
11
	public:
11
	public:
12
 
12
 
13
		/// Construct a 3D int vector.
13
		/// Construct a 3D int vector.
14
		ArithVec3Int(T a, T b, T c): ArithVecInt<T,V,3>(a,b,c) {}
14
		ArithVec3Int(T a, T b, T c): ArithVecInt<T,V,3>(a,b,c) {}
15
 
15
 
16
		/// Construct a 3D int vector.
16
		/// Construct a 3D int vector.
17
		ArithVec3Int() {}
17
		ArithVec3Int() {}
18
 
-
 
19
		/** Get the vector in spherical coordinates.
-
 
20
				The first argument (theta) is inclination from the vertical axis.
-
 
21
				The second argument (phi) is the angle of rotation about the vertical 
-
 
22
				axis. The third argument (r) is the length of the vector. */
-
 
23
		void get_spherical( T&, T&, T& ) const;
-
 
24
 
-
 
25
		/** Assign the vector in spherical coordinates.
-
 
26
				The first argument (theta) is inclination from the vertical axis.
-
 
27
				The second argument (phi) is the angle of rotation about the vertical 
-
 
28
				axis. The third argument (r) is the length of the vector. */
-
 
29
		void set_spherical( T, T, T);
-
 
30
		
18
		
31
	};
19
	};
32
 
20
 
33
	/// Returns cross product of arguments
21
	/// Returns cross product of arguments
34
	template<class T, class V>
22
	template<class T, class V>
35
	inline V cross( const ArithVec3Int<T,V>& x, 
23
	inline V cross( const ArithVec3Int<T,V>& x, 
36
									const ArithVec3Int<T,V>& y ) 
24
									const ArithVec3Int<T,V>& y ) 
37
	{
25
	{
38
		return V( x[1] * y[2] - x[2] * y[1], 
26
		return V( x[1] * y[2] - x[2] * y[1], 
39
							x[2] * y[0] - x[0] * y[2], 
27
							x[2] * y[0] - x[0] * y[2], 
40
							x[0] * y[1] - x[1] * y[0] );
28
							x[0] * y[1] - x[1] * y[0] );
41
	}
29
	}
42
 
30
 
43
}
31
}
44
 
32
 
45
#endif
33
#endif
46
 
34
 
47
 
35