Esempio n. 1
0
Vector3* Vector3Normalize(Vector3* out, const Vector3* v){
	float s = v->x*v->x+v->y*v->y+v->z*v->z;
#ifdef _DEBUG
	if(s < EPSILON){
		printf("avoided divide by zero\n");
		return out;
	}
#endif
	return Vector3Scale(out, v, 1.0f/sqrtf(s));
}
Esempio n. 2
0
void Vector3Normalize(float *dst)
{
	float length = Vector3Length(dst);
	Vector3Scale(dst,1.0f/length);
}