g4tools  5.4.0
Public Member Functions | List of all members
tools::vec4f Class Reference
Inheritance diagram for tools::vec4f:
Inheritance graph
[legend]
Collaboration diagram for tools::vec4f:
Collaboration graph
[legend]

Public Member Functions

 TOOLS_SCLASS (tools::vec4f) public
 
 vec4f (const float a_vec[4])
 
 vec4f (const float &a0, const float &a1, const float &a2, const float &a3)
 
virtual ~vec4f ()
 
 vec4f (const vec4f &a_from)
 
vec4foperator= (const vec4f &a_from)
 
vec4f operator* (float a_v) const
 
vec4f operator+ (const vec4f &a_v) const
 
vec4f operator- (const vec4f &a_v) const
 
vec4foperator+= (const vec4f &a_v)
 
vec4foperator*= (float a_v)
 
vec4f operator- () const
 
float length () const
 
float normalize ()
 
- Public Member Functions inherited from tools::vec4< float >
unsigned int dimension () const
 
 vec4 ()
 
 vec4 (const float a_vec[4])
 
 vec4 (const float &a0, const float &a1, const float &a2, const float &a3)
 
 vec4 (const vec4 &a_from)
 
virtual ~vec4 ()
 
vec4operator= (const vec4 &a_from)
 
const float & v0 () const
 
void v0 (const float &a_value)
 
const float & v1 () const
 
void v1 (const float &a_value)
 
const float & v2 () const
 
void v2 (const float &a_value)
 
const float & v3 () const
 
void v3 (const float &a_value)
 
const float & x () const
 
const float & y () const
 
const float & z () const
 
const float & t () const
 
void set_value (const float &a0, const float &a1, const float &a2, const float &a3)
 
void set_value (const float aV[4])
 
bool set_value (unsigned int a_index, const float &a_value)
 
void value (float &a0, float &a1, float &a2, float &a3) const
 
float length (float(*a_sqrt)(float)) const
 
float normalize (float(*a_sqrt)(float))
 
bool equal (const vec4 &a_vec) const
 
bool equal (const vec4 &a_vec, const float &a_epsil) const
 
bool is_proportional (const vec4 &a_vec, float &a_factor) const
 
void multiply (const float &a_T)
 
bool divide (const float &a_T)
 
void add (const vec4 &a_v)
 
void add (const float &a0, const float &a1, const float &a2, const float &a3)
 
void subtract (const vec4 &a_v)
 
void subtract (const float &a0, const float &a1, const float &a2, const float &a3)
 
float & operator[] (size_t a_index)
 
const float & operator[] (size_t a_index) const
 
vec4 operator+ (const vec4 &a_v) const
 
vec4 operator- (const vec4 &a_v) const
 
vec4 operator* (const float &a_v) const
 
bool operator== (const vec4 &a_v) const
 
bool operator!= (const vec4 &a_v) const
 
size_type size () const
 
const float * data () const
 

Additional Inherited Members

- Public Types inherited from tools::vec4< float >
typedef float elem_t
 
typedef unsigned int size_type
 
- Static Protected Member Functions inherited from tools::vec4< float >
static float zero ()
 
static float minus_one ()
 
- Protected Attributes inherited from tools::vec4< float >
float m_data [4]
 

Detailed Description

Definition at line 13 of file vec4f.

Constructor & Destructor Documentation

◆ vec4f() [1/3]

tools::vec4f::vec4f ( const float  a_vec[4])
inline

Definition at line 19 of file vec4f.

19 :parent(a_vec) {}

◆ vec4f() [2/3]

tools::vec4f::vec4f ( const float &  a0,
const float &  a1,
const float &  a2,
const float &  a3 
)
inline

Definition at line 23 of file vec4f.

23 :parent(a0,a1,a2,a3){}

◆ ~vec4f()

virtual tools::vec4f::~vec4f ( )
inlinevirtual

Definition at line 25 of file vec4f.

25 {}

◆ vec4f() [3/3]

tools::vec4f::vec4f ( const vec4f a_from)
inline

Definition at line 27 of file vec4f.

27 :parent(a_from){}

Member Function Documentation

◆ length()

float tools::vec4f::length ( ) const
inline

Definition at line 71 of file vec4f.

71  {
72  return float(::sqrt(m_data[0]*m_data[0]+m_data[1]*m_data[1]+m_data[2]*m_data[2]+m_data[3]*m_data[3]));
73  }

◆ normalize()

float tools::vec4f::normalize ( )
inline

Definition at line 74 of file vec4f.

74  {
75  float norme = length();
76  if(!norme) return 0;
77  divide(norme);
78  return norme;
79  }

◆ operator*()

vec4f tools::vec4f::operator* ( float  a_v) const
inline

Definition at line 33 of file vec4f.

33  {
34  return vec4f(m_data[0]*a_v,
35  m_data[1]*a_v,
36  m_data[2]*a_v,
37  m_data[3]*a_v);
38  }

◆ operator*=()

vec4f& tools::vec4f::operator*= ( float  a_v)
inline

Definition at line 58 of file vec4f.

58  {
59  m_data[0] *= a_v;
60  m_data[1] *= a_v;
61  m_data[2] *= a_v;
62  m_data[3] *= a_v;
63  return *this;
64  }

◆ operator+()

vec4f tools::vec4f::operator+ ( const vec4f a_v) const
inline

Definition at line 39 of file vec4f.

39  {
40  return vec4f(m_data[0]+a_v.m_data[0],
41  m_data[1]+a_v.m_data[1],
42  m_data[2]+a_v.m_data[2],
43  m_data[3]+a_v.m_data[3]);
44  }

◆ operator+=()

vec4f& tools::vec4f::operator+= ( const vec4f a_v)
inline

Definition at line 51 of file vec4f.

51  {
52  m_data[0] += a_v.m_data[0];
53  m_data[1] += a_v.m_data[1];
54  m_data[2] += a_v.m_data[2];
55  m_data[3] += a_v.m_data[3];
56  return *this;
57  }

◆ operator-() [1/2]

vec4f tools::vec4f::operator- ( ) const
inline

Definition at line 65 of file vec4f.

65  {
66  return vec4f(-m_data[0],-m_data[1],-m_data[2],-m_data[3]);
67  }

◆ operator-() [2/2]

vec4f tools::vec4f::operator- ( const vec4f a_v) const
inline

Definition at line 45 of file vec4f.

45  {
46  return vec4f(m_data[0]-a_v.m_data[0],
47  m_data[1]-a_v.m_data[1],
48  m_data[2]-a_v.m_data[2],
49  m_data[3]-a_v.m_data[3]);
50  }

◆ operator=()

vec4f& tools::vec4f::operator= ( const vec4f a_from)
inline

Definition at line 28 of file vec4f.

28  {
29  parent::operator=(a_from);
30  return *this;
31  }

◆ TOOLS_SCLASS()

tools::vec4f::TOOLS_SCLASS ( tools::vec4f  )
inline

Definition at line 16 of file vec4f.

17  :
18  vec4f():parent() {}

The documentation for this class was generated from the following file:
tools::vec4< float >::divide
bool divide(const float &a_T)
Definition: vec4:186
tools::vec4< float >::m_data
float m_data[4]
Definition: vec4:262
tools::vec4< float >::operator=
vec4 & operator=(const vec4 &a_from)
Definition: vec4:77
tools::vec4f::length
float length() const
Definition: vec4f:71
tools::vec4f::vec4f
vec4f(const float a_vec[4])
Definition: vec4f:19