Fix zero vector addition
This commit is contained in:
parent
99e4515358
commit
113f5a14f3
@ -30,6 +30,8 @@ float Polar::Distance(const Polar& v1, const Polar& v2) {
|
||||
Polar Polar::operator+(const Polar& v2) const {
|
||||
if (v2.distance == 0)
|
||||
return Polar(this->angle, this->distance);
|
||||
if (this->distance == 0)
|
||||
return v2;
|
||||
|
||||
float deltaAngle = Angle::Normalize(v2.angle - this->angle);
|
||||
float rotation = deltaAngle < 0 ? 180 + deltaAngle : 180 - deltaAngle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user