本文整理汇总了C#中HelixToolkit.Wpf.MeshBuilder.AddRevolvedGeometry方法的典型用法代码示例。如果您正苦于以下问题:C# MeshBuilder.AddRevolvedGeometry方法的具体用法?C# MeshBuilder.AddRevolvedGeometry怎么用?C# MeshBuilder.AddRevolvedGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelixToolkit.Wpf.MeshBuilder
的用法示例。
在下文中一共展示了MeshBuilder.AddRevolvedGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGeometry
/// <summary>
/// The create geometry.
/// </summary>
private void CreateGeometry()
{
double r = this.Diameter / 2;
double l = this.HeadLength * this.Diameter;
// arrowhead
var pc = new PointCollection { new Point(-l, r), new Point(-l, r * 2), new Point(0, 0) };
var headBuilder = new MeshBuilder(false, false);
headBuilder.AddRevolvedGeometry(pc, null, new Point3D(0, 0, 0), new Vector3D(0, 0, 1), this.ThetaDiv);
this.head = headBuilder.ToMesh();
this.head.Freeze();
// body
pc = new PointCollection { new Point(0, 0), new Point(0, r), new Point(1, r) };
var bodyBuilder = new MeshBuilder(false, false);
bodyBuilder.AddRevolvedGeometry(pc, null, new Point3D(0, 0, 0), new Vector3D(0, 0, 1), this.ThetaDiv);
this.body = bodyBuilder.ToMesh();
this.body.Freeze();
}
示例2: AddRevolute
/// <summary>
/// Add a revolute geometry object. This is a surface starting at (0,0,0) and pointing up.
/// Its shape is defined by a set points (Y,Z) where Y is the vertical distance along the surface from 0 and Z is the radius of revolution.
/// </summary>
/// <param name="shapeName">The 3DView object.</param>
/// <param name="path">A space or colon deliminated list of 2D point coordinates describing the revolute shape.</param>
/// <param name="divisions">The radial divisions, default 10 (affects number of triangles and smoothness).</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 AddRevolute(Primitive shapeName, Primitive path, Primitive divisions, 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);
List<Point> points = new List<Point>();
string[] s = Utilities.getString(path).Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < s.Length; i += 2)
{
points.Add(new Point(Utilities.getDouble(s[i]), Utilities.getDouble(s[i + 1])));
}
int thetaDiv = divisions < 2 ? 10 : (int)divisions;
builder.AddRevolvedGeometry(points, new Point3D(0, 0, 0), new Vector3D(0, 1, 0), thetaDiv);
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 "";
}