[Cmap-cvs] mp2mp mp_parser.cpp,1.12,1.13
Status: Beta
Brought to you by:
dyp
From: Denis P. <dy...@us...> - 2005-10-23 16:15:42
|
Update of /cvsroot/cmap/mp2mp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21806 Modified Files: mp_parser.cpp Log Message: Generate only one point for multiple elements Index: mp_parser.cpp =================================================================== RCS file: /cvsroot/cmap/mp2mp/mp_parser.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- mp_parser.cpp 21 Oct 2005 08:09:30 -0000 1.12 +++ mp_parser.cpp 23 Oct 2005 16:15:33 -0000 1.13 @@ -108,25 +108,25 @@ if (kind != op.kind && op.kind == kind::Point) { unsigned int layerMax = op.layerMax > 0 ? op.layerMax : op.layerMin; for (unsigned int i = op.layerMin; i <= layerMax; i++) { - for (Elements::const_iterator it2 = elements.begin(); it2 != elements.end(); it2++) { - point_t pt; - pt.x = 0.0; - pt.y = 0.0; - double count = 0.0; + point_t pt; + pt.x = 0.0; + pt.y = 0.0; + double count = 0.0; + for (Elements::const_iterator it2 = elements.begin(); it2 != elements.end(); it2++) { for (points_t::const_iterator it3 = (*it2).points.begin(); it3 != (*it2).points.end(); it3++) { pt.x += (*it3).x; pt.y += (*it3).y; count += 1.0; } + } - pt.x /= count; - pt.y /= count; + pt.x /= count; + pt.y /= count; - fprintf(f, "Data%d=", i); - pt.print(f, is6Digit); - fprintf(f, "\n"); - } + fprintf(f, "Data%d=", i); + pt.print(f, is6Digit); + fprintf(f, "\n"); } } else { unsigned int layerMax = op.layerMax > 0 ? op.layerMax : op.layerMin; |