|
|
|
@ -758,24 +758,30 @@ void Subdiv2D::getTriangleList(std::vector<Vec6f>& triangleList) const |
|
|
|
|
triangleList.clear(); |
|
|
|
|
int i, total = (int)(qedges.size()*4); |
|
|
|
|
std::vector<bool> edgemask(total, false); |
|
|
|
|
Rect2f rect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); |
|
|
|
|
const bool filterPoints = true; |
|
|
|
|
Rect2f rect(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); |
|
|
|
|
|
|
|
|
|
for( i = 4; i < total; i += 2 ) |
|
|
|
|
{ |
|
|
|
|
if( edgemask[i] ) |
|
|
|
|
continue; |
|
|
|
|
Point2f a, b, c; |
|
|
|
|
int edge = i; |
|
|
|
|
edgeOrg(edge, &a); |
|
|
|
|
edgemask[edge] = true; |
|
|
|
|
edge = getEdge(edge, NEXT_AROUND_LEFT); |
|
|
|
|
edgeOrg(edge, &b); |
|
|
|
|
edgemask[edge] = true; |
|
|
|
|
edge = getEdge(edge, NEXT_AROUND_LEFT); |
|
|
|
|
edgeOrg(edge, &c); |
|
|
|
|
edgemask[edge] = true; |
|
|
|
|
if( rect.contains(a) && rect.contains(b) && rect.contains(c) ) |
|
|
|
|
triangleList.push_back(Vec6f(a.x, a.y, b.x, b.y, c.x, c.y)); |
|
|
|
|
int edge_a = i; |
|
|
|
|
edgeOrg(edge_a, &a); |
|
|
|
|
if (filterPoints && !rect.contains(a)) |
|
|
|
|
continue; |
|
|
|
|
int edge_b = getEdge(edge_a, NEXT_AROUND_LEFT); |
|
|
|
|
edgeOrg(edge_b, &b); |
|
|
|
|
if (filterPoints && !rect.contains(b)) |
|
|
|
|
continue; |
|
|
|
|
int edge_c = getEdge(edge_b, NEXT_AROUND_LEFT); |
|
|
|
|
edgeOrg(edge_c, &c); |
|
|
|
|
if (filterPoints && !rect.contains(c)) |
|
|
|
|
continue; |
|
|
|
|
edgemask[edge_a] = true; |
|
|
|
|
edgemask[edge_b] = true; |
|
|
|
|
edgemask[edge_c] = true; |
|
|
|
|
triangleList.push_back(Vec6f(a.x, a.y, b.x, b.y, c.x, c.y)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|