Files
UnrealEngineUWP/Engine/Plugins/Experimental/GeometryProcessing/Source/DynamicMesh/Private/Selections/MeshVertexSelection.cpp
Ryan Schmidt e196c256e4 GeometryProcessing: remove forwarding headers used in GeometryCore transition, and update all affected includes.
#rb none
#rnx
#jira none
#preflight 60c52c5db9446100014da02d

[CL 16653115 by Ryan Schmidt in ue5-main branch]
2021-06-13 00:35:22 -04:00

71 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Selections/MeshVertexSelection.h"
#include "Selections/MeshFaceSelection.h"
#include "Selections/MeshEdgeSelection.h"
#include "DynamicMesh/DynamicMesh3.h"
#include "ExplicitUseGeometryMathTypes.h" // using UE::Geometry::(math types)
using namespace UE::Geometry;
// convert face selection to vertex selection.
FMeshVertexSelection::FMeshVertexSelection(const FDynamicMesh3* mesh, const FMeshFaceSelection& convertT) : Mesh(mesh)
{
for (int tid : convertT) {
FIndex3i tv = Mesh->GetTriangle(tid);
add(tv.A); add(tv.B); add(tv.C);
}
}
// convert edge selection to vertex selection.
FMeshVertexSelection::FMeshVertexSelection(const FDynamicMesh3* mesh, const FMeshEdgeSelection& convertE) : Mesh(mesh)
{
for (int eid : convertE) {
FIndex2i ev = Mesh->GetEdgeV(eid);
add(ev.A); add(ev.B);
}
}
void FMeshVertexSelection::SelectTriangleVertices(const FMeshFaceSelection& Triangles)
{
for (int tid : Triangles)
{
FIndex3i tri = Mesh->GetTriangle(tid);
add(tri.A); add(tri.B); add(tri.C);
}
}
void FMeshVertexSelection::SelectInteriorVertices(const FMeshFaceSelection& Triangles)
{
TSet<int> borderv;
for (int tid : Triangles) {
FIndex3i tv = Mesh->GetTriangle(tid);
for ( int j = 0; j < 3; ++j ) {
int vid = tv[j];
if (Selected.Contains(vid) || borderv.Contains(vid))
{
continue;
}
bool full_ring = true;
for (int ring_tid : Mesh->VtxTrianglesItr(vid))
{
if (Triangles.IsSelected(ring_tid) == false)
{
full_ring = false;
break;
}
}
if (full_ring)
{
add(vid);
}
else
{
borderv.Add(vid);
}
}
}
}