diff --git a/src/Polar.cpp b/src/Polar.cpp index 7ba7ca1..5ca6055 100644 --- a/src/Polar.cpp +++ b/src/Polar.cpp @@ -34,8 +34,10 @@ Polar Polar::operator+(const Polar& v2) const { float deltaAngle = Angle::Normalize(v2.angle - this->angle); float rotation = deltaAngle < 0 ? 180 + deltaAngle : 180 - deltaAngle; - if (rotation == 180 && v2.distance > 0) - return Polar::zero; + if (rotation == 180 && v2.distance > 0) { + // angle is too small, take this angle and add the distances + return Polar(this->angle, this->distance + v2.distance); + } float newDistance = Angle::CosineRuleSide(v2.distance, this->distance, rotation);