本文整理汇总了C#中Geometry.Tessellate方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.Tessellate方法的具体用法?C# Geometry.Tessellate怎么用?C# Geometry.Tessellate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.Tessellate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TesselateSurface
/// <summary>
/// Tesselates a Dynamo geometry and returns the vertices as Point lists. Needed to generate Radiance geometry from freeform or not closed geometry.
/// </summary>
/// <param name="geometry">the dynamo geometry</param>
/// <param name="tolerance">tesselation tolerance</param>
/// <returns></returns>
public static List<List<Point>> TesselateSurface(Geometry geometry, double tolerance)
{
var triangleList = new List<List<Point>>();
var t = new DefaultRenderPackageFactory
{
TessellationParameters =
{
MaxTessellationDivisions = 500,
Tolerance = tolerance
}
};
var rp = t.CreateRenderPackage();
geometry.Tessellate(rp, t.TessellationParameters);
var vertexArray = rp.MeshVertices.ToArray();
for (var i = 0; i < vertexArray.Length; i += 9)
{
var trianglePoints = new List<Point>
{
Point.ByCoordinates(vertexArray[i],
vertexArray[i + 1], vertexArray[i + 2]),
Point.ByCoordinates(vertexArray[i + 3], vertexArray[i + 4],
vertexArray[i + 5]),
Point.ByCoordinates(vertexArray[i + 6], vertexArray[i + 7],
vertexArray[i + 8])
};
triangleList.Add(trianglePoints);
}
return triangleList;
}