clray

view src/vector.h @ 51:9c0867942612

changed the binary target to clray
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 02 Sep 2010 01:41:51 +0100
parents
children 6a30f27fa1e6
line source
1 #ifndef VECTOR_H_
2 #define VECTOR_H_
4 class Vector2 {
5 public:
6 float x, y;
8 Vector2();
9 Vector2(float x, float y);
10 };
12 class Vector3 {
13 public:
14 float x, y, z;
16 Vector3();
17 Vector3(float x, float y, float z);
19 void normalize();
20 inline float length();
21 inline float lengthsq();
22 };
24 inline Vector3 operator +(const Vector3 &a, const Vector3 &b);
25 inline Vector3 operator -(const Vector3 &a, const Vector3 &b);
26 inline Vector3 operator *(const Vector3 &a, const Vector3 &b);
27 inline Vector3 operator /(const Vector3 &a, const Vector3 &b);
29 inline Vector3 operator -(const Vector3 &vec);
30 inline Vector3 operator *(const Vector3 &vec, float s);
32 inline float dot(const Vector3 &a, const Vector3 &b);
33 inline Vector3 cross(const Vector3 &a, const Vector3 &b);
35 #include "vector.inl"
37 #endif /* VECTOR_H_ */