49 dot(
const float3& v1,
const float3& v2)
51 return v1.x * v2.x + v1.y*v2.y + v1.z*v2.z;
57 vec.x += v; vec.y += v; vec.z += v;
return vec;
63 vec.x += v.x; vec.y += v.y; vec.z += v.z;
return vec;
69 return make_float3 (v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
75 vec.x *= v; vec.y *= v; vec.z *= v;
return vec;
81 vec.x -= v; vec.y -= v; vec.z -= v;
return vec;
87 vec.x -= v.x; vec.y -= v.y; vec.z -= v.z;
return vec;
93 return make_float3 (v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
99 return make_float3 (-v1.x, -v1.y, -v1.z);
105 v1.x = -v1.x; v1.y = -v1.y; v1.z = -v1.z;
return v1;
111 return make_float3 (v1.x * v, v1.y * v, v1.z * v);
117 return sqrt (
dot (v, v));
123 os <<
"[" << v1.x <<
", " << v1.y <<
", " << v1.z<<
"]";
134 cross(
const float3& v1,
const float3& v2)
136 return make_float3 (v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
float3 & operator-=(float3 &vec, const float &v)
float3 & operator*=(float3 &vec, const float &v)
float3 operator-(const float3 &v1, const float3 &v2)
float3 operator+(const float3 &v1, const float3 &v2)
float norm(const float3 &v)
std::ostream & operator<<(std::ostream &os, const float3 &v1)
float3 operator*(const float3 &v1, const float &v)
float3 cross(const float3 &v1, const float3 &v2)
float dot(const float3 &v1, const float3 &v2)
float3 & operator+=(float3 &vec, const float &v)