Public Member Functions | Public Attributes | List of all members
caf::SRVector3D Class Reference

A 3-vector with more efficient storage than TVector3. More...

#include <SRVector3D.h>

Public Member Functions

 SRVector3D ()
 
 SRVector3D (float x, float y, float z)
 
 SRVector3D (const TVector3 &v)
 Easy conversion from TVector3. More...
 
virtual ~SRVector3D ()=default
 
void SetXYZ (float x, float y, float z)
 
 operator TVector3 () const
 Easy conversion back to TVector3. More...
 
void SetX (float _x)
 
void SetY (float _y)
 
void SetZ (float _z)
 
float X () const
 
float Y () const
 
float Z () const
 
float Mag2 () const
 
float Mag () const
 
float Dot (const SRVector3D &v) const
 
SRVector3D Unit () const
 
SRVector3D operator+ (const SRVector3D &other) const
 
SRVector3D operator- (const SRVector3D &other) const
 
 SRVector3D ()
 
 SRVector3D (float x, float y, float z)
 

Public Attributes

float x
 
float y
 
float z
 

Detailed Description

A 3-vector with more efficient storage than TVector3.

Definition at line 25 of file SRVector3D.h.

Constructor & Destructor Documentation

caf::SRVector3D::SRVector3D ( )

Definition at line 13 of file SRVector3D.cxx.

13  :
14  x(std::numeric_limits<float>::signaling_NaN()),
15  y(std::numeric_limits<float>::signaling_NaN()),
16  z(std::numeric_limits<float>::signaling_NaN())
17  {}
caf::SRVector3D::SRVector3D ( float  x,
float  y,
float  z 
)

Definition at line 19 of file SRVector3D.cxx.

19  :
20  x(_x), y(_y), z(_z)
21  {}
caf::SRVector3D::SRVector3D ( const TVector3 &  v)
explicit

Easy conversion from TVector3.

Definition at line 23 of file SRVector3D.cxx.

23  :
24  x(v.X()), y(v.Y()), z(v.Z())
25  {}
virtual caf::SRVector3D::~SRVector3D ( )
virtualdefault
caf::SRVector3D::SRVector3D ( )
caf::SRVector3D::SRVector3D ( float  x,
float  y,
float  z 
)

Member Function Documentation

float caf::SRVector3D::Dot ( const SRVector3D v) const
inline

Definition at line 57 of file SRVector3D.h.

57 {return x*v.x + y*v.y + z*v.z;}
float caf::SRVector3D::Mag ( ) const
inline

Definition at line 56 of file SRVector3D.h.

56 {return sqrt(Mag2());}
float Mag2() const
Definition: SRVector3D.h:55
float caf::SRVector3D::Mag2 ( ) const
inline

Definition at line 55 of file SRVector3D.h.

55 {return x*x+y*y+z*z;}
caf::SRVector3D::operator TVector3 ( ) const

Easy conversion back to TVector3.

Definition at line 34 of file SRVector3D.cxx.

35  {
36  return TVector3(x, y, z);
37  }
SRVector3D caf::SRVector3D::operator+ ( const SRVector3D other) const
inline

Definition at line 65 of file SRVector3D.h.

65 { return SRVector3D(x + other.x, y + other.y, z + other.z); }
SRVector3D caf::SRVector3D::operator- ( const SRVector3D other) const
inline

Definition at line 66 of file SRVector3D.h.

66 {return SRVector3D(x - other.x, y - other.y, z - other.z); }
void caf::SRVector3D::SetX ( float  _x)
inline

Definition at line 44 of file SRVector3D.h.

44 {x = _x;}
void caf::SRVector3D::SetXYZ ( float  x,
float  y,
float  z 
)

Definition at line 27 of file SRVector3D.cxx.

28  {
29  x = _x;
30  y = _y;
31  z = _z;
32  }
void caf::SRVector3D::SetY ( float  _y)
inline

Definition at line 45 of file SRVector3D.h.

45 {y = _y;}
void caf::SRVector3D::SetZ ( float  _z)
inline

Definition at line 46 of file SRVector3D.h.

46 {z = _z;}
SRVector3D caf::SRVector3D::Unit ( ) const
inline

Definition at line 58 of file SRVector3D.h.

59  {
60  const float m = Mag();
61  return SRVector3D(x/m, y/m, z/m);
62  }
float Mag() const
Definition: SRVector3D.h:56
float caf::SRVector3D::X ( ) const
inline

Definition at line 48 of file SRVector3D.h.

48 {return x;}
float caf::SRVector3D::Y ( ) const
inline

Definition at line 49 of file SRVector3D.h.

49 {return y;}
float caf::SRVector3D::Z ( ) const
inline

Definition at line 50 of file SRVector3D.h.

50 {return z;}

Member Data Documentation

float caf::SRVector3D::x

Definition at line 71 of file SRVector3D.h.

float caf::SRVector3D::y

Definition at line 72 of file SRVector3D.h.

float caf::SRVector3D::z

Definition at line 73 of file SRVector3D.h.


The documentation for this class was generated from the following files: