fix: division by zero in normalizing
parent
1d7c318a3d
commit
4fb9a645d8
|
@ -59,7 +59,8 @@ Vecf Vecf::rotated(float t) const {
|
|||
}
|
||||
|
||||
Vecf Vecf::normalized() const {
|
||||
return *this / this->magnitude();
|
||||
float const magnitude{this->magnitude()};
|
||||
return magnitude > 0.f ? *this / this->magnitude() : ce::Vecf::ZERO;
|
||||
}
|
||||
|
||||
Vecf Vecf::reciprocal() const {
|
||||
|
|
Loading…
Reference in New Issue