Subversion Repositories gelsvn

Rev

Rev 89 | Rev 501 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89 Rev 351
Line 10... Line 10...
10
 
10
 
11
			This class is also used (via typedef) for
11
			This class is also used (via typedef) for
12
			homogeneous vectors.
12
			homogeneous vectors.
13
	*/
13
	*/
14
 
14
 
15
	class Vec4d: public ArithVec4Float<float,Vec4d>
15
	class Vec4d: public ArithVec4Float<double,Vec4d>
16
	{
16
	{
17
	public:
17
	public:
18
  
18
  
19
		/// Construct a (0,0,0,0) homogenous Vector
19
		/// Construct a (0,0,0,0) homogenous Vector
20
		Vec4d(): ArithVec4Float<float,Vec4d>(0,0,0,0.0) {}
20
		Vec4d(): ArithVec4Float<double,Vec4d>(0,0,0,0.0) {}
21
 
21
 
22
		/// Construct a (0,0,0,0) homogenous Vector
22
		/// Construct a (0,0,0,0) homogenous Vector
23
		explicit Vec4d(float _a): ArithVec4Float<float,Vec4d>(_a,_a,_a,_a) {}
23
		explicit Vec4d(double _a): ArithVec4Float<double,Vec4d>(_a,_a,_a,_a) {}
24
 
24
 
25
		/// Construct a 4D vector
25
		/// Construct a 4D vector
26
		Vec4d(float _a, float _b, float _c, float _d): 
26
		Vec4d(double _a, double _b, double _c, double _d): 
27
			ArithVec4Float<float,Vec4d>(_a,_b,_c,_d) {}
27
			ArithVec4Float<double,Vec4d>(_a,_b,_c,_d) {}
28
 
28
 
29
		/// Construct a homogenous vector (a,b,c,1)
29
		/// Construct a homogenous vector (a,b,c,1)
30
		Vec4d(float _a, float _b, float _c): 
30
		Vec4d(double _a, double _b, double _c): 
31
			ArithVec4Float<float,Vec4d>(_a,_b,_c,1.0) {}
31
			ArithVec4Float<double,Vec4d>(_a,_b,_c,1.0) {}
32
 
32
 
33
		/// Construct a homogenous vector from a non-homogenous.
33
		/// Construct a homogenous vector from a non-homogenous.
34
		explicit Vec4d(const Vec3d& v): 
34
		explicit Vec4d(const Vec3d& v): 
35
			ArithVec4Float<float,Vec4d>(v[0],v[1],v[2],1.0) {}
35
			ArithVec4Float<double,Vec4d>(v[0],v[1],v[2],1.0) {}
36
 
36
 
37
		/// Construct a homogenous vector from a non-homogenous.
37
		/// Construct a homogenous vector from a non-homogenous.
38
		explicit Vec4d(const Vec3d& v,float _d): 
38
		explicit Vec4d(const Vec3d& v,double _d): 
39
			ArithVec4Float<float,Vec4d>(v[0],v[1],v[2],_d) {}
39
			ArithVec4Float<double,Vec4d>(v[0],v[1],v[2],_d) {}
40
 
40
 
41
		operator Vec3d() const
41
		operator Vec3d() const
42
		{
42
		{
43
			float k = 1.0/(*this)[3];
43
			double k = 1.0/(*this)[3];
44
			return Vec3d((*this)[0]*k,(*this)[1]*k,(*this)[2]*k);
44
			return Vec3d((*this)[0]*k,(*this)[1]*k,(*this)[2]*k);
45
		}
45
		}
46
	};
46
	};
47
}
47
}
48
#endif
48
#endif