VR-Link API Documentation for HLA Evolved
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
include
matrix
vlVector.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 1992-2010 VT MAK
3
** All rights reserved.
4
*********************************************************************/
5
6
#ifndef DtVector_H_
7
#define DtVector_H_
8
12
13
#include <
vlutil/vlMachineTypes.h
>
14
#include <
vlutil/vlNetTypes.h
>
15
#include <
vlutil/vlString.h
>
16
#include <iosfwd>
17
18
#ifdef DtUSE_UTILITIES_NAMESPACE
19
namespace
DtUSE_UTILITIES_NAMESPACE
20
{
21
#endif
22
23
26
enum
DtVectorOffset
27
{
28
DtX
,
29
DtY
,
30
DtZ
31
};
32
33
class
DtDcm
;
34
class
DtVector
;
35
36
typedef
const
DtVector
&
DtConstVector
;
37
typedef
DtVector
&
DtVectorRef
;
38
typedef
double
DtThreeIndex
[3][3][3];
39
typedef
double (*
DtThreeIndexPtr
)[3][3];
40
51
class
DT_DLL_MATRIX
DtVector
52
{
53
public
:
54
55
DtVector
();
56
58
DtVector
(
const
double
& x,
const
double
& y,
const
double
& z);
59
61
~
DtVector
();
62
64
DtVector
(
const
DtVector
& vec);
65
67
DtVector
& operator=(
const
DtVector
& vec);
68
70
void
setToZero();
71
73
74
const
double
& x()
const
;
75
void
setX(
const
double
& x);
77
79
80
const
double
& y()
const
;
81
void
setY(
const
double
& y);
83
85
86
const
double
& z()
const
;
87
void
setZ(
const
double
& z);
89
91
DtVector
&operator+=(
const
DtVector
&other);
92
94
DtVector
&operator-=(
const
DtVector
&other);
95
96
98
double
& operator[](
int
ind);
99
101
double
operator[](
int
ind)
const
;
102
104
double
& operator[](
DtVectorOffset
ind);
105
107
double
operator[](
DtVectorOffset
ind)
const
;
108
111
int
operator==
(
const
DtVector
& vec)
const
;
112
115
int
operator!=
(
const
DtVector
& vec)
const
;
116
118
DtString
string()
const
;
119
122
double
magnitudeSquared()
const
;
123
125
void
normalize();
126
128
bool
isNormalized()
const
;
129
131
DtVector
crossProduct(
const
DtVector
& v)
const
;
132
134
double
dotProduct(
const
DtVector
& v)
const
;
135
137
bool
approxEq(
const
DtVector
& v,
const
double
& tolerance)
const
;
138
140
bool
magnitudeIsZero()
const
;
141
145
bool
magnitudeIsZero(
double
tolerance)
const
;
146
148
std::ostream &printDataToStream(std::ostream &str)
const
;
149
150
public
:
151
154
155
operator
double
* ();
156
operator
const
double
* ()
const
;
158
159
public
:
160
161
163
static
const
DtVector
& zero();
164
166
static
const
DtVector
& i();
167
169
static
const
DtVector
& j();
170
172
static
const
DtVector
& k();
173
175
static
const
DtVector
& ones();
176
177
178
protected
:
179
180
double
myRep[3];
181
182
183
};
184
185
//
186
// Vector routines.
187
//
188
189
#define DtSetVec(v, x, y, z) v[DtX]=x;v[DtY]=y;v[DtZ]=z;
190
192
extern
DT_DLL_MATRIX
DtThreeIndex
DtLevi_Civita
;
193
196
DT_DLL_MATRIX
DtVector
operator+
(
const
DtVector
& v1,
const
DtVector
&v2);
197
200
DT_DLL_MATRIX
DtVector
operator-
(
const
DtVector
& v1,
const
DtVector
&v2);
201
203
DT_DLL_MATRIX
void
DtVecScale
(
const
DtVector
& v,
double
scale_factor,
DtVector
& result);
204
206
DT_DLL_MATRIX
void
DtVecNeg
(
const
DtVector
& v1,
DtVector
& result);
207
210
DT_DLL_MATRIX
double
DtVecCosProd
(
const
DtVector
& v1,
const
DtVector
& v2);
211
214
DT_DLL_MATRIX
double
DtVecBoxProd
(
const
DtVector
& v1,
const
DtVector
& v2,
const
DtVector
& v3);
215
218
DT_DLL_MATRIX
void
DtVecDcmMul
(
const
DtVector
& v,
const
DtDcm
& m,
DtVector
& result);
219
221
DT_DLL_MATRIX
void
DtVV_Product
(
const
DtVector
& a,
const
DtVector
& b,
DtDcm
& ans);
222
224
DT_DLL_MATRIX
double
DtVecInfNorm
(
const
DtVector
& v1);
225
227
DT_DLL_MATRIX
void
DtVecInit
(
DtVector
& v);
228
231
DT_DLL_MATRIX
void
DtVecCopy
(
const
DtVector
& from,
DtVector
& to);
232
235
DT_DLL_MATRIX
int
DtVecCheck
(
const
DtVector
& v);
236
239
DT_DLL_MATRIX
void
DtVecNormalize
(
const
DtVector
& v,
DtVector
& result);
240
243
DT_DLL_MATRIX
void
DtVecCrossProd
(
const
DtVector
& v1,
const
DtVector
& v2,
DtVector
& result);
244
247
DT_DLL_MATRIX
double
DtVecDotProd
(
const
DtVector
& v1,
const
DtVector
& v2);
248
251
DT_DLL_MATRIX
void
DtVecDump
(
const
char
*str,
const
DtVector
& v);
252
255
DT_DLL_MATRIX
void
DtVecSub
(
const
DtVector
& v1,
const
DtVector
& v2,
DtVector
& result);
256
259
DT_DLL_MATRIX
void
DtVecAdd
(
const
DtVector
& v1,
const
DtVector
& v2,
DtVector
& result);
260
264
DT_DLL_MATRIX
DtVector
DtVelocityFromAToB
(
const
DtVector
& a,
265
const
DtVector
& b,
double
time);
266
270
DT_DLL_MATRIX
double
DtHeadingFromAToB
(
const
DtVector
& a,
const
DtVector
& b);
271
272
/* ||p1-p2||_{2} */
274
DT_DLL_MATRIX
double
DtDistance
(
const
DtVector
& p1,
const
DtVector
& p2);
275
277
DT_DLL_MATRIX
double
DtDistSqr
(
const
DtVector
& p1,
const
DtVector
& p2);
278
279
282
class
DT_DLL_MATRIX
DtNetVector32
283
{
284
public
:
285
DtNetVector32
();
286
DtNetVector32
(
const
DtVector
&vec);
287
DtVector
operator=(
const
DtVector
&vec);
288
operator
DtVector
()
const
;
289
DtNetFloat32
&operator[](
int
i);
290
DtNetFloat32
operator[](
int
i)
const
;
291
private
:
292
DtNetFloat32
rep[3];
293
};
294
297
class
DT_DLL_MATRIX
DtNetVector64
298
{
299
public
:
300
DtNetVector64
();
301
DtNetVector64
(
const
DtVector
&vec);
302
DtVector
operator=(
const
DtVector
&vec);
303
operator
DtVector
()
const
;
304
DtNetFloat64
&operator[](
int
i);
305
DtNetFloat64
operator[](
int
i)
const
;
306
private
:
307
DtNetFloat64
rep[3];
308
};
309
310
DT_DLL_MATRIX
std::ostream &
operator <<
(std::ostream &str,
const
DtVector
&vec);
311
312
314
#define vlVector_inl
315
#include "vlVector.inl"
316
#undef vlVector_inl
317
318
#ifdef DtUSE_UTILITIES_NAMESPACE
319
}
320
#endif
321
322
#endif
323
Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)