Minor style fixup of calc_points_inside().
This commit is contained in:
parent
4d1fafa2b6
commit
e6d15f9a83
1 changed files with 8 additions and 25 deletions
|
@ -640,20 +640,6 @@ static void calc_point_inside( TGContourNode *node, TGPolygon &p ) {
|
||||||
|
|
||||||
if ( contour_num < 0 )
|
if ( contour_num < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
* Find a line intersecting the contour and intersect it with the segments
|
|
||||||
* of our children. Sort the intersection points along the line. They then
|
|
||||||
* partition the line in IN/OUT parts. Find the longest segment and take
|
|
||||||
* its midpoint as point inside the contour.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Try to find a line on which none of the contour points lie. For that,
|
|
||||||
* sort all contour points (also those of our direct children) by
|
|
||||||
* y-coordinate, find the two with the largest distance and take their
|
|
||||||
* center y-coordinate.
|
|
||||||
*/
|
|
||||||
point_list allpoints;
|
point_list allpoints;
|
||||||
|
|
||||||
collect_contour_points( node, p, allpoints );
|
collect_contour_points( node, p, allpoints );
|
||||||
|
@ -670,24 +656,21 @@ static void calc_point_inside( TGContourNode *node, TGPolygon &p ) {
|
||||||
|
|
||||||
sort(allpoints.begin(), allpoints.end(), Point3DOrdering(PY));
|
sort(allpoints.begin(), allpoints.end(), Point3DOrdering(PY));
|
||||||
|
|
||||||
point_list::iterator point_it;
|
|
||||||
|
|
||||||
point_it=allpoints.begin();
|
|
||||||
|
|
||||||
double yline; // the y-location of the intersection line
|
|
||||||
|
|
||||||
while ((++point_it) != allpoints.end()) {
|
|
||||||
double diff=point_it->y()-(point_it-1)->y();
|
|
||||||
if (diff<=8.0*SG_EPSILON) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
yline=point_it->y()-diff/2.0;
|
|
||||||
|
|
||||||
// cout << "calc_point_inside() " << allpoints.size() << " points ";
|
// cout << "calc_point_inside() " << allpoints.size() << " points ";
|
||||||
// copy(allpoints.begin(), allpoints.end(), ostream_iterator<Point3D>(cout, " "));
|
// copy(allpoints.begin(), allpoints.end(), ostream_iterator<Point3D>(cout, " "));
|
||||||
// cout << endl;
|
// cout << endl;
|
||||||
|
|
||||||
// cout << "calc_point_inside() maxdiff=" << maxdiff << " yline=" << yline << endl;
|
point_list::iterator point_it;
|
||||||
|
|
||||||
|
point_it=allpoints.begin();
|
||||||
|
|
||||||
|
for (++point_it;point_it!=allpoints.end();++point_it) {
|
||||||
|
double diff=point_it->y()-(point_it-1)->y();
|
||||||
|
// cout << "calc_point_inside() diff=" << diff << endl;
|
||||||
|
if (diff<=8.0*SG_EPSILON) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
double yline=point_it->y()-diff/2.0; // the y-location of the intersection line
|
||||||
|
|
||||||
vector < double > xcuts;
|
vector < double > xcuts;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue