本文整理匯總了C#中System.Windows.Media.Media3D.Point3D.Count方法的典型用法代碼示例。如果您正苦於以下問題:C# Point3D.Count方法的具體用法?C# Point3D.Count怎麽用?C# Point3D.Count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Media3D.Point3D
的用法示例。
在下文中一共展示了Point3D.Count方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreatePolygonModel
public Model3DGroup CreatePolygonModel(Point3D[] points)
{
MeshGeometry3D mesh = new MeshGeometry3D();
int indexPoints = 0;
int totalPoints = points.Count();
for (indexPoints = 0; indexPoints < totalPoints; indexPoints++)
{
mesh.Positions.Add(points.ElementAt(indexPoints));
}
//Solo se necesitan tres puntos para poder obtener la normal del triangulo
for (int i = 0; i < 3; i++)
{
mesh.TriangleIndices.Add(i);
}
//Para obtener el vector normal solo se necesitan tres puntos del plano
Vector3D normal = CalculateNormal(points.ElementAt(0), points.ElementAt(1), points.ElementAt(2));
//¿Checar por que se agrega 3 veces la normal?
//for (int i = 0; i < 3; i++)
//{
mesh.Normals.Add(normal);
//}
Material material = new DiffuseMaterial(new SolidColorBrush(Colors.DarkCyan));
GeometryModel3D model = new GeometryModel3D(mesh, material);
Model3DGroup group = new Model3DGroup();
group.Children.Add(model);
return group;
}
示例2: Point3DToPointArrays
public static double[,] Point3DToPointArrays(Point3D[] points)
{
double[,] vectors = new double[points.Count(), 4];
for (int i = 0; i < points.Count(); i++)
{
double x = points[i].X;
double y = points[i].Y;
double z = points[i].Z;
vectors[i, 0] = x;
vectors[i, 1] = y;
vectors[i, 2] = z;
vectors[i, 3] = 1;
}
return vectors;
}