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

Public Member Functions

 TOOLS_SCLASS (tools::vec2f) public
 
 vec2f (const float a_vec[2])
 
 vec2f (float a0, float a1)
 
virtual ~vec2f ()
 
 vec2f (const vec2f &a_from)
 
vec2foperator= (const vec2f &a_from)
 
 vec2f (const parent &a_from)
 
vec2f operator* (float a_v) const
 
vec2f operator+ (const vec2f &a_v) const
 
vec2f operator- (const vec2f &a_v) const
 
vec2foperator+= (const vec2f &a_v)
 
vec2foperator*= (float a_v)
 
vec2f operator- () const
 
float length () const
 
float normalize ()
 
bool equals (const vec2f &a_v, const float a_epsil) const
 
void negate ()
 
- Public Member Functions inherited from tools::vec2< float >
unsigned int dimension () const
 
 vec2 ()
 
 vec2 (const float a_vec[2])
 
 vec2 (const float &a0, const float &a1)
 
 vec2 (const vec2 &a_from)
 
virtual ~vec2 ()
 
vec2operator= (const vec2 &a_from)
 
const float & v0 () const
 
void v0 (const float &a_value)
 
const float & v1 () const
 
void v1 (const float &a_value)
 
const float & x () const
 
float & x ()
 
const float & y () const
 
float & y ()
 
void set_value (const float &a0, const float &a1)
 
void set_value (const float aV[2])
 
void value (float &a0, float &a1) const
 
float length (float(*a_sqrt)(float)) const
 
float normalize (float(*a_sqrt)(float))
 
float dot (const vec2 &aV) const
 
float cross (const vec2 &aV) const
 
bool equal (const vec2 &aV) const
 
bool divide (const float &a_T)
 
void add (const vec2 &a_v)
 
void add (const float &a0, const float &a1)
 
void subtract (const vec2 &a_v)
 
void subtract (const float &a0, const float &a1)
 
float & operator[] (size_t a_index)
 
const float & operator[] (size_t a_index) const
 
vec2 operator+ (const vec2 &a_v) const
 
vec2 operator- (const vec2 &a_v) const
 
vec2 operator* (const float &a_v) const
 
bool operator== (const vec2 &a_v) const
 
bool operator!= (const vec2 &a_v) const
 
size_type size () const
 
const float * data () const
 
const float * getValue () const
 
void getValue (float &a0, float &a1) const
 
void setValue (const float &a0, const float &a1)
 
void setValue (const float aV[2])
 

Additional Inherited Members

- Public Types inherited from tools::vec2< float >
typedef float elem_t
 
typedef unsigned int size_type
 
- Protected Attributes inherited from tools::vec2< float >
float m_data [2]
 

Detailed Description

Definition at line 13 of file vec2f.

Constructor & Destructor Documentation

◆ vec2f() [1/4]

tools::vec2f::vec2f ( const float  a_vec[2])
inline

Definition at line 19 of file vec2f.

19 :parent(a_vec){}

◆ vec2f() [2/4]

tools::vec2f::vec2f ( float  a0,
float  a1 
)
inline

Definition at line 20 of file vec2f.

20 :parent(a0,a1){}

◆ ~vec2f()

virtual tools::vec2f::~vec2f ( )
inlinevirtual

Definition at line 21 of file vec2f.

21 {}

◆ vec2f() [3/4]

tools::vec2f::vec2f ( const vec2f a_from)
inline

Definition at line 23 of file vec2f.

23 : parent(a_from){}

◆ vec2f() [4/4]

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

Definition at line 29 of file vec2f.

29 :parent(a_from){}

Member Function Documentation

◆ equals()

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

Definition at line 74 of file vec2f.

74  {
75  //if(a_epsil<0.0f))
76  float d0 = m_data[0]-a_v.m_data[0];
77  float d1 = m_data[1]-a_v.m_data[1];
78  return ((d0*d0+d1*d1)<=a_epsil);
79  }

◆ length()

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

Definition at line 60 of file vec2f.

60  {
61  return float(::sqrt(m_data[0]*m_data[0]+m_data[1]*m_data[1]));
62  }

◆ negate()

void tools::vec2f::negate ( )
inline

Definition at line 80 of file vec2f.

80  {
81  m_data[0] = -m_data[0];
82  m_data[1] = -m_data[1];
83  }

◆ normalize()

float tools::vec2f::normalize ( )
inline

Definition at line 63 of file vec2f.

63  {
64  float norme = length();
65  if(!norme) return 0;
66  divide(norme);
67  return norme;
68  }

◆ operator*()

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

Definition at line 32 of file vec2f.

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

◆ operator*=()

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

Definition at line 49 of file vec2f.

49  {
50  m_data[0] *= a_v;
51  m_data[1] *= a_v;
52  return *this;
53  }

◆ operator+()

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

Definition at line 36 of file vec2f.

36  {
37  return vec2f(m_data[0]+a_v.m_data[0],
38  m_data[1]+a_v.m_data[1]);
39  }

◆ operator+=()

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

Definition at line 44 of file vec2f.

44  {
45  m_data[0] += a_v.m_data[0];
46  m_data[1] += a_v.m_data[1];
47  return *this;
48  }

◆ operator-() [1/2]

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

Definition at line 54 of file vec2f.

54  {
55  return vec2f(-m_data[0],-m_data[1]);
56  }

◆ operator-() [2/2]

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

Definition at line 40 of file vec2f.

40  {
41  return vec2f(m_data[0]-a_v.m_data[0],
42  m_data[1]-a_v.m_data[1]);
43  }

◆ operator=()

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

Definition at line 24 of file vec2f.

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

◆ TOOLS_SCLASS()

tools::vec2f::TOOLS_SCLASS ( tools::vec2f  )
inline

Definition at line 16 of file vec2f.

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

The documentation for this class was generated from the following file:
tools::vec2< float >::m_data
float m_data[2]
Definition: vec2:197
tools::vec2f::length
float length() const
Definition: vec2f:60
tools::vec2< float >::divide
bool divide(const float &a_T)
Definition: vec2:123
tools::vec2< float >::operator=
vec2 & operator=(const vec2 &a_from)
Definition: vec2:61
tools::vec2f::vec2f
vec2f(const float a_vec[2])
Definition: vec2f:19