VR-Link API Documentation for HLA 1516
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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
41
//Helper typedefs - all vectors are double vectors, regardless of encoding
42
typedef
DtVector
DtVector32
;
43
typedef
DtVector
DtVector64
;
44
55
class
DT_DLL_MATRIX
DtVector
56
{
57
public
:
58
59
DtVector
();
60
62
DtVector
(
const
double
& x,
const
double
& y,
const
double
& z);
63
65
~
DtVector
();
66
68
DtVector
(
const
DtVector
& vec);
69
71
DtVector
& operator=(
const
DtVector
& vec);
72
74
void
setToZero();
75
77
78
const
double
& x()
const
;
79
void
setX(
const
double
& x);
81
83
84
const
double
& y()
const
;
85
void
setY(
const
double
& y);
87
89
90
const
double
& z()
const
;
91
void
setZ(
const
double
& z);
93
95
DtVector
&operator+=(
const
DtVector
&other);
96
98
DtVector
&operator-=(
const
DtVector
&other);
99
100
102
double
& operator[](
int
ind);
103
105
double
operator[](
int
ind)
const
;
106
108
double
& operator[](
DtVectorOffset
ind);
109
111
double
operator[](
DtVectorOffset
ind)
const
;
112
115
int
operator==
(
const
DtVector
& vec)
const
;
116
119
int
operator!=
(
const
DtVector
& vec)
const
;
120
122
DtString
string()
const
;
123
126
double
magnitudeSquared()
const
;
127
129
void
normalize();
130
132
bool
isNormalized()
const
;
133
135
DtVector
crossProduct(
const
DtVector
& v)
const
;
136
138
double
dotProduct(
const
DtVector
& v)
const
;
139
141
bool
approxEq(
const
DtVector
& v,
const
double
& tolerance)
const
;
142
144
bool
magnitudeIsZero()
const
;
145
149
bool
magnitudeIsZero(
double
tolerance)
const
;
150
152
std::ostream &printDataToStream(std::ostream &str)
const
;
153
154
public
:
155
158
159
operator
double
* ();
160
operator
const
double
* ()
const
;
162
163
public
:
164
165
167
static
const
DtVector
& zero();
168
170
static
const
DtVector
& i();
171
173
static
const
DtVector
& j();
174
176
static
const
DtVector
& k();
177
179
static
const
DtVector
& ones();
180
181
182
protected
:
183
184
double
myRep[3];
185
186
187
};
188
189
//
190
// Vector routines.
191
//
192
193
#define DtSetVec(v, x, y, z) v[DtX]=x;v[DtY]=y;v[DtZ]=z;
194
196
extern
DT_DLL_MATRIX
DtThreeIndex
DtLevi_Civita
;
197
200
DT_DLL_MATRIX
DtVector
operator+
(
const
DtVector
& v1,
const
DtVector
&v2);
201
204
DT_DLL_MATRIX
DtVector
operator-
(
const
DtVector
& v1,
const
DtVector
&v2);
205
207
DT_DLL_MATRIX
void
DtVecScale
(
const
DtVector
& v,
double
scale_factor,
DtVector
& result);
208
210
DT_DLL_MATRIX
void
DtVecNeg
(
const
DtVector
& v1,
DtVector
& result);
211
214
DT_DLL_MATRIX
double
DtVecCosProd
(
const
DtVector
& v1,
const
DtVector
& v2);
215
218
DT_DLL_MATRIX
double
DtVecBoxProd
(
const
DtVector
& v1,
const
DtVector
& v2,
const
DtVector
& v3);
219
222
DT_DLL_MATRIX
void
DtVecDcmMul
(
const
DtVector
& v,
const
DtDcm
& m,
DtVector
& result);
223
225
DT_DLL_MATRIX
void
DtVV_Product
(
const
DtVector
& a,
const
DtVector
& b,
DtDcm
& ans);
226
228
DT_DLL_MATRIX
double
DtVecInfNorm
(
const
DtVector
& v1);
229
231
DT_DLL_MATRIX
void
DtVecInit
(
DtVector
& v);
232
235
DT_DLL_MATRIX
DtVector
DtLerpVector
(
DtVector
va,
DtVector
vb,
double
t);
236
239
DT_DLL_MATRIX
void
DtVecCopy
(
const
DtVector
& from,
DtVector
& to);
240
243
DT_DLL_MATRIX
int
DtVecCheck
(
const
DtVector
& v);
244
247
DT_DLL_MATRIX
void
DtVecNormalize
(
const
DtVector
& v,
DtVector
& result);
248
251
DT_DLL_MATRIX
void
DtVecCrossProd
(
const
DtVector
& v1,
const
DtVector
& v2,
DtVector
& result);
252
255
DT_DLL_MATRIX
double
DtVecDotProd
(
const
DtVector
& v1,
const
DtVector
& v2);
256
259
DT_DLL_MATRIX
void
DtVecDump
(
const
char
*str,
const
DtVector
& v);
260
263
DT_DLL_MATRIX
void
DtVecSub
(
const
DtVector
& v1,
const
DtVector
& v2,
DtVector
& result);
264
267
DT_DLL_MATRIX
void
DtVecAdd
(
const
DtVector
& v1,
const
DtVector
& v2,
DtVector
& result);
268
272
DT_DLL_MATRIX
DtVector
DtVelocityFromAToB
(
const
DtVector
& a,
273
const
DtVector
& b,
double
time);
274
278
DT_DLL_MATRIX
double
DtHeadingFromAToB
(
const
DtVector
& a,
const
DtVector
& b);
279
280
/* ||p1-p2||_{2} */
282
DT_DLL_MATRIX
double
DtDistance
(
const
DtVector
& p1,
const
DtVector
& p2);
283
285
DT_DLL_MATRIX
double
DtDistSqr
(
const
DtVector
& p1,
const
DtVector
& p2);
286
287
290
class
DT_DLL_MATRIX
DtNetVector32
291
{
292
public
:
293
DtNetVector32
();
294
DtNetVector32
(
const
DtVector
&vec);
295
DtVector
operator=(
const
DtVector
&vec);
296
operator
DtVector
()
const
;
297
DtNetFloat32
&operator[](
int
i);
298
DtNetFloat32
operator[](
int
i)
const
;
299
private
:
300
DtNetFloat32
rep[3];
301
};
302
305
class
DT_DLL_MATRIX
DtNetVector64
306
{
307
public
:
308
DtNetVector64
();
309
DtNetVector64
(
const
DtVector
&vec);
310
DtVector
operator=(
const
DtVector
&vec);
311
operator
DtVector
()
const
;
312
DtNetFloat64
&operator[](
int
i);
313
DtNetFloat64
operator[](
int
i)
const
;
314
private
:
315
DtNetFloat64
rep[3];
316
};
317
318
DT_DLL_MATRIX
std::ostream &
operator <<
(std::ostream &str,
const
DtVector
&vec);
319
320
322
#define vlVector_inl
323
#include "vlVector.inl"
324
#undef vlVector_inl
325
326
#ifdef DtUSE_UTILITIES_NAMESPACE
327
}
328
#endif
329
330
#endif
331
Document ID: Generated on Fri May 15 06:36:13 EDT 2015 from SVN revision 153263
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)