void clamp(vec3f & v, float min, float max) { if(v.peekx() > max) v.x() = max; if(v.peekx() < min) v.x() = min; if(v.peeky() > max) v.y() = max; if(v.peeky() < min) v.y() = min; if(v.peekz() > max) v.z() = max; if(v.peekz() < min) v.z() = min; }
void clamp(vec3f & v, float vmin, float vmax) { if(v.peekx() > vmax) v.x() = vmax; if(v.peekx() < vmin) v.x() = vmin; if(v.peeky() > vmax) v.y() = vmax; if(v.peeky() < vmin) v.y() = vmin; if(v.peekz() > vmax) v.z() = vmax; if(v.peekz() < vmin) v.z() = vmin; }
float dot(const vec3f& v1, const vec4f& v2){ return ((v1.peekx()*v2.peekx())+ (v1.peeky()*v2.peeky())+ (v1.peekz()*v2.peekz())); }
vec3f operator*(const vec3f& v1, const vec3f &v2) { return vec3f(v1.peekx()*v2.peekx(), v1.peeky()*v2.peeky(), v1.peekz()*v2.peekz()); }
vec3f operator*(const float k, const vec3f& v1){ return vec3f(v1.peekx()*k, v1.peeky()*k, v1.peekz()*k); }