@@ -269,11 +269,11 @@ void Triangulation::calculate_boundaries()
269
269
auto it = boundary_edges.cbegin ();
270
270
int tri = it->tri ;
271
271
int edge = it->edge ;
272
- _boundaries.push_back ( Boundary () );
272
+ _boundaries.emplace_back ( );
273
273
Boundary& boundary = _boundaries.back ();
274
274
275
275
while (true ) {
276
- boundary.push_back ( TriEdge ( tri, edge) );
276
+ boundary.emplace_back ( tri, edge);
277
277
boundary_edges.erase (it);
278
278
_tri_edge_to_boundary_map[TriEdge (tri, edge)] =
279
279
BoundaryEdge (_boundaries.size ()-1 , boundary.size ()-1 );
@@ -624,7 +624,7 @@ void TriContourGenerator::clear_visited_flags(bool include_boundaries)
624
624
// Initialise _boundaries_visited.
625
625
_boundaries_visited.reserve (boundaries.size ());
626
626
for (const auto & boundary : boundaries) {
627
- _boundaries_visited.push_back ( BoundaryVisited ( boundary.size () ));
627
+ _boundaries_visited.emplace_back ( boundary.size ());
628
628
}
629
629
630
630
// Initialise _boundaries_used.
@@ -796,8 +796,7 @@ void TriContourGenerator::find_boundary_lines(Contour& contour,
796
796
if (startAbove && !endAbove) {
797
797
// This boundary edge is the start point for a contour line,
798
798
// so follow the line.
799
- contour.push_back (ContourLine ());
800
- ContourLine& contour_line = contour.back ();
799
+ ContourLine& contour_line = contour.emplace_back ();
801
800
TriEdge tri_edge = *itb;
802
801
follow_interior (contour_line, tri_edge, true , level, false );
803
802
}
@@ -830,8 +829,7 @@ void TriContourGenerator::find_boundary_lines_filled(Contour& contour,
830
829
831
830
if (decr_lower || incr_upper) {
832
831
// Start point for contour line, so follow it.
833
- contour.push_back (ContourLine ());
834
- ContourLine& contour_line = contour.back ();
832
+ ContourLine& contour_line = contour.emplace_back ();
835
833
TriEdge start_tri_edge = boundary[j];
836
834
TriEdge tri_edge = start_tri_edge;
837
835
@@ -859,8 +857,7 @@ void TriContourGenerator::find_boundary_lines_filled(Contour& contour,
859
857
const Boundary& boundary = boundaries[i];
860
858
double z = get_z (triang.get_triangle_point (boundary[0 ]));
861
859
if (z >= lower_level && z < upper_level) {
862
- contour.push_back (ContourLine ());
863
- ContourLine& contour_line = contour.back ();
860
+ ContourLine& contour_line = contour.emplace_back ();
864
861
for (auto edge : boundary) {
865
862
contour_line.push_back (triang.get_point_coords (
866
863
triang.get_triangle_point (edge)));
@@ -894,8 +891,7 @@ void TriContourGenerator::find_interior_lines(Contour& contour,
894
891
continue ; // Contour does not pass through this triangle.
895
892
896
893
// Found start of new contour line loop.
897
- contour.push_back (ContourLine ());
898
- ContourLine& contour_line = contour.back ();
894
+ ContourLine& contour_line = contour.emplace_back ();
899
895
TriEdge tri_edge = triang.get_neighbor_edge (tri, edge);
900
896
follow_interior (contour_line, tri_edge, false , level, on_upper);
901
897
@@ -1434,10 +1430,10 @@ TrapezoidMapTriFinder::initialize()
1434
1430
1435
1431
// Set up edges array.
1436
1432
// First the bottom and top edges of the enclosing rectangle.
1437
- _edges.push_back ( Edge (&_points[npoints], &_points[npoints+1 ], -1 , -1 ,
1438
- nullptr , nullptr ) );
1439
- _edges.push_back ( Edge (&_points[npoints+2 ], &_points[npoints+3 ], -1 , -1 ,
1440
- nullptr , nullptr ) );
1433
+ _edges.emplace_back (&_points[npoints], &_points[npoints+1 ], -1 , -1 ,
1434
+ nullptr , nullptr );
1435
+ _edges.emplace_back (&_points[npoints+2 ], &_points[npoints+3 ], -1 , -1 ,
1436
+ nullptr , nullptr );
1441
1437
1442
1438
// Add all edges in the triangulation that point to the right. Do not
1443
1439
// explicitly include edges that point to the left as the neighboring
@@ -1456,11 +1452,12 @@ TrapezoidMapTriFinder::initialize()
1456
1452
const Point* neighbor_point_below = (neighbor.tri == -1 ) ?
1457
1453
nullptr : _points + triang.get_triangle_point (
1458
1454
neighbor.tri , (neighbor.edge +2 )%3 );
1459
- _edges.push_back (Edge (start, end, neighbor.tri , tri,
1460
- neighbor_point_below, other));
1455
+ _edges.emplace_back (start, end, neighbor.tri , tri,
1456
+ neighbor_point_below, other);
1457
+ }
1458
+ else if (neighbor.tri == -1 ) {
1459
+ _edges.emplace_back (end, start, tri, -1 , other, nullptr );
1461
1460
}
1462
- else if (neighbor.tri == -1 )
1463
- _edges.push_back (Edge (end, start, tri, -1 , other, nullptr ));
1464
1461
1465
1462
// Set triangle associated with start point if not already set.
1466
1463
if (start->tri == -1 )
0 commit comments