~glmark2-dev/glmark2/libmatrix-util

« back to all changes in this revision

Viewing changes to vector.h

  • Committer: Alexandros Frantzis
  • Date: 2010-07-12 10:06:29 UTC
  • Revision ID: git-v1:32841650dbc96bb732093df311cbc7425515e5ab
Use waf for build system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _VECTOR_H
2
 
#define _VECTOR_H
3
 
 
4
 
#include "oglsdl.h"
5
 
 
6
 
#include <stdio.h>
7
 
#include <math.h>
8
 
 
9
 
class Vector3f
10
 
{
11
 
    union
12
 
    {    
13
 
        struct { GLfloat x; GLfloat y; GLfloat z; };
14
 
        GLfloat v[3];
15
 
    };
16
 
 
17
 
public:
18
 
 
19
 
    Vector3f();
20
 
    Vector3f(GLfloat pX, GLfloat pY, GLfloat pZ);
21
 
 
22
 
    void display();
23
 
    float length();
24
 
    void normalize();
25
 
    
26
 
    Vector3f &operator=(const Vector3f &pV);
27
 
    Vector3f &operator+=(const Vector3f &pV);
28
 
    Vector3f &operator-=(const Vector3f &pV);
29
 
    Vector3f &operator*=(float pF);
30
 
    Vector3f &operator/=(float pF);
31
 
    Vector3f &operator*=(double pF);
32
 
};
33
 
 
34
 
extern Vector3f operator+(const Vector3f &pA, const Vector3f &pB);
35
 
extern Vector3f operator-(const Vector3f &pA, const Vector3f &pB);
36
 
extern Vector3f operator*(const Vector3f &pA, const float &pB);
37
 
extern Vector3f operator/(const Vector3f &pA, const float &pB);
38
 
 
39
 
extern Vector3f operator*(const Vector3f &pA, const double &pB);
40
 
 
41
 
extern float dot(const Vector3f &pA, const Vector3f &pB);
42
 
extern Vector3f cross(const Vector3f &pA, const Vector3f &pB);
43
 
extern Vector3f normal(const Vector3f &pA, const Vector3f &pB, const Vector3f &pC);
44
 
 
45
 
#endif