本文整理匯總了C#中System.Windows.Media.Media3D.Point3DCollection.RemoveAt方法的典型用法代碼示例。如果您正苦於以下問題:C# Point3DCollection.RemoveAt方法的具體用法?C# Point3DCollection.RemoveAt怎麽用?C# Point3DCollection.RemoveAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Media3D.Point3DCollection
的用法示例。
在下文中一共展示了Point3DCollection.RemoveAt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TriangleSubdivide
/// <summary>
///
/// </summary>
/// <param name="vertices"></param>
/// <param name="normals"></param>
/// <param name="indices"></param>
/// <param name="textures"></param>
protected void TriangleSubdivide(Point3DCollection vertices,
Vector3DCollection normals,
Int32Collection indices,
PointCollection textures)
{
for (int i = 0; i < 3; i++)
{
verticesBase[2 - i] = vertices[vertices.Count - 1];
normalsBase[2 - i] = normals[vertices.Count - 1];
texturesBase[2 - i] = textures[vertices.Count - 1];
vertices.RemoveAt(vertices.Count - 1);
normals.RemoveAt(normals.Count - 1);
indices.RemoveAt(indices.Count - 1);
textures.RemoveAt(textures.Count - 1);
}
int indexStart = vertices.Count;
for (int slice = 0; slice <= Slices; slice++)
{
double weight = (double)slice / Slices;
Point3D vertex1 = Point3DWeight(verticesBase[0], verticesBase[1], weight);
Point3D vertex2 = Point3DWeight(verticesBase[0], verticesBase[2], weight);
Vector3D normal1 = Vector3DWeight(normalsBase[0], normalsBase[1], weight);
Vector3D normal2 = Vector3DWeight(normalsBase[0], normalsBase[2], weight);
Point texture1 = PointWeight(texturesBase[0], texturesBase[1], weight);
Point texture2 = PointWeight(texturesBase[0], texturesBase[2], weight);
for (int i = 0; i <= slice; i++)
{
weight = (double)i / slice;
if (Double.IsNaN(weight))
weight = 0;
vertices.Add(Point3DWeight(vertex1, vertex2, weight));
normals.Add(Vector3DWeight(normal1, normal2, weight));
textures.Add(PointWeight(texture1, texture2, weight));
}
}
for (int slice = 0; slice < Slices; slice++)
{
int base1 = (slice + 1) * slice / 2;
int base2 = base1 + slice + 1;
for (int i = 0; i <= 2 * slice; i++)
{
int half = i / 2;
if ((i & 1) == 0) // even
{
indices.Add(indexStart + base1 + half);
indices.Add(indexStart + base2 + half);
indices.Add(indexStart + base2 + half + 1);
}
else // odd
{
indices.Add(indexStart + base1 + half);
indices.Add(indexStart + base2 + half + 1);
indices.Add(indexStart + base1 + half + 1);
}
}
}
}