当前位置: 首页>>代码示例>>C++>>正文


C++ MNMesh::CollapseDeadStructs方法代码示例

本文整理汇总了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 ();
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:31,代码来源:Symmetry.cpp

示例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 ();
	}
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:16,代码来源:Symmetry.cpp

示例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 ();
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:17,代码来源:PolyOps.cpp

示例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 ();
		}
	}
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:45,代码来源:EditPolyData.cpp


注:本文中的MNMesh::CollapseDeadStructs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。