Mesh: apply std::ranges
This commit is contained in:
@@ -403,8 +403,7 @@ void MeshEvalTopology::GetFacetManifolds(std::vector<FacetIndex>& raclFacetIndLi
|
||||
PointIndex ulPt1 = std::max<PointIndex>(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]);
|
||||
std::pair<PointIndex, PointIndex> edge = std::make_pair(ulPt0, ulPt1);
|
||||
|
||||
if (std::find(nonManifoldList.begin(), nonManifoldList.end(), edge)
|
||||
!= nonManifoldList.end()) {
|
||||
if (std::ranges::find(nonManifoldList, edge) != nonManifoldList.end()) {
|
||||
raclFacetIndList.push_back(pI - rclFAry.begin());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +182,7 @@ bool WriterOBJ::Save(std::ostream& out)
|
||||
for (auto it = rFacets.begin(); it != rFacets.end(); ++it, index++) {
|
||||
if (index == 0 || prev != Kd[index]) {
|
||||
prev = Kd[index];
|
||||
auto c_it = std::find(colors.begin(), colors.end(), prev);
|
||||
if (c_it != colors.end()) {
|
||||
if (auto c_it = std::ranges::find(colors, prev); c_it != colors.end()) {
|
||||
out << "usemtl material_" << (c_it - colors.begin()) << '\n';
|
||||
}
|
||||
}
|
||||
@@ -224,8 +223,7 @@ bool WriterOBJ::Save(std::ostream& out)
|
||||
if (first || prev != Kd[it]) {
|
||||
first = false;
|
||||
prev = Kd[it];
|
||||
auto c_it = std::find(colors.begin(), colors.end(), prev);
|
||||
if (c_it != colors.end()) {
|
||||
if (auto c_it = std::ranges::find(colors, prev); c_it != colors.end()) {
|
||||
out << "usemtl material_" << (c_it - colors.begin()) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void MeshSurfaceSegment::AddSegment(const std::vector<FacetIndex>& segm)
|
||||
MeshSegment MeshSurfaceSegment::FindSegment(FacetIndex index) const
|
||||
{
|
||||
for (const auto& segment : segments) {
|
||||
if (std::find(segment.begin(), segment.end(), index) != segment.end()) {
|
||||
if (std::ranges::find(segment, index) != segment.end()) {
|
||||
return segment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,10 +940,10 @@ bool MeshTopoAlgorithm::CollapseVertex(const VertexCollapse& vc)
|
||||
const std::vector<FacetIndex>& faces = vc._circumFacets;
|
||||
// get neighbours that are not part of the faces to be removed
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (std::find(faces.begin(), faces.end(), rFace2._aulNeighbours[i]) == faces.end()) {
|
||||
if (std::ranges::find(faces, rFace2._aulNeighbours[i]) == faces.end()) {
|
||||
neighbour1 = rFace2._aulNeighbours[i];
|
||||
}
|
||||
if (std::find(faces.begin(), faces.end(), rFace3._aulNeighbours[i]) == faces.end()) {
|
||||
if (std::ranges::find(faces, rFace3._aulNeighbours[i]) == faces.end()) {
|
||||
neighbour2 = rFace3._aulNeighbours[i];
|
||||
}
|
||||
}
|
||||
@@ -1106,8 +1106,7 @@ bool MeshTopoAlgorithm::CollapseEdge(const EdgeCollapse& ec)
|
||||
for (FacetIndex nbIndex : f._aulNeighbours) {
|
||||
// get the neighbours of the facet that won't be invalidated
|
||||
if (nbIndex != FACET_INDEX_MAX) {
|
||||
if (std::find(ec._removeFacets.begin(), ec._removeFacets.end(), nbIndex)
|
||||
== ec._removeFacets.end()) {
|
||||
if (std::ranges::find(ec._removeFacets, nbIndex) == ec._removeFacets.end()) {
|
||||
neighbours.push_back(nbIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,9 +323,8 @@ void MeshFaceAddition::showMarker(SoPickedPoint* pp)
|
||||
SbVec3f face_pnt;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int index = (int)f._aulPoints[i];
|
||||
if (std::find(faceView->index.begin(), faceView->index.end(), index)
|
||||
!= faceView->index.end()) {
|
||||
int index = static_cast<int>(f._aulPoints[i]);
|
||||
if (std::ranges::find(faceView->index, index) != faceView->index.end()) {
|
||||
continue; // already inside
|
||||
}
|
||||
if (f._aulNeighbours[i] == MeshCore::FACET_INDEX_MAX
|
||||
@@ -524,9 +523,9 @@ void MeshFillHole::closeBridge()
|
||||
{
|
||||
// Do the hole-filling
|
||||
Gui::WaitCursor wc;
|
||||
auto it = std::find(myPolygon.begin(), myPolygon.end(), myVertex1);
|
||||
auto jt = std::find(myPolygon.begin(), myPolygon.end(), myVertex2);
|
||||
if (it != myPolygon.end() && jt != myPolygon.end()) {
|
||||
auto it = std::ranges::find(myPolygon, myVertex1);
|
||||
if (auto jt = std::ranges::find(myPolygon, myVertex2);
|
||||
it != myPolygon.end() && jt != myPolygon.end()) {
|
||||
// which iterator comes first
|
||||
if (jt < it) {
|
||||
std::swap(it, jt);
|
||||
|
||||
@@ -568,10 +568,10 @@ void MeshSelection::pickFaceCallback(void* ud, SoEventCallback* n)
|
||||
if (!vp || !vp->isDerivedFrom<ViewProviderMesh>()) {
|
||||
return;
|
||||
}
|
||||
ViewProviderMesh* mesh = static_cast<ViewProviderMesh*>(vp);
|
||||
MeshSelection* self = static_cast<MeshSelection*>(ud);
|
||||
std::list<ViewProviderMesh*> views = self->getViewProviders();
|
||||
if (std::find(views.begin(), views.end(), mesh) == views.end()) {
|
||||
const auto mesh = static_cast<ViewProviderMesh*>(vp);
|
||||
const auto self = static_cast<MeshSelection*>(ud);
|
||||
if (std::list<ViewProviderMesh*> views = self->getViewProviders();
|
||||
std::ranges::find(views, mesh) == views.end()) {
|
||||
return;
|
||||
}
|
||||
const SoDetail* detail = point->getDetail(/*mesh->getShapeNode()*/);
|
||||
|
||||
Reference in New Issue
Block a user