Simplify behavior of SweepContext::InitEdges

pull/447/head
Joe Hermaszewski 2015-01-26 15:35:38 +00:00 committed by Joe Hermaszewski
parent a444bf48a1
commit 1cf81227c4
1 changed files with 3 additions and 3 deletions

View File

@ -97,10 +97,10 @@ void SweepContext::InitTriangulation()
void SweepContext::InitEdges(std::vector<Point*> polyline) void SweepContext::InitEdges(std::vector<Point*> polyline)
{ {
int num_points = polyline.size(); int num_points = polyline.size();
for (int i = 0; i < num_points; i++) { for (int i = 0; i < num_points - 1; i++) {
int j = i < num_points - 1 ? i + 1 : 0; edge_list.push_back(new Edge(*polyline[i], *polyline[i + 1]));
edge_list.push_back(new Edge(*polyline[i], *polyline[j]));
} }
edge_list.push_back(new Edge(*polyline.back(), *polyline.front()));
} }
Point* SweepContext::GetPoint(const int& index) Point* SweepContext::GetPoint(const int& index)