本文整理汇总了C#中HelixToolkit.Wpf.MeshBuilder.AddPipe方法的典型用法代码示例。如果您正苦于以下问题:C# MeshBuilder.AddPipe方法的具体用法?C# MeshBuilder.AddPipe怎么用?C# MeshBuilder.AddPipe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelixToolkit.Wpf.MeshBuilder
的用法示例。
在下文中一共展示了MeshBuilder.AddPipe方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tessellate
protected override MeshGeometry3D Tessellate()
{
double width = Columns*grid - margin*2;
double length = Rows*grid - margin*2;
double height = Height*plateThickness;
var builder = new MeshBuilder(true, true);
for (int i = 0; i < Columns; i++)
for (int j = 0; j < Rows; j++)
{
var o = new Point3D((i + 0.5)*grid, (j + 0.5)*grid, height);
builder.AddCone(o, new Vector3D(0, 0, 1), knobDiameter/2, knobDiameter/2, knobHeight, false, true,
Divisions);
builder.AddPipe(new Point3D(o.X, o.Y, o.Z - wallThickness), new Point3D(o.X, o.Y, wallThickness),
knobDiameter, outerDiameter, Divisions);
}
builder.AddBox(new Point3D(Columns * 0.5 * grid, Rows * 0.5 * grid, height - wallThickness / 2), width, length,
wallThickness,
MeshBuilder.BoxFaces.All);
builder.AddBox(new Point3D(margin + wallThickness / 2, Rows * 0.5 * grid, height / 2 - wallThickness / 2),
wallThickness, length, height - wallThickness,
MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
builder.AddBox(
new Point3D(Columns * grid - margin - wallThickness / 2, Rows * 0.5 * grid, height / 2 - wallThickness / 2),
wallThickness, length, height - wallThickness,
MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
builder.AddBox(new Point3D(Columns * 0.5 * grid, margin + wallThickness / 2, height / 2 - wallThickness / 2),
width, wallThickness, height - wallThickness,
MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
builder.AddBox(
new Point3D(Columns * 0.5 * grid, Rows * grid - margin - wallThickness / 2, height / 2 - wallThickness / 2),
width, wallThickness, height - wallThickness,
MeshBuilder.BoxFaces.All ^ MeshBuilder.BoxFaces.Top);
return builder.ToMesh();
}
示例2: UpdateGeometry
/// <summary>
/// Updates the geometry.
/// </summary>
protected override void UpdateGeometry()
{
var mb = new MeshBuilder(false, false);
var p0 = new Point3D(0, 0, 0);
var d = this.Axis;
d.Normalize();
var p1 = p0 - (d * this.Length * 0.5);
var p2 = p0 + (d * this.Length * 0.5);
mb.AddPipe(p1, p2, this.InnerDiameter, this.Diameter, 60);
this.Model.Geometry = mb.ToMesh();
}
示例3: Tessellate
/// <summary>
/// Do the tesselation and return the <see cref="MeshGeometry3D"/>.
/// </summary>
/// <returns>A triangular mesh geometry.</returns>
protected override MeshGeometry3D Tessellate()
{
var builder = new MeshBuilder(false,false);
builder.AddPipe(this.Point1, this.Point2, this.InnerDiameter, this.Diameter, this.ThetaDiv);
return builder.ToMesh();
}
示例4: AddPipe
/// <summary>
/// Add a pipe geometry object pointing up with base centred at (0,0,0).
/// </summary>
/// <param name="shapeName">The 3DView object.</param>
/// <param name="length">The length of the pipe.</param>
/// <param name="innerDiameter">The inner diameter of the pipe.</param>
/// <param name="outerDiameter">The outer diameter of the pipe.</param>
/// <param name="divisions">The number of divisions for the pipe (default 18).</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 AddPipe(Primitive shapeName, Primitive length, Primitive innerDiameter, Primitive outerDiameter, 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);
builder.AddPipe(new Point3D(0, 0, 0), new Point3D(0, length, 0), innerDiameter, outerDiameter, divisions);
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 "";
}