vertex.hh (957B)
1 #ifndef _GEOMETRY_VERTEX_HH_ 2 #define _GEOMETRY_VERTEX_HH_ 3 4 #include "all_includes.hh" 5 6 class Vertex { 7 public : 8 float x; 9 float y; 10 float z; 11 12 public : 13 Vertex(); 14 Vertex(float x, float y, float z); 15 float norm() const; 16 Vertex projectOn(Vertex v) const; 17 Vertex setNorm(float n) const; 18 Vertex normalize() const; 19 float cosAngle(Vertex v) const; // cosinus de l'angle entre this et v. 20 float angle(Vertex v) const; // Angle entre this et v. 21 static Vertex fromSpherical(float r, float xAngle, float yAngle); 22 23 public : 24 friend std::ostream& operator<<(std::ostream& os, const Vertex& v); 25 friend Vertex operator+(const Vertex& u, const Vertex& v); 26 friend Vertex operator-(const Vertex& u, const Vertex& v); 27 friend Vertex operator-(const Vertex& v); 28 friend Vertex operator*(const Vertex& v, const float n); // Cross product 29 friend Vertex operator*(const Vertex& u, const Vertex& v); 30 friend Vertex operator/(const Vertex& v, const float f); 31 }; 32 33 #endif