VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVecUtils.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2026 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
13 
14 #include <vrvMath/DtVector3.h>
15 
16 namespace makVrv
17 {
18 
19  // Returns the magnitude of theVec.
20  inline double length(const dvec3& theVec)
21  {
22  return theVec.length();
23  }
24 
25  // Returns a normalized copy of theVec. Returns zero vector if theVec has
26  // near-zero length to prevent NaN propagation.
27  inline dvec3 normalize(const dvec3& theVec)
28  {
29  double len = theVec.length();
30  if (len < 1e-12) return dvec3(0.0, 0.0, 0.0);
31  dvec3 normVec = theVec;
32  normVec.normalize();
33  return normVec;
34  }
35 
36  // Returns the cross product of a and b.
37  inline dvec3 cross(const dvec3& a, const dvec3& b)
38  {
39  return a.crossProduct(b);
40  }
41 
42  // Returns the dot product of a and b.
43  inline double dot(const dvec3& a, const dvec3& b)
44  {
45  return a.dotProduct(b);
46  }
47 
48 } // namespace makVrv
dvec3 cross(const dvec3 &a, const dvec3 &b)
Definition: DtVecUtils.h:37
double length(const dvec3 &theVec)
Definition: DtVecUtils.h:20
DtVector3 crossProduct(const DtVector3 &rhs) const
get the cross product of this vector and rhs
Definition: DtVector3.h:255
T dotProduct(const DtVector3 &rhs) const
get the dot product of this vector and rhs
Definition: DtVector3.h:268
3 dimensional vector
makVrv::Vector3_64 dvec3
Convenience alias for the 64-bit 3-component vector type used throughout vrvBallistics.
Definition: vrvBallistics.h:28
dvec3 normalize(const dvec3 &theVec)
Definition: DtVecUtils.h:27
double dot(const dvec3 &a, const dvec3 &b)
Definition: DtVecUtils.h:43
void normalize(void)
normalize this vector in place
Definition: DtVector3.h:167
T length(void) const
get the length of this vector
Definition: DtVector3.h:180
Dll export defines.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)