Skip to content

Commit

Permalink
Remove typecasting in IsCollinear
Browse files Browse the repository at this point in the history
  • Loading branch information
reunanen committed Apr 28, 2024
1 parent 33ec483 commit 1e7fd20
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CPP/Clipper2Lib/include/clipper2/clipper.core.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,10 @@ namespace Clipper2Lib
inline bool IsCollinear(const Point<T>& pt1,
const Point<T>& sharedPt, const Point<T>& pt2) // #777
{
const double a = static_cast<double>(sharedPt.x - pt1.x);
const double b = static_cast<double>(pt2.y - sharedPt.y);
const double c = static_cast<double>(sharedPt.y - pt1.y);
const double d = static_cast<double>(pt2.x - sharedPt.x);
const auto a = sharedPt.x - pt1.x;
const auto b = pt2.y - sharedPt.y;
const auto c = sharedPt.y - pt1.y;
const auto d = pt2.x - sharedPt.x;
return a * b == c * d;
}

Expand Down

0 comments on commit 1e7fd20

Please sign in to comment.