Skip to content

Commit 5bbad2f

Browse files
committed
Merge branch 'gtest' into issue-8
2 parents f0a42b6 + f51da9b commit 5bbad2f

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

include/delaunator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ double Delaunator::get_triangle_area()
524524
return sum(vals);
525525
}
526526

527-
528527
std::size_t Delaunator::legalize(std::size_t a) {
529528
std::size_t i = 0;
530529
std::size_t ar = 0;

test/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ function(d_add_test _testfile)
2222
endfunction()
2323

2424
enable_testing()
25-
d_add_test(issue-2.cpp)
26-
d_add_test(issue-3.cpp)
25+
d_add_test(issue-8.cpp)
2726
d_add_test(delaunator.test.cpp)

test/issue-2.cpp renamed to test/issue-8.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,21 @@ std::ostream& operator<<(std::ostream& out, const Point2D& p)
2626
return out;
2727
}
2828

29-
Point2D rotate(Point2D const& p_in, Point2D const& center,
30-
double const& angle_deg)
29+
Point2D rotate(Point2D const& p_in, double const& angle_deg)
3130
{
3231
const double pi = 3.14159265358979323846;
3332
const double angle_rad = angle_deg * pi / 180.0;
3433
const double s = sin(angle_rad);
3534
const double c = cos(angle_rad);
3635
Point2D p;
3736

38-
// translate point back to origin:
39-
/**
40-
p.x = p_in.x - center.x;
41-
p.y = p_in.y - center.y;
42-
**/
4337
p = p_in;
4438

4539
// rotate point
4640
double tmp = p.x * c - p.y * s;
4741
p.y = p.x * s + p.y * c;
4842
p.x = tmp;
4943

50-
// translate point back:
51-
/**
52-
p.x += center.x;
53-
p.y += center.y;
54-
**/
55-
5644
return p;
5745
}
5846

@@ -70,15 +58,13 @@ bool approx(double v1, double v2)
7058

7159
void testRotation(double angle)
7260
{
73-
const size_t grid_size = 6;
74-
const Point2D center(0, 0);
75-
61+
const size_t grid_size = 6;
7662
std::vector<double> points;
7763

7864
// Generate rotated point grid of 1-by-1 squares.
7965
for (size_t x = 0; x < grid_size; ++x) {
8066
for (size_t y = 0; y < grid_size; ++y) {
81-
Point2D p = rotate(Point2D(x, y), center, angle);
67+
Point2D p = rotate(Point2D(x, y), angle);
8268
points.push_back(p.x);
8369
points.push_back(p.y);
8470
}
@@ -146,7 +132,6 @@ void testRotation(double angle)
146132

147133
TEST(Delaunator, issue_2)
148134
{
149-
// testRotation(0);
150135
for (double angle = 0; angle < 360; angle += .1)
151136
testRotation(angle);
152137
}

0 commit comments

Comments
 (0)