本文整理汇总了C++中PointSet::LoadFromMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::LoadFromMesh方法的具体用法?C++ PointSet::LoadFromMesh怎么用?C++ PointSet::LoadFromMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointSet
的用法示例。
在下文中一共展示了PointSet::LoadFromMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WeldVertices
void BaseMesh::WeldVertices(float Epsilon, Vector<UINT> &OldToNewMapping)
{
PointSet MyPoints;
MyPoints.LoadFromMesh(*this);
KDTree3 &Tree = MyPoints.KDTree();
UINT VC = VertexCount(), IC = IndexCount();
MeshVertex *V = Vertices();
DWORD *I = Indices();
OldToNewMapping.ReSize(VC);
OldToNewMapping.Clear(VC);
Vector<UINT> NNResult;
//MeshVertex *VStorage = new MeshVertex[VC];
for(UINT VertexIndex = 0; VertexIndex < VC; VertexIndex++)
{
Vec3f Pos = V[VertexIndex].Pos;
Tree.WithinDistance(Pos, Epsilon, NNResult);
bool MatchFound = false;
//VStorage[VertexIndex] = V[VertexIndex];
for(UINT ResultIndex = 0; ResultIndex < NNResult.Length() && !MatchFound; ResultIndex++)
{
UINT CurIndex = NNResult[ResultIndex];
if(OldToNewMapping[CurIndex] != VC)
{
MatchFound = true;
OldToNewMapping[VertexIndex] = CurIndex;
}
}
if(!MatchFound)
{
OldToNewMapping[VertexIndex] = VertexIndex;
}
}
//DWORD *IStorage = new DWORD[IC];
for(UINT IndexIndex = 0; IndexIndex < IC; IndexIndex++)
{
I[IndexIndex] = OldToNewMapping[UINT(I[IndexIndex])];
}
//Allocate(
//delete[] VStorage;
Vector<UINT> SecondMapping, SplitToUnsplit = OldToNewMapping;
CleanVerticesAndTriangles(SecondMapping);
for(UINT VertexIndex = 0; VertexIndex < VC; VertexIndex++)
{
OldToNewMapping[VertexIndex] = SecondMapping[SplitToUnsplit[VertexIndex]];
}
}