简体   繁体   中英

Modify 3D Coordinates on Axes Drawn in WPF When the Camera Perspective Changes Like Matlab View

I'm using Helix3D.WPF Library to draw 3D geometry meshes inside a Helix3D viewport and I'm using a perspective camera to change the view perspective.

I cannot draw dynamic axes that could adapt to the view perspective as the camera perspective changes (rotate, pan or zoom) like the ones drawn in 3D plot in Matlab.

Here , here and here are pictures that demonstrate how Matlab does that.

Here is the XAML code of my WPF window

<Window x:Class="CancerDoseCalculation.Views.Plot3DWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:CancerDoseCalculation.Views"
    xmlns:helix="clr-namespace:HelixToolkit.Wpf;assembly=HelixToolkit.Wpf"
    mc:Ignorable="d"
    Title="Plot3DWindow" Height="700" Width="Auto">

    <helix:HelixViewport3D 
        x:Name="viewport" 
        Grid.Row="1" 
        ZoomExtentsWhenLoaded="True" 
        PanGesture="LeftClick" 
        ShowViewCube="True"
        ShowCameraInfo="True"
        ShowCameraTarget="True"
        ShowCoordinateSystem="True"
        ZoomSensitivity="2"
        Width="600"
        Height="600"
        Grid.Column="1" Background="#FF0F0B0B">



        <helix:HelixViewport3D.Camera>
            <PerspectiveCamera x:Name="perspectiveCamera" LookDirection="1,1,-1" UpDirection="0,0,1" FieldOfView="40"/>
        </helix:HelixViewport3D.Camera>

        <ModelVisual3D x:Name="ModelVisual3D">
            <ModelVisual3D.Content>
                <Model3DGroup x:Name="Model3DGroup">
                    <DirectionalLight Color="White" Direction="-1,1,-1" />
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D Positions="0,0,0 10,0,0 10,10,0 0,10,0 0,0,10 
                    10,0,10 10,10,10 0,10,10"
                                            TriangleIndices="0 1 3 1 2 3  0 4 3 4 7 3  4 6 7 4 5 6 
                                     0 4 1 1 4 5  1 2 6 6 5 1  2 3 7 7 6 2"/>
                        </GeometryModel3D.Geometry>
                        <GeometryModel3D.Material>
                            <DiffuseMaterial Brush="Red"/>
                        </GeometryModel3D.Material>
                    </GeometryModel3D>
            </Model3DGroup>
            </ModelVisual3D.Content>
        </ModelVisual3D>
        <helix:DefaultLights />


    </helix:HelixViewport3D>

您必须创建自己的3D视觉效果才能实现这种类型的绘图。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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