如何创建具有不同直径的3D管

时间:2022-06-11 14:18:46

I'm using Helix toolkit with WPF, and I'm trying to make a 3D image that includes a pipe/tube that has a varying diameter. Essentially, I'm trying to take a non-straight line and rotate it around an axis, creating a tube. I only care about the resulting tube, not the actual rotation (I'm not trying to visualize the rotation, I mean).

我正在使用带有WPF的Helix工具包,我正在尝试制作一个包含直径不同的管道/管道的3D图像。基本上,我试图采取非直线并围绕轴旋转,创建一个管。我只关心产生的管,而不是实际的旋转(我的意思是我不想看到旋转,我的意思)。

Is there a way to do this with Helix toolkit, or for that matter, with any other 3D surface generating tool? The best solution I've been able to come up with is to create a series of pipes with different diameters, but I can't figure out how to smooth the transitions between each of the pipes. This is also a less than ideal solution, because there are a lot of points on the pipe, so I end up with about 150 very small pipe segments. The documentation for Helix is somewhat lacking, but I've gone through the source code without finding an obvious solution.

有没有办法使用Helix工具包,或者就此而言,使用任何其他3D表面生成工具?我能够提出的最好的解决方案是创建一系列不同直径的管道,但我无法弄清楚如何平滑每个管道之间的过渡。这也是一个不太理想的解决方案,因为管道上有很多点,所以我最终得到了大约150个非常小的管段。 Helix的文档有点缺乏,但我已经完成了源代码而没有找到明显的解决方案。

1 个解决方案

#1


4  

MeshBuilder.AddRevolvedGeometry() or MeshBuilder.AddSurfaceOfRevolution() should do this.

MeshBuilder.AddRevolvedGeometry()或MeshBuilder.AddSurfaceOfRevolution()应该这样做。

See the source code with comments here and here saying

请在此处查看带有注释的源代码

/// <summary>
/// Adds a surface of revolution
/// </summary>
/// <param name="origin">The origin.</param>
/// <param name="axis">The axis.</param>
/// <param name="section">The points defining the curve to revolve.</param>
/// <param name="sectionIndices">The indices of the line segments of the section.</param>
/// <param name="thetaDiv">The number of divisions.</param>
/// <param name="textureValues">The texture values.</param>
public void AddSurfaceOfRevolution(
        Point3D origin, Vector3D axis, IList<Point> section, IList<int> sectionIndices,
        int thetaDiv = 37, IList<double> textureValues = null)

and

/// <summary>
/// Adds a surface of revolution.
/// </summary>
/// <param name="points">The points (x coordinates are distance from the origin along the axis of revolution, y coordinates are radius, )</param>
/// <param name="textureValues">The v texture coordinates, one for each point in the <paramref name="points" /> list.</param>
/// <param name="origin">The origin of the revolution axis.</param>
/// <param name="direction">The direction of the revolution axis.</param>
/// <param name="thetaDiv">The number of divisions around the mesh.</param>
/// <remarks>
/// See http://en.wikipedia.org/wiki/Surface_of_revolution.
/// </remarks>
public void AddRevolvedGeometry(IList<Point> points, IList<double> textureValues, Point3D origin, Vector3D direction, int thetaDiv)

#1


4  

MeshBuilder.AddRevolvedGeometry() or MeshBuilder.AddSurfaceOfRevolution() should do this.

MeshBuilder.AddRevolvedGeometry()或MeshBuilder.AddSurfaceOfRevolution()应该这样做。

See the source code with comments here and here saying

请在此处查看带有注释的源代码

/// <summary>
/// Adds a surface of revolution
/// </summary>
/// <param name="origin">The origin.</param>
/// <param name="axis">The axis.</param>
/// <param name="section">The points defining the curve to revolve.</param>
/// <param name="sectionIndices">The indices of the line segments of the section.</param>
/// <param name="thetaDiv">The number of divisions.</param>
/// <param name="textureValues">The texture values.</param>
public void AddSurfaceOfRevolution(
        Point3D origin, Vector3D axis, IList<Point> section, IList<int> sectionIndices,
        int thetaDiv = 37, IList<double> textureValues = null)

and

/// <summary>
/// Adds a surface of revolution.
/// </summary>
/// <param name="points">The points (x coordinates are distance from the origin along the axis of revolution, y coordinates are radius, )</param>
/// <param name="textureValues">The v texture coordinates, one for each point in the <paramref name="points" /> list.</param>
/// <param name="origin">The origin of the revolution axis.</param>
/// <param name="direction">The direction of the revolution axis.</param>
/// <param name="thetaDiv">The number of divisions around the mesh.</param>
/// <remarks>
/// See http://en.wikipedia.org/wiki/Surface_of_revolution.
/// </remarks>
public void AddRevolvedGeometry(IList<Point> points, IList<double> textureValues, Point3D origin, Vector3D direction, int thetaDiv)