9 #define MIN(a,b) ((a)<(b)?(a):(b))
10 #define MAX(a,b) ((a)>(b)?(a):(b))
13 #define max(a,b) MAX(a,b)
14 #define min(a,b) MIN(a,b)
17 #define Infinity HUGE_VAL
19 //! Standard operators and useful methods for 3d vectors
20 //! Fill in the missing parts in Vec3f.cxx
25 Vec3f(float x, float y, float z);
29 Vec3f(const Vec3f& o);
30 Vec3f& operator=(const Vec3f& o);
33 float operator|(const Vec3f& o);
34 float dot(const Vec3f& o);
37 Vec3f operator%(const Vec3f& o);
38 Vec3f cross(const Vec3f& o);
42 //! length of a vector
45 //! (self-)multiply with scalar
46 Vec3f operator*(const float t) const;
47 Vec3f& operator*=(const float t);
49 //! (self-)division by scalar
50 Vec3f operator/(const float t) const;
51 Vec3f& operator/=(const float t);
53 //! vector (self-)addition
54 Vec3f operator+(const Vec3f& o) const;
55 Vec3f& operator+=(const Vec3f& o);
57 //! vector (self-)subtraction
58 Vec3f operator-(const Vec3f& o) const;
59 Vec3f& operator-=(const Vec3f& o);
61 //! component-wise multiplication of two vectors
62 Vec3f operator*(const Vec3f& o) const;
63 Vec3f& operator*=(const Vec3f& o);
65 //! component-wise division of two vectors
66 Vec3f operator/(const Vec3f& o) const;
67 Vec3f& operator/=(const Vec3f& o);
69 //! element access functions ( read-only and read-write )
70 float operator[](unsigned int i) const;
71 float& operator[](unsigned int i);
77 inline std::ostream& operator<<(std::ostream& o, const Vec3f& v)
79 o << "(" << v[0] << "," << v[1] << "," << v[2] << ")";