660 |
khor |
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 Vec3f.h
|
|
|
8 |
* @brief 3D float vector class.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
#ifndef __CGLA_VEC3F_H__
|
|
|
12 |
#define __CGLA_VEC3F_H__
|
|
|
13 |
|
|
|
14 |
#include "ArithVec3Float.h"
|
|
|
15 |
#include "Vec3i.h"
|
|
|
16 |
#include "Vec3usi.h"
|
|
|
17 |
|
|
|
18 |
namespace CGLA {
|
|
|
19 |
class Vec3d;
|
|
|
20 |
class Vec4f;
|
|
|
21 |
|
|
|
22 |
/** \brief 3D float vector.
|
|
|
23 |
|
|
|
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
|
|
|
26 |
other vector types. Most of these are explicit to avoid automatic
|
|
|
27 |
conversion.
|
|
|
28 |
*/
|
|
|
29 |
class Vec3f: public ArithVec3Float<float,Vec3f>
|
|
|
30 |
{
|
|
|
31 |
public:
|
|
|
32 |
|
|
|
33 |
/// Construct 0 vector.
|
|
|
34 |
Vec3f(){}
|
|
|
35 |
|
|
|
36 |
/// Construct a 3D float vector.
|
|
|
37 |
Vec3f(float a, float b, float c):
|
|
|
38 |
ArithVec3Float<float,Vec3f>(a,b,c) {}
|
|
|
39 |
|
|
|
40 |
/// Construct a vector with 3 identical coordinates.
|
|
|
41 |
explicit Vec3f(float a):
|
|
|
42 |
ArithVec3Float<float,Vec3f>(a,a,a) {}
|
|
|
43 |
|
|
|
44 |
/// Construct from a 3D int vector
|
|
|
45 |
explicit Vec3f(const Vec3i& v):
|
|
|
46 |
ArithVec3Float<float,Vec3f>(v[0],v[1],v[2]) {}
|
|
|
47 |
|
|
|
48 |
/// Construct from a 3D unsigned int vector.
|
|
|
49 |
explicit Vec3f(const Vec3usi& v):
|
|
|
50 |
ArithVec3Float<float,Vec3f>(v[0],v[1],v[2]) {}
|
|
|
51 |
|
|
|
52 |
/// Construct from a 3D double vector.
|
|
|
53 |
explicit Vec3f(const Vec3d&);
|
|
|
54 |
|
|
|
55 |
/// Construct from a 4D float vector (skipping the last value)
|
|
|
56 |
explicit Vec3f(const Vec4f&);
|
|
|
57 |
};
|
|
|
58 |
|
|
|
59 |
}
|
|
|
60 |
#endif
|