Small optimization on sphere

This commit is contained in:
David 2021-08-20 23:43:44 +02:00
commit 3aea707982
2 changed files with 13 additions and 6 deletions

View file

@ -58,7 +58,13 @@ struct vec3 {
double length() const
{
return sqrt(x*x + y*y + z*z);
}
}
// Length squared, useful for some calculations
double length_squared() const
{
return x*x + y*y + z*z;
}
};
/* Type aliases */