简体   繁体   English

C#,显示和导航结构 3D FEM model(螺旋工具包,SharpDX?)

[英]C#, display and navigate structural 3D FEM model (helix-toolkit, SharpDX?)

有限元法示例

Hello.你好。 I am trying to implement a simple way to display the deformed shape of a beam, I found HelixToolkit that offers perfect tools, but I can't find the way to display different tiles of the same mesh with a different colour.我正在尝试实现一种简单的方法来显示梁的变形形状,我发现 HelixToolkit 提供了完美的工具,但我找不到以不同颜色显示同一网格的不同图块的方法。 or gradient: I found this: https://github.com/helix-toolkit/helix-toolkit/issues/885 that is the adding of the VertColorMaterial property, but it looks like it is for SharpDX library, but I started with HelixToolkit wpf (don't understand if in HelixToolkit is also available).或渐变:我发现了这个: https://github.com/helix-toolkit/helix-toolkit/issues/885这是添加了 VertColorMaterial 属性,但它看起来像是用于 SharpDX 库,但我从 HelixToolkit 开始wpf(不明白HelixToolkit中是否也有)。

I can't even find a way to do it with SharpDX: it looks that there is almost no doc in internet.我什至找不到使用 SharpDX 的方法:看起来互联网上几乎没有文档。

Additionaly, SharpDX stopped its developement.此外,SharpDX 停止了其开发。

So:所以:

  • do you know any example?你知道任何例子吗?
  • do you suggest me another library, which is fast/offers the ability of navigate the model, and it is compatible/use the wpf framework?您是否建议我使用另一个库,它快速/提供导航 model 的能力,并且它兼容/使用 wpf 框架?

I also would like the ability to refine and subdivide a mesh.我还想要细化和细分网格的能力。

Any kind of advice would be useful, I am new to the world of computer 3d graphic.任何建议都会很有用,我是计算机 3d 图形世界的新手。

Thanks谢谢

EDIT 1:编辑1:

I followed JonasH hint applying a texture, but it apply the texture for each tile.我遵循 JonasH 提示应用纹理,但它为每个图块应用纹理。 (See image). (见图)。

I can only dinstict by out materian and in materia (set in the picture as Hue and the arrow Texture).我只能通过 out materian 和 in materia 来区分(在图片中设置为色调和箭头纹理)。

I need to apply one color for each polygon to give to the mesh a "FEM" style.我需要为每个多边形应用一种颜色,以赋予网格“FEM”样式。 Do you know how is it possibile with HelixToolkit?您知道 HelixToolkit 是如何实现的吗? 具有应用纹理的 3d 网格

You might consider using Kitware VTK instead of HelixToolkit.您可以考虑使用 Kitware VTK 代替 HelixToolkit。 It's extremely powerful library for scientific data visualization, well documented, perfect for finite element pre and post processing.它是用于科学数据可视化的极其强大的库,有据可查,非常适合有限元前处理和后处理。 You can take a look on my app, unfortunately it has not been documented yet, but just as an example: https://github.com/galuszkm/STAN你可以看看我的应用程序,不幸的是它还没有被记录,但只是作为一个例子: https://github.com/galuszkm/STAN

I assume you have a color per vertex you want to use.我假设您要使用的每个顶点都有一种颜色。 I would recommend using wpf or helixToolkit wpf since they are quite easy to use.我建议使用 wpf 或 helixToolkit wpf,因为它们非常易于使用。 But as far as I'm aware they do not support vertex coloring.但据我所知,它们不支持顶点着色。

A workaround would be to use a texture.一种解决方法是使用纹理。 I would assume you want to visualize some scalar property as a color.我假设您想将一些标量属性可视化为颜色。 You would first need to create your MeshGeometry and assign the TextureCoordinates , simply assign the value you want to visualize to one of the texture coordinates in the 0-1 range.您首先需要创建MeshGeometry并分配TextureCoordinates ,只需将要可视化的值分配给 0-1 范围内的纹理坐标之一。 You would also need to create a gradient texture, either a gradientBrush or create an image.您还需要创建一个渐变纹理,或者是gradientBrush或创建一个图像。 You would then assign the brush like:然后,您可以像这样分配画笔:

        var brush = new ImageBrush()
        {
            ImageSource = new BitmapImage(new Uri("gradient.png", UriKind.Relative))
        };
           
        var material = new DiffuseMaterial(brush);
        GeometryModel3D model = new GeometryModel3D(mesh, material);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM