本文整理汇总了C++中MNMesh::CollapseDeadStructs方法的典型用法代码示例。如果您正苦于以下问题:C++ MNMesh::CollapseDeadStructs方法的具体用法?C++ MNMesh::CollapseDeadStructs怎么用?C++ MNMesh::CollapseDeadStructs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MNMesh
的用法示例。
在下文中一共展示了MNMesh::CollapseDeadStructs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SlicePolyObject
void SymmetryMod::SlicePolyObject (MNMesh & mesh, Point3 & N, float offset) {
// Steve Anderson 9/14/2002
// Using the new "MN_MESH_TEMP_1" flag to override Slice selection behavior,
// which is undesirable here.
mesh.SetFlag (MN_MESH_TEMP_1);
// Slice off everything below the plane:
mesh.Slice (N, offset, MNEPS, false, true);
mesh.ClearFlag (MN_MESH_TEMP_1);
// Make sure we have a valid edge list:
if (!mesh.GetFlag (MN_MESH_FILLED_IN)) mesh.FillInMesh();
// Mark the vertices on the plane boundary:
mesh.ClearVFlags (MN_USER);
for (int i=0; i<mesh.numv; i++) {
if (mesh.v[i].GetFlag (MN_DEAD)) continue;
float dist = DotProd (N, mesh.P(i)) - offset;
if (fabsf(dist) > MNEPS) continue;
mesh.v[i].SetFlag (MN_USER);
}
// Strip out faces on the mirror plane: (These aren't always removed by slice.)
// Find the faces that use only mirror-plane vertices:
mesh.ClearFFlags (MN_USER);
mesh.PropegateComponentFlags (MNM_SL_FACE, MN_USER,
MNM_SL_VERTEX, MN_USER, true);
mesh.DeleteFlaggedFaces (MN_USER);
// Clear out dead components:
mesh.CollapseDeadStructs ();
}
示例2: WeldPolyObject
void SymmetryMod::WeldPolyObject (MNMesh & mesh, Point3 & N, float offset, float threshold) {
// Mark the vertices within the welding threshold of the plane:
mesh.ClearVFlags (MN_USER);
for (int i=0; i<mesh.numv; i++) {
if (mesh.v[i].GetFlag (MN_DEAD)) continue;
float dist = DotProd (N, mesh.P(i)) - offset;
if (fabsf(dist) > threshold) continue;
mesh.v[i].SetFlag (MN_USER);
}
// Do the welding:
if (mesh.WeldBorderVerts (threshold, MN_USER)) {
// If result was true, we have some MN_DEAD components:
mesh.CollapseDeadStructs ();
}
}
示例3: Do
void PolyOpWeldVertex::Do(MNMesh & mesh)
{
// Weld the suitable border vertices:
bool haveWelded = false;
if (mesh.WeldBorderVerts (mThreshold, MN_USER)) {
mesh.CollapseDeadStructs ();
haveWelded = true;
}
// Weld vertices that share short edges:
if (WeldShortPolyEdges (mesh, MN_USER)) haveWelded = true;
if (haveWelded) {
mesh.InvalidateTopoCache ();
mesh.FillInMesh ();
}
}
示例4: ApplyAllOperations
void EditPolyData::ApplyAllOperations (MNMesh & mesh)
{
#ifdef __DEBUG_PRINT_EDIT_POLY
DebugPrint (_T("EditPolyData::ApplyAllOperations\n"));
#endif
if (mpOpList) {
// Preallocate if possible. (Upon first application, this will do nothing.)
PolyOperationRecord* pOpRec = NULL;
int newFaces(0), newVertices(0), newEdges(0);
Tab<int> newMapVertices;
newMapVertices.SetCount (mesh.numm + NUM_HIDDENMAPS);
for (int mp=-NUM_HIDDENMAPS; mp<mesh.numm; mp++) newMapVertices[mp+NUM_HIDDENMAPS] = 0;
for (pOpRec=mpOpList; pOpRec != NULL; pOpRec=pOpRec->Next()) {
newFaces += pOpRec->Operation()->NewFaceCount();
newVertices += pOpRec->Operation()->NewVertexCount();
newEdges += pOpRec->Operation()->NewEdgeCount ();
for (int mp=-NUM_HIDDENMAPS; mp<mesh.numm; mp++) {
if (mesh.M(mp)->GetFlag (MN_DEAD)) continue;
newMapVertices[mp+NUM_HIDDENMAPS] += pOpRec->Operation()->NewMapVertexCount(mp);
}
}
mesh.VAlloc (mesh.numv + newVertices);
mesh.EAlloc (mesh.nume + newEdges);
mesh.FAlloc (mesh.numf + newFaces);
for (int mp=-NUM_HIDDENMAPS; mp<mesh.numm; mp++) {
MNMap *map = mesh.M(mp);
if (map->GetFlag (MN_DEAD)) continue;
map->VAlloc (map->numv + newMapVertices[mp+NUM_HIDDENMAPS]);
map->FAlloc (map->numf + newFaces);
}
for (pOpRec=mpOpList; pOpRec != NULL; pOpRec=pOpRec->Next())
{
#ifdef __DEBUG_PRINT_EDIT_POLY
DebugPrint (_T("EditPolyData::Applying %s\n"), pOpRec->Operation()->Name());
#endif
pOpRec->Operation()->SetUserFlags (mesh);
bool ret = pOpRec->Operation()->Apply (mesh, pOpRec->LocalData());
if (ret && pOpRec->Operation()->CanDelete()) mesh.CollapseDeadStructs ();
}
}
}