Subversion Repositories gelsvn

Rev

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

Rev 595 Rev 630
1
/* ----------------------------------------------------------------------- *
1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
5
 * ----------------------------------------------------------------------- */
6
 
6
 
7
/** @file Vec3f.h
7
/** @file Vec3f.h
8
 * @brief 3D float vector class.
8
 * @brief 3D float vector class.
9
 */
9
 */
10
 
10
 
11
#ifndef __CGLA_VEC3F_H__
11
#ifndef __CGLA_VEC3F_H__
12
#define __CGLA_VEC3F_H__
12
#define __CGLA_VEC3F_H__
13
 
13
 
14
#include "ArithVec3Float.h"
14
#include "ArithVec3Float.h"
15
#include "Vec3i.h"
15
#include "Vec3i.h"
16
#include "Vec3usi.h"
16
#include "Vec3usi.h"
17
 
17
 
18
namespace CGLA {
18
namespace CGLA {
19
	class Vec3d;
19
	class Vec3d;
20
	class Vec4f;
20
	class Vec4f;
21
	
21
	
22
	/** \brief 3D float vector.
22
	/** \brief 3D float vector.
23
 
23
 
24
			Class Vec3f is the vector typically used in 3D computer graphics. 
24
			Class Vec3f is the vector typically used in 3D computer graphics. 
25
			The class has many constructors since we may need to convert from
25
			The class has many constructors since we may need to convert from
26
			other vector types. Most of these are explicit to avoid automatic
26
			other vector types. Most of these are explicit to avoid automatic
27
			conversion. 
27
			conversion. 
28
	*/
28
	*/
29
	class Vec3f: public ArithVec3Float<float,Vec3f>
29
	class Vec3f: public ArithVec3Float<float,Vec3f>
30
	{
30
	{
31
	public:
31
	public:
32
 
32
 
33
		/// Construct 0 vector.
33
		/// Construct 0 vector.
34
		Vec3f(){}
34
		Vec3f(){}
35
 
35
 
36
		/// Construct a 3D float vector.
36
		/// Construct a 3D float vector.
37
		Vec3f(float a, float b, float c): 
37
		Vec3f(float a, float b, float c): 
38
			ArithVec3Float<float,Vec3f>(a,b,c) {}
38
			ArithVec3Float<float,Vec3f>(a,b,c) {}
39
 
39
 
40
		/// Construct a vector with 3 identical coordinates.
40
		/// Construct a vector with 3 identical coordinates.
41
		explicit Vec3f(float a):
41
		explicit Vec3f(float a):
42
			ArithVec3Float<float,Vec3f>(a,a,a) {}
42
			ArithVec3Float<float,Vec3f>(a,a,a) {}
43
 
43
 
44
		/// Construct from a 3D int vector
44
		/// Construct from a 3D int vector
45
		explicit Vec3f(const Vec3i& v): 
45
		explicit Vec3f(const Vec3i& v): 
46
			ArithVec3Float<float,Vec3f>(v[0],v[1],v[2]) {}
46
			ArithVec3Float<float,Vec3f>(v[0],v[1],v[2]) {}
47
	
47
	
48
		/// Construct from a 3D unsigned int vector.
48
		/// Construct from a 3D unsigned int vector.
49
		explicit Vec3f(const Vec3usi& v): 
49
		explicit Vec3f(const Vec3usi& v): 
50
			ArithVec3Float<float,Vec3f>(v[0],v[1],v[2]) {}
50
			ArithVec3Float<float,Vec3f>(v[0],v[1],v[2]) {}
51
 
51
 
52
		/// Construct from a 3D double vector.
52
		/// Construct from a 3D double vector.
53
		explicit Vec3f(const Vec3d&);
53
		explicit Vec3f(const Vec3d&);
54
 
54
 
55
		/// Construct from a 4D float vector (skipping the last value)
55
		/// Construct from a 4D float vector (skipping the last value)
56
		explicit Vec3f(const Vec4f&);
56
		explicit Vec3f(const Vec4f&);
57
	};
57
	};
58
 
58
 
59
}
59
}
60
#endif
60
#endif
61
 
61