-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove typecasting in
IsCollinear
(#825)
* Remove typecasting in `IsCollinear` * Update the C# and Delphi versions as well * In the C++ version, multiply unsigned numbers (so that the result just wraps, and there is no undefined behavior) * Add test case for `IsCollinear`
- Loading branch information
Showing
5 changed files
with
21 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <gtest/gtest.h> | ||
#include "clipper2/clipper.core.h" | ||
|
||
TEST(Clipper2Tests, TestIsCollinear) { | ||
// a large integer not representable by double | ||
const int64_t i = 9007199254740993; | ||
|
||
const Clipper2Lib::Point64 pt1(0, 0); | ||
const Clipper2Lib::Point64 sharedPt(i, i * 10); | ||
const Clipper2Lib::Point64 pt2(i * 10, i * 100); | ||
|
||
EXPECT_TRUE(IsCollinear(pt1, sharedPt, pt2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters