本文整理汇总了C#中System.Windows.Media.Media3D.Point3D.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# Point3D.ToArray方法的具体用法?C# Point3D.ToArray怎么用?C# Point3D.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.Point3D
的用法示例。
在下文中一共展示了Point3D.ToArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHullTriangles
/// <summary>
/// This is exposed so it can be called externally on a separate thread, then call this asteroid's constructor
/// in the main thread once this returns
/// </summary>
public static ITriangleIndexed[] GetHullTriangles(double radius)
{
const int NUMPOINTS = 60; // too many, and it looks too perfect
Exception lastException = null;
Random rand = StaticRandom.GetRandomForThread();
for (int infiniteLoopCntr = 0; infiniteLoopCntr < 50; infiniteLoopCntr++) // there is a slight chance that the convex hull generator will choke on the inputs. If so just retry
{
try
{
double minRadius = radius * .9d;
Point3D[] points = new Point3D[NUMPOINTS];
// Make a point cloud
for (int cntr = 0; cntr < NUMPOINTS; cntr++)
{
points[cntr] = Math3D.GetRandomVector_Spherical(minRadius, radius).ToPoint();
}
// Squash it
Transform3DGroup transform = new Transform3DGroup();
transform.Children.Add(new ScaleTransform3D(.33d + (rand.NextDouble() * .66d), .33d + (rand.NextDouble() * .66d), 1d)); // squash it
transform.Children.Add(new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRandomRotation()))); // giving it a random rotation, since it's always squashed along the same axiis
transform.Transform(points);
// Get a hull that wraps those points
ITriangleIndexed[] retVal = Math3D.GetConvexHull(points.ToArray());
// Get rid of unused points
retVal = TriangleIndexed.Clone_CondensePoints(retVal);
// Exit Function
return retVal;
}
catch (Exception ex)
{
lastException = ex;
}
}
throw new ApplicationException(lastException.ToString());
}