简体   繁体   English

如何在 WPF 3D HelixToolkit 中显示图形边缘

[英]How to show figure edges in WPF 3D HelixToolkit

Good day.美好的一天。 How to show figure edges in WPF?如何在 WPF 中显示图形边缘? I implement figure in WPF, but i'm need to get figure wireframe.我在 WPF 中实现了图形,但我需要获取图形线框。 I tried to find any HelixToolkit manual, but it failed.我试图找到任何 HelixToolkit 手册,但它失败了。 Can you give me HelixToolkit manual?你能给我 HelixToolkit 手册吗?

My code:我的代码:

<h:HelixViewport3D ClipToBounds="true">
    <h:DefaultLights/>
    <h:LinesVisual3D Thickness="10">
        <ModelVisual3D>
            <ModelVisual3D.Content>
                <GeometryModel3D>
                    <GeometryModel3D.Geometry>
                        <MeshGeometry3D
                        Positions=" 0,3,3 -3,3,3
                                    -3,0,3 3,0,3
                                    -3,0,-3 -3,3,0"
                        TriangleIndices="   0,1,2 2,3,0 5,0,3
                                            3,4,5 5,4,2 1,5,2
                                            0,5,1 3,2,4"/>
                    </GeometryModel3D.Geometry>
                    <GeometryModel3D.Material>
                        <MaterialGroup>
                            <DiffuseMaterial Brush="GreenYellow" />
                            <SpecularMaterial Brush="WhiteSmoke" SpecularPower="30"></SpecularMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.Material>
                </GeometryModel3D>
            </ModelVisual3D.Content>
            <ModelVisual3D.Transform>
                <Transform3DGroup>
                    <RotateTransform3D>
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D x:Name="RotateHorizontal" Axis="0 1 0" />
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                    <RotateTransform3D>
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D x:Name="RotateVertical" Axis="1 0 0" />
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                </Transform3DGroup>
            </ModelVisual3D.Transform>
        </ModelVisual3D>
    </h:LinesVisual3D>
</h:HelixViewport3D>

There are no built in features to achieve this goal.没有内置功能可以实现此目标。 You problem can be split up into to different ones:您的问题可以分为不同的问题:

  1. How to get the sharp edge of your model,如何获得模型的锐利边缘,
  2. How to draw lines with WPF (or Helix).如何使用 WPF(或 Helix)绘制线条。

(1) To get those, you might need to build the topology of your mesh -> knowing the triangles connectivity. (1) 要获得这些,您可能需要构建网格的拓扑 -> 了解三角形连接。 I recommend the HalfEdge data structure (there are others ling WingEdge if you're curious).我推荐 HalfEdge 数据结构(如果你好奇,还有其他的 ling WingEdge)。

(2) WPF does not provide anything on that side, Helix has made an attempt but i don't recommend it... Your best shot would be to build small rectangle (using 2 triangles). (2) WPF 在那一边没有提供任何东西,Helix 已经尝试过,但我不推荐它......你最好的办法是构建小矩形(使用 2 个三角形)。

Here is an example of what it can do (I use OpenGL and an overlay in light blue, don't bother).这是它可以做什么的一个例子(我使用OpenGL和浅蓝色的叠加层,不要打扰)。

Without sharp edges :没有锋利的边缘:

没有锋利的边缘

With sharp edges in dark blue :带有深蓝色锐边:

带有深蓝色锐边

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

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