本文整理汇总了C#中HelixToolkit.Wpf.MeshBuilder.AddPyramid方法的典型用法代码示例。如果您正苦于以下问题:C# MeshBuilder.AddPyramid方法的具体用法?C# MeshBuilder.AddPyramid怎么用?C# MeshBuilder.AddPyramid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelixToolkit.Wpf.MeshBuilder
的用法示例。
在下文中一共展示了MeshBuilder.AddPyramid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddGeometry
GeometryModel3D AddGeometry(IEnumerable<Point3D> centers, double l)
{
var builder = new MeshBuilder();
foreach (var center in centers)
{
builder.AddPyramid(center, l, l, true);
}
var mv = new GeometryModel3D
{
Geometry = builder.ToMesh(true),
Material = MaterialHelper.CreateMaterial(Brushes.Gold)
};
TriangleCount = builder.TriangleIndices.Count / 3;
return mv;
}
示例2: AddPyramid
/// <summary>
/// Add a pyramid geometry object pointing up with base centred at (0,0,0).
/// </summary>
/// <param name="shapeName">The 3DView object.</param>
/// <param name="sideLength">The radius of the base.</param>
/// <param name="height">The height of the cone.</param>
/// <param name="colour">A colour or gradient brush for the object.</param>
/// <param name="materialType">A material for the object.
/// The available options are:
/// "E" Emmissive - constant brightness.
/// "D" Diffusive - affected by lights.
/// "S" Specular - specular highlights.
/// </param>
/// <returns>The 3DView Geometry name.</returns>
public static Primitive AddPyramid(Primitive shapeName, Primitive sideLength, Primitive height, Primitive colour, Primitive materialType)
{
UIElement obj;
try
{
if (_objectsMap.TryGetValue((string)shapeName, out obj))
{
InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate
{
try
{
if (obj.GetType() == typeof(Viewport3D))
{
MeshBuilder builder = new MeshBuilder(true, true);
builder.AddPyramid(new Point3D(0, 0, 0), sideLength, height);
MeshGeometry3D mesh = builder.ToMesh();
Viewport3D viewport3D = (Viewport3D)obj;
return AddGeometry(viewport3D, mesh.Positions, mesh.TriangleIndices, mesh.Normals, mesh.TextureCoordinates, colour, materialType);
}
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
return "";
});
return FastThread.InvokeWithReturn(ret).ToString();
}
else
{
Utilities.OnShapeError(Utilities.GetCurrentMethod(), shapeName);
}
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
return "";
}