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

Public Member Functions

 TOOLS_SCLASS (tools::vec3f) public
 
 vec3f (const float a_vec[3])
 
 vec3f (float a0, float a1, float a2)
 
virtual ~vec3f ()
 
 vec3f (const vec3f &a_from)
 
vec3foperator= (const vec3f &a_from)
 
 vec3f (const parent &a_from)
 
vec3f operator* (float a_v) const
 
vec3f operator+ (const vec3f &a_v) const
 
vec3f operator- (const vec3f &a_v) const
 
vec3foperator+= (const vec3f &a_v)
 
vec3foperator-= (const vec3f &a_v)
 
vec3foperator*= (float a_v)
 
vec3f operator- () const
 
float length () const
 
float normalize ()
 
bool cos_angle (const vec3f &a_v, float &a_cos) const
 
bool theta_phi (float &a_theta, float &a_phi) const
 
bool equals (const vec3f &a_v, const float a_epsil) const
 
void negate ()
 
- Public Member Functions inherited from tools::vec3< float >
unsigned int dimension () const
 
 vec3 ()
 
 vec3 (const float a_vec[3])
 
 vec3 (const float &a0, const float &a1, const float &a2)
 
 vec3 (const vec3 &a_from)
 
virtual ~vec3 ()
 
vec3operator= (const vec3 &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 & x () const
 
float & x ()
 
const float & y () const
 
float & y ()
 
const float & z () const
 
float & z ()
 
void set_value (const float &a0, const float &a1, const float &a2)
 
void set_value (const float aV[3])
 
void value (float &a0, float &a1, float &a2) const
 
float length (float(*a_sqrt)(float)) const
 
float normalize (float(*a_sqrt)(float))
 
float dot (const vec3 &aV) const
 
void cross (const vec3< float > &aV, vec3< float > &a_value) const
 
bool equal (const vec3 &aV) const
 
bool equal_prec (const vec3 &a_v, PREC a_prec, PREC(*a_fabs)(const float &)) const
 
vec3< float > _cross (const vec3< float > &aV) const
 
bool divide (const float &a_T)
 
void multiply (const float &a_T)
 
void add (const vec3 &a_v)
 
void add (const float &a0, const float &a1, const float &a2)
 
void subtract (const vec3 &a_v)
 
void subtract (const float &a0, const float &a1, const float &a2)
 
bool cos_angle (const vec3 &a_v, float &a_cos, float(*a_sqrt)(float)) const
 
bool theta_phi (float &a_theta, float &a_phi, float(*a_sqrt)(float), float(*a_atan2)(float, float)) const
 
float & operator[] (size_t a_index)
 
const float & operator[] (size_t a_index) const
 
vec3operator*= (const float &a_v)
 
vec3 operator+ (const vec3 &a_v) const
 
vec3 operator- (const vec3 &a_v) const
 
vec3 operator* (const float &a_v) const
 
vec3 operator/ (const float &a_v) const
 
bool operator== (const vec3 &a_v) const
 
bool operator!= (const vec3 &a_v) const
 
size_type size () const
 
const float * data () const
 
size_type data_size () const
 
const float * getValue () const
 
void getValue (float &a0, float &a1, float &a2) const
 
void setValue (const float &a0, const float &a1, const float &a2)
 
void setValue (const vec3 &a_v)
 
void setValue (const float aV[3])
 
vec3setValue (const vec3 &a_bary, const vec3 &a_v0, const vec3 &a_v1, const vec3 &a_v2)
 

Additional Inherited Members

- Public Types inherited from tools::vec3< float >
typedef float elem_t
 
typedef unsigned int size_type
 
- Static Public Member Functions inherited from tools::vec3< float >
static const vec3< float > & s_x ()
 
static const vec3< float > & s_y ()
 
static const vec3< float > & s_z ()
 
- Protected Attributes inherited from tools::vec3< float >
float m_data [3]
 

Detailed Description

Definition at line 13 of file vec3f.

Constructor & Destructor Documentation

◆ vec3f() [1/4]

tools::vec3f::vec3f ( const float  a_vec[3])
inline

Definition at line 19 of file vec3f.

19 :parent(a_vec){}

◆ vec3f() [2/4]

tools::vec3f::vec3f ( float  a0,
float  a1,
float  a2 
)
inline

Definition at line 20 of file vec3f.

20 :parent(a0,a1,a2){}

◆ ~vec3f()

virtual tools::vec3f::~vec3f ( )
inlinevirtual

Definition at line 21 of file vec3f.

21 {}

◆ vec3f() [3/4]

tools::vec3f::vec3f ( const vec3f a_from)
inline

Definition at line 23 of file vec3f.

23 :parent(a_from){}

◆ vec3f() [4/4]

tools::vec3f::vec3f ( const parent a_from)
inline

Definition at line 29 of file vec3f.

29 :parent(a_from){}

Member Function Documentation

◆ cos_angle()

bool tools::vec3f::cos_angle ( const vec3f a_v,
float &  a_cos 
) const
inline

Definition at line 80 of file vec3f.

80  {
81  //WARNING : if ret false, a_cos is not set.
82  float this_length = length();
83  if(this_length==0.0f) return false;
84  float a_v_length = a_v.length();
85  if(a_v_length==0.0f) return false;
86  a_cos = dot(a_v)/(this_length*a_v_length);
87  return true;
88  }

◆ equals()

bool tools::vec3f::equals ( const vec3f a_v,
const float  a_epsil 
) const
inline

Definition at line 99 of file vec3f.

99  {
100  //if(a_epsil<0.0f))
101  float d0 = m_data[0]-a_v.m_data[0];
102  float d1 = m_data[1]-a_v.m_data[1];
103  float d2 = m_data[2]-a_v.m_data[2];
104  return ((d0*d0+d1*d1+d2*d2)<=a_epsil);
105  }

◆ length()

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

Definition at line 71 of file vec3f.

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

◆ negate()

void tools::vec3f::negate ( )
inline

Definition at line 106 of file vec3f.

106  {
107  m_data[0] = -m_data[0];
108  m_data[1] = -m_data[1];
109  m_data[2] = -m_data[2];
110  }

◆ normalize()

float tools::vec3f::normalize ( )
inline

Definition at line 74 of file vec3f.

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

◆ operator*()

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

Definition at line 32 of file vec3f.

32  {
33  return vec3f(m_data[0]*a_v,
34  m_data[1]*a_v,
35  m_data[2]*a_v);
36  }

◆ operator*=()

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

Definition at line 59 of file vec3f.

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

◆ operator+()

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

Definition at line 37 of file vec3f.

37  {
38  return vec3f(m_data[0]+a_v.m_data[0],
39  m_data[1]+a_v.m_data[1],
40  m_data[2]+a_v.m_data[2]);
41  }

◆ operator+=()

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

Definition at line 47 of file vec3f.

47  {
48  m_data[0] += a_v.m_data[0];
49  m_data[1] += a_v.m_data[1];
50  m_data[2] += a_v.m_data[2];
51  return *this;
52  }

◆ operator-() [1/2]

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

Definition at line 65 of file vec3f.

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

◆ operator-() [2/2]

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

Definition at line 42 of file vec3f.

42  {
43  return vec3f(m_data[0]-a_v.m_data[0],
44  m_data[1]-a_v.m_data[1],
45  m_data[2]-a_v.m_data[2]);
46  }

◆ operator-=()

vec3f& tools::vec3f::operator-= ( const vec3f a_v)
inline

Definition at line 53 of file vec3f.

53  {
54  m_data[0] -= a_v.m_data[0];
55  m_data[1] -= a_v.m_data[1];
56  m_data[2] -= a_v.m_data[2];
57  return *this;
58  }

◆ operator=()

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

Definition at line 24 of file vec3f.

24  {
25  parent::operator=(a_from);
26  return *this;
27  }

◆ theta_phi()

bool tools::vec3f::theta_phi ( float &  a_theta,
float &  a_phi 
) const
inline

Definition at line 95 of file vec3f.

95  {
96  return parent::theta_phi(a_theta,a_phi,::sqrtf,::atan2f);
97  }

◆ TOOLS_SCLASS()

tools::vec3f::TOOLS_SCLASS ( tools::vec3f  )
inline

Definition at line 16 of file vec3f.

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

The documentation for this class was generated from the following file:
tools::vec3< float >::theta_phi
bool theta_phi(float &a_theta, float &a_phi, float(*a_sqrt)(float), float(*a_atan2)(float, float)) const
Definition: vec3:209
tools::vec3< float >::divide
bool divide(const float &a_T)
Definition: vec3:161
tools::vec3f::vec3f
vec3f(const float a_vec[3])
Definition: vec3f:19
tools::vec3< float >::operator=
vec3 & operator=(const vec3 &a_from)
Definition: vec3:69
tools::vec3< float >::m_data
float m_data[3]
Definition: vec3:310
tools::vec3f::length
float length() const
Definition: vec3f:71
tools::vec3< float >::dot
float dot(const vec3 &aV) const
Definition: vec3:125