Skip to content

Commit

Permalink
Use move to replace points
Browse files Browse the repository at this point in the history
  • Loading branch information
GilesBathgate committed Jul 27, 2024
1 parent 4663f54 commit 32a4cda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions src/cgalprimitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,11 @@ void CGALPrimitive::transform(TransformMatrix* matrix)
if(nefPolyhedron) {
nefPolyhedron->transform(t);
} else {
QList<CGAL::Point3> nps;
for(const auto& pt: std::as_const(points))
nps.append(pt.transform(t));
points=nps;
QList<CGAL::Point3> transformedPoints;
for(const auto& pt: std::as_const(points)) {
transformedPoints.append(pt.transform(t));
}
points=std::move(transformedPoints);
}

//Only transform auxilliary modules children.
Expand Down Expand Up @@ -1084,11 +1085,11 @@ void CGALPrimitive::discrete(int places)
CGALDiscreteModifier n(places);
nefPolyhedron->delegate(n,false,false);
} else {
QList<CGAL::Point3> nps;
QList<CGAL::Point3> discretePoints;
for(const auto& pt: std::as_const(points)) {
nps.append(CGALDiscreteModifier::discretePoint(pt,places));
discretePoints.append(CGALDiscreteModifier::discretePoint(pt,places));
}
points=nps;
points=std::move(discretePoints);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/polyhedron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ void Polyhedron::transform(TransformMatrix* matrix)
#else
TransformMatrix* t=matrix;
#endif
QList<Point> nps;
for(const auto& p: getPoints()) {
nps.append(p.transform(t));
QList<Point> transformedPoints;
for(const auto& p: std::as_const(points)) {
transformedPoints.append(p.transform(t));
}
points=nps;
points=std::move(transformedPoints);

for(Primitive* p: getChildren())
p->transform(matrix);
Expand Down

0 comments on commit 32a4cda

Please sign in to comment.