Example #1
0
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;
}
Example #2
0
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;
}
Example #3
0
float dot(const vec3f& v1, const vec4f& v2){
    return ((v1.peekx()*v2.peekx())+
            (v1.peeky()*v2.peeky())+
            (v1.peekz()*v2.peekz()));
}
Example #4
0
vec3f operator*(const vec3f& v1, const vec3f &v2)
{
	return vec3f(v1.peekx()*v2.peekx(),
                 v1.peeky()*v2.peeky(),
                 v1.peekz()*v2.peekz());
}
Example #5
0
vec3f operator*(const float k, const vec3f& v1){
    return vec3f(v1.peekx()*k,
                 v1.peeky()*k,
                 v1.peekz()*k);
}