GLC_lib
2.5.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Users
laumaya
git
glc_lib
src
maths
glc_vector3df.h
Go to the documentation of this file.
1
/****************************************************************************
2
3
This file is part of the GLC-lib library.
4
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5
http://glc-lib.sourceforge.net
6
7
GLC-lib is free software; you can redistribute it and/or modify
8
it under the terms of the GNU Lesser General Public License as published by
9
the Free Software Foundation; either version 3 of the License, or
10
(at your option) any later version.
11
12
GLC-lib is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public License
18
along with GLC-lib; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21
*****************************************************************************/
22
24
25
#ifndef GLC_VECTOR3DF_H_
26
#define GLC_VECTOR3DF_H_
27
#include "
glc_utils_maths.h
"
28
29
#include "../glc_config.h"
30
33
37
38
39
class
GLC_LIB_EXPORT
GLC_Vector3df
40
{
41
friend
class
GLC_Vector4d
;
42
friend
class
GLC_Vector3d
;
44
46
47
public
:
54
inline
GLC_Vector3df
()
55
{
56
m_Vector
[0]= 0.0f;
57
m_Vector
[1]= 0.0f;
58
m_Vector
[2]= 0.0f;
59
}
60
62
inline
GLC_Vector3df
(
const
float
&dX,
const
float
&dY,
const
float
&dZ)
63
{
64
setVect
(dX, dY, dZ);
65
}
66
73
inline
GLC_Vector3df
(
const
GLC_Vector3df
&Vect)
74
{
75
m_Vector
[0]= Vect.
m_Vector
[0];
76
m_Vector
[1]= Vect.
m_Vector
[1];
77
m_Vector
[2]= Vect.
m_Vector
[2];
78
}
80
81
83
85
86
public
:
88
inline
GLC_Vector3df
&
setX
(
const
float
&dX)
89
{
90
m_Vector
[0]= dX;
91
return
*
this
;
92
}
93
95
inline
GLC_Vector3df
&
setY
(
const
float
&dY)
96
{
97
m_Vector
[1]= dY;
98
return
*
this
;
99
}
100
102
inline
GLC_Vector3df
&
setZ
(
const
float
&dZ)
103
{
104
m_Vector
[2]= dZ;
105
return
*
this
;
106
}
107
109
inline
GLC_Vector3df
&
setVect
(
const
float
&dX,
const
float
&dY,
const
float
&dZ)
110
{
111
m_Vector
[0]= dX;
112
m_Vector
[1]= dY;
113
m_Vector
[2]= dZ;
114
115
return
*
this
;
116
}
117
119
GLC_Vector3df
&
setVect
(
const
GLC_Vector3df
&Vect)
120
{
121
m_Vector
[0]= Vect.
m_Vector
[0];
122
m_Vector
[1]= Vect.
m_Vector
[1];
123
m_Vector
[2]= Vect.
m_Vector
[2];
124
return
*
this
;
125
}
126
128
inline
GLC_Vector3df
& setInv(
void
)
129
{
130
m_Vector
[0]= -
m_Vector
[0];
131
m_Vector
[1]= -
m_Vector
[1];
132
m_Vector
[2]= -
m_Vector
[2];
133
return
*
this
;
134
}
135
137
139
141
142
public
:
144
inline
float
x
(
void
)
const
145
{
146
return
m_Vector
[0];
147
}
149
inline
float
y
(
void
)
const
150
{
151
return
m_Vector
[1];
152
}
154
inline
float
z
(
void
)
const
155
{
156
return
m_Vector
[2];
157
}
159
inline
const
float
*
data
(
void
)
const
160
{
161
return
m_Vector
;
162
}
164
inline
bool
isNull
(
void
)
const
165
{
166
return
qFuzzyCompare(
m_Vector
[0], 0.0f) && qFuzzyCompare(
m_Vector
[1], 0.0f)
167
&& qFuzzyCompare(
m_Vector
[2], 0.0f);
168
}
169
171
173
//name Private attributes
175
private
:
181
float
m_Vector
[3];
182
183
};
//class GLC_Vector3d
184
186
typedef
GLC_Vector3df
GLC_Point3df
;
187
188
#endif
/*GLC_VECTOR3DF_H_*/
©2005-2013 Laurent Ribon