研究一段WPF 3D 机械臂代码

Posted bcbobo21cn

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了研究一段WPF 3D 机械臂代码相关的知识,希望对你有一定的参考价值。

网上下一段代码,运行如下;显示了一个3D机械臂;

     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation",这是WPF命名空间,一般写在xaml头部,它的是这样的,<Viewport3D xmlns="......;

    代码的大段有:相机,变换,ModelVisual3D.Children里面有2个ModelVisual3D,第一个ModelVisual3D里面是光照,构建模型的代码在第二个ModelVisual3D里面;

看一下它使用的相机是OrthographicCamera,通常透视相机用的更多;OrthographicCamera没有近大远小的效果;

相机在屏幕之外,靠右靠上一点;往屏幕里边看,看的方向偏左偏下一点;

看一下摄像机的上方向,就是摄像机的顶部方向,UpDirection="-0.408204,0.816541,-0.408204",Y为正,那么摄像机顶部是向上的;现在双手平端一个摄像机,两手一样高,两手距离屏幕一样远;X为负,我理解应该是把左手放低一些;X轴正向是朝右;Z为负,就是右手不动,左手往前推进一些;Z轴正向是从屏幕出来,负向是往屏幕里边去;

然后看到当前这样一个;

 把上方向X值调为正,看到如下,似乎还没完全理解;

NearPlaneDistance="0.256789" FarPlaneDistance="0.770367",这两个值应是确定一个视野范围;把范围调小一点,看到如下,裁掉一部分,因为摄像机是斜的,斜着裁掉了一部分;

 

 对模型有一个旋转变换,

                <RotateTransform3D>
                    <RotateTransform3D.Rotation>
                        <AxisAngleRotation3D Angle="30" Axis="0,1,0"/>
                    </RotateTransform3D.Rotation>
                </RotateTransform3D>

角度可以调整;

 看到模型比较大,想加一个缩放变换缩小一些;在旋转变换的同一级别加入一个缩放变换,

                <ScaleTransform3D CenterX="0" CenterY="0" CenterZ="0" ScaleX="0.6" ScaleY="0.6" ScaleZ="0.6">
                </ScaleTransform3D>

提示出错,还不知道如何同时加入2种变换;

单独加缩放变换,缩小一些;

 

模型里面有数个<GeometryModel3D>,每个<GeometryModel3D>构造一个面;删除最后一个<GeometryModel3D>后如下,

 

 删除前面的一个<GeometryModel3D>如下;

如果把前面一个面的材质颜色改一下则如下;

    下回继续;还不知道它的坐标,就是<MeshGeometry3D Positions="0.400000,0.040000,0.050000 0.437401,.....,这些是如何来的,可能是某种软件导出的;

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid>  
  
  <Viewport3D xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Viewport3D.Camera>
        <OrthographicCamera Position="0.491531,0.298732,0.321531" LookDirection="-0.577382,-0.577288,-0.777382" UpDirection="-0.408204,0.816541,-0.408204" NearPlaneDistance="0.256789" FarPlaneDistance="0.770367" Width="0.513578"/>
    </Viewport3D.Camera>
    <Viewport3D.Children>
        <ModelVisual3D>
            <ModelVisual3D.Transform>
                <RotateTransform3D>
                    <RotateTransform3D.Rotation>
                        <AxisAngleRotation3D Angle="15" Axis="0,1,0"/>
                    </RotateTransform3D.Rotation>
                </RotateTransform3D>
            </ModelVisual3D.Transform>
            <ModelVisual3D.Children>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <Model3DGroup>
                            <Model3DGroup.Children>
                                <AmbientLight Color="#262626"/>
                                <DirectionalLight Color="#6F6F6F" Direction="3.150000,-8.090000,-4.960000"/>
                                <DirectionalLight Color="#454545" Direction="8.610000,4.820000,-1.640000"/>
                                <DirectionalLight Color="#332835" Direction="-9.490000,3.090000,0.600000"/>
                            </Model3DGroup.Children>
                        </Model3DGroup>
                    </ModelVisual3D.Content>
                </ModelVisual3D>
                <ModelVisual3D>
                    <ModelVisual3D.Transform>
                        <MatrixTransform3D Matrix="1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 "/>
                    </ModelVisual3D.Transform>
                    <ModelVisual3D.Content>
                        <Model3DGroup>
                            <Model3DGroup.Children>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,0.040000,0.050000 0.437401,-0.014184,0.050000 0.439708,-0.004821,0.050000 0.400000,0.040000,0.050000 0.000000,0.050000,0.050000 0.000000,-0.050000,0.050000 -0.010396,0.048907,0.050000 -0.020337,0.045677,0.050000 0.000000,-0.050000,0.050000 0.400000,-0.040000,0.050000 0.400000,0.040000,0.050000 0.409573,-0.038838,0.050000 0.418589,-0.035418,0.050000 0.418589,0.035418,0.050000 0.437401,0.014184,0.050000 0.426525,0.029940,0.050000 0.432919,0.022723,0.050000 0.439708,-0.004821,0.050000 0.439708,0.004821,0.050000 0.400000,0.040000,0.050000 0.437401,0.014184,0.050000 0.409573,0.038838,0.050000 0.418589,0.035418,0.050000 0.418589,-0.035418,0.050000 0.426525,-0.029940,0.050000 0.400000,0.040000,0.050000 0.432919,-0.022723,0.050000 0.437401,-0.014184,0.050000 -0.020337,0.045677,0.050000 -0.029389,0.040451,0.050000 0.000000,-0.050000,0.050000 -0.037157,0.033457,0.050000 -0.043301,0.025000,0.050000 -0.029389,-0.040451,0.050000 -0.043301,0.025000,0.050000 -0.047553,0.015451,0.050000 -0.029389,-0.040451,0.050000 -0.020337,-0.045677,0.050000 -0.043301,0.025000,0.050000 -0.010396,-0.048907,0.050000 0.000000,-0.050000,0.050000 -0.049726,-0.005226,0.050000 -0.047553,-0.015451,0.050000 -0.043301,-0.025000,0.050000 -0.047553,0.015451,0.050000 -0.049726,0.005226,0.050000 -0.029389,-0.040451,0.050000 -0.049726,-0.005226,0.050000 -0.037157,-0.033457,0.050000 -0.043301,-0.025000,0.050000 " Normals="0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 8,9,10 11,10,9 10,11,12 13,14,15 16,15,14 17,18,19 20,19,18 19,20,21 22,21,20 23,24,25 26,25,24 25,26,27 28,29,30 31,30,29 30,31,32 33,34,35 36,37,38 39,38,37 38,39,40 41,42,43 44,45,46 47,46,45 46,47,48 49,48,47 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.409573,-0.038838,0.000000 0.400000,-0.040000,0.000000 0.400000,0.040000,0.000000 0.400000,0.040000,0.000000 0.400000,-0.040000,0.000000 0.000000,0.050000,0.000000 0.000000,-0.050000,0.000000 -0.010396,-0.048907,0.000000 0.439708,-0.004821,0.000000 0.437401,-0.014184,0.000000 0.400000,0.040000,0.000000 0.432919,-0.022723,0.000000 0.409573,0.038838,0.000000 0.418589,0.035418,0.000000 0.437401,0.014184,0.000000 0.426525,0.029940,0.000000 0.432919,0.022723,0.000000 0.409573,0.038838,0.000000 0.437401,0.014184,0.000000 0.400000,0.040000,0.000000 0.439708,0.004821,0.000000 0.439708,-0.004821,0.000000 -0.029389,0.040451,0.000000 -0.020337,0.045677,0.000000 -0.029389,-0.040451,0.000000 0.432919,-0.022723,0.000000 0.426525,-0.029940,0.000000 0.400000,0.040000,0.000000 0.418589,-0.035418,0.000000 0.409573,-0.038838,0.000000 -0.043301,0.025000,0.000000 -0.037157,-0.033457,0.000000 -0.043301,-0.025000,0.000000 -0.010396,-0.048907,0.000000 -0.020337,-0.045677,0.000000 0.000000,0.050000,0.000000 -0.029389,-0.040451,0.000000 -0.010396,0.048907,0.000000 -0.020337,0.045677,0.000000 -0.037157,-0.033457,0.000000 -0.043301,0.025000,0.000000 -0.029389,-0.040451,0.000000 -0.037157,0.033457,0.000000 -0.029389,0.040451,0.000000 -0.043301,-0.025000,0.000000 -0.047553,-0.015451,0.000000 -0.043301,0.025000,0.000000 -0.049726,-0.005226,0.000000 -0.047553,0.015451,0.000000 -0.049726,0.005226,0.000000 " Normals="0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 8,9,10 11,10,9 12,13,14 15,14,13 14,15,16 17,18,19 20,19,18 19,20,21 22,23,24 25,26,27 28,27,26 27,28,29 30,31,32 33,34,35 36,35,34 35,36,37 38,37,36 39,40,41 42,41,40 41,42,43 44,45,46 47,46,45 46,47,48 49,48,47 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,0.040000,0.000000 -0.000000,0.050000,0.000000 0.400000,0.040000,0.010000 -0.000000,0.050000,0.050000 0.400000,0.040000,0.040000 0.400000,0.040000,0.050000 " Normals="0.024992,0.999688,0.000000 0.024992,0.999688,0.000000 0.024992,0.999688,0.000000 0.024992,0.999688,0.000000 0.024992,0.999688,0.000000 0.024992,0.999688,0.000000 " TriangleIndices="0,1,2 3,2,1 2,3,4 5,4,3 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,-0.040000,0.050000 0.400000,-0.040000,0.040000 0.409573,-0.038838,0.040000 0.400000,-0.040000,0.050000 0.409573,-0.038838,0.040000 0.409573,-0.038838,0.050000 0.418589,-0.035418,0.040000 0.418589,-0.035418,0.050000 0.426525,-0.029940,0.040000 0.426525,-0.029940,0.050000 0.432919,-0.022723,0.040000 0.432919,-0.022723,0.050000 0.437401,-0.014184,0.040000 0.437401,-0.014184,0.050000 0.439708,-0.004821,0.040000 0.439708,-0.004821,0.050000 0.439708,0.004821,0.040000 0.439708,0.004821,0.050000 0.437401,0.014184,0.040000 0.437401,0.014184,0.050000 0.432919,0.022723,0.040000 0.432919,0.022723,0.050000 0.426525,0.029940,0.040000 0.426525,0.029940,0.050000 0.418589,0.035418,0.040000 0.418589,0.035418,0.050000 0.409573,0.038838,0.040000 0.409573,0.038838,0.050000 0.400000,0.040000,0.040000 0.400000,0.040000,0.050000 " Normals="0.000000,-1.000000,0.000000 0.000000,-1.000000,0.000000 0.239316,-0.970942,0.000000 0.000000,-1.000000,0.000000 0.239316,-0.970942,0.000000 0.239316,-0.970942,0.000000 0.464723,-0.885456,0.000000 0.464723,-0.885456,0.000000 0.663123,-0.748511,0.000000 0.663123,-0.748511,0.000000 0.822984,-0.568065,0.000000 0.822984,-0.568065,0.000000 0.935016,-0.354605,0.000000 0.935016,-0.354605,0.000000 0.992709,-0.120537,0.000000 0.992709,-0.120537,0.000000 0.992709,0.120537,0.000000 0.992709,0.120537,0.000000 0.935016,0.354605,0.000000 0.935016,0.354605,0.000000 0.822984,0.568065,0.000000 0.822984,0.568065,0.000000 0.663123,0.748511,0.000000 0.663123,0.748511,0.000000 0.464723,0.885456,0.000000 0.464723,0.885456,0.000000 0.239316,0.970942,0.000000 0.239316,0.970942,0.000000 -0.000000,1.000000,0.000000 -0.000000,1.000000,0.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 8,7,6 7,8,9 10,9,8 9,10,11 12,11,10 11,12,13 14,13,12 13,14,15 16,15,14 15,16,17 18,17,16 17,18,19 20,19,18 19,20,21 22,21,20 21,22,23 24,23,22 23,24,25 26,25,24 25,26,27 28,27,26 27,28,29 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="-0.000000,0.050000,0.050000 -0.000000,0.050000,0.000000 -0.010396,0.048907,0.000000 -0.000000,0.050000,0.050000 -0.010396,0.048907,0.000000 -0.010396,0.048907,0.050000 -0.020337,0.045677,0.000000 -0.020337,0.045677,0.050000 -0.029389,0.040451,0.000000 -0.029389,0.040451,0.050000 -0.037157,0.033457,0.000000 -0.037157,0.033457,0.050000 -0.043301,0.025000,0.000000 -0.043301,0.025000,0.050000 -0.047553,0.015451,0.000000 -0.047553,0.015451,0.050000 -0.049726,0.005226,0.000000 -0.049726,0.005226,0.050000 -0.049726,-0.005226,0.000000 -0.049726,-0.005226,0.050000 -0.047553,-0.015451,0.000000 -0.047553,-0.015451,0.050000 -0.043301,-0.025000,0.000000 -0.043301,-0.025000,0.050000 -0.037157,-0.033457,0.000000 -0.037157,-0.033457,0.050000 -0.029389,-0.040451,0.000000 -0.029389,-0.040451,0.050000 -0.020337,-0.045677,0.000000 -0.020337,-0.045677,0.050000 -0.010396,-0.048907,0.000000 -0.010396,-0.048907,0.050000 0.000000,-0.050000,0.000000 0.000000,-0.050000,0.050000 " Normals="-0.000000,1.000000,0.000000 -0.000000,1.000000,0.000000 -0.207912,0.978148,0.000000 -0.000000,1.000000,0.000000 -0.207912,0.978148,0.000000 -0.207912,0.978148,0.000000 -0.406737,0.913545,0.000000 -0.406737,0.913545,0.000000 -0.587785,0.809017,0.000000 -0.587785,0.809017,0.000000 -0.743145,0.669131,0.000000 -0.743145,0.669131,0.000000 -0.866025,0.500000,0.000000 -0.866025,0.500000,0.000000 -0.951057,0.309017,0.000000 -0.951057,0.309017,0.000000 -0.994522,0.104528,0.000000 -0.994522,0.104528,0.000000 -0.994522,-0.104528,0.000000 -0.994522,-0.104528,0.000000 -0.951057,-0.309017,0.000000 -0.951057,-0.309017,0.000000 -0.866025,-0.500000,0.000000 -0.866025,-0.500000,0.000000 -0.743145,-0.669131,0.000000 -0.743145,-0.669131,0.000000 -0.587785,-0.809017,0.000000 -0.587785,-0.809017,0.000000 -0.406737,-0.913545,0.000000 -0.406737,-0.913545,0.000000 -0.207912,-0.978148,0.000000 -0.207912,-0.978148,0.000000 0.000000,-1.000000,0.000000 0.000000,-1.000000,0.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 8,7,6 7,8,9 10,9,8 9,10,11 12,11,10 11,12,13 14,13,12 13,14,15 16,15,14 15,16,17 18,17,16 17,18,19 20,19,18 19,20,21 22,21,20 21,22,23 24,23,22 23,24,25 26,25,24 25,26,27 28,27,26 27,28,29 30,29,28 29,30,31 32,31,30 31,32,33 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,-0.040000,0.010000 0.400000,-0.040000,0.000000 0.409573,-0.038838,0.000000 0.400000,-0.040000,0.010000 0.409573,-0.038838,0.000000 0.409573,-0.038838,0.010000 0.418589,-0.035418,0.000000 0.418589,-0.035418,0.010000 0.426525,-0.029940,0.000000 0.426525,-0.029940,0.010000 0.432919,-0.022723,0.000000 0.432919,-0.022723,0.010000 0.437401,-0.014184,0.000000 0.437401,-0.014184,0.010000 0.439708,-0.004821,0.000000 0.439708,-0.004821,0.010000 0.439708,0.004821,0.000000 0.439708,0.004821,0.010000 0.437401,0.014184,0.000000 0.437401,0.014184,0.010000 0.432919,0.022723,0.000000 0.432919,0.022723,0.010000 0.426525,0.029940,0.000000 0.426525,0.029940,0.010000 0.418589,0.035418,0.000000 0.418589,0.035418,0.010000 0.409573,0.038838,0.000000 0.409573,0.038838,0.010000 0.400000,0.040000,0.000000 0.400000,0.040000,0.010000 " Normals="0.000000,-1.000000,0.000000 0.000000,-1.000000,0.000000 0.239316,-0.970942,0.000000 0.000000,-1.000000,0.000000 0.239316,-0.970942,0.000000 0.239316,-0.970942,0.000000 0.464723,-0.885456,0.000000 0.464723,-0.885456,0.000000 0.663123,-0.748511,0.000000 0.663123,-0.748511,0.000000 0.822984,-0.568065,0.000000 0.822984,-0.568065,0.000000 0.935016,-0.354605,0.000000 0.935016,-0.354605,0.000000 0.992709,-0.120537,0.000000 0.992709,-0.120537,0.000000 0.992709,0.120537,0.000000 0.992709,0.120537,0.000000 0.935016,0.354605,0.000000 0.935016,0.354605,0.000000 0.822984,0.568065,0.000000 0.822984,0.568065,0.000000 0.663123,0.748511,0.000000 0.663123,0.748511,0.000000 0.464723,0.885456,0.000000 0.464723,0.885456,0.000000 0.239316,0.970942,0.000000 0.239316,0.970942,0.000000 -0.000000,1.000000,0.000000 -0.000000,1.000000,0.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 8,7,6 7,8,9 10,9,8 9,10,11 12,11,10 11,12,13 14,13,12 13,14,15 16,15,14 15,16,17 18,17,16 17,18,19 20,19,18 19,20,21 22,21,20 21,22,23 24,23,22 23,24,25 26,25,24 25,26,27 28,27,26 27,28,29 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#CCCC99" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="1.000000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#FFFFC0" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                            <EmissiveMaterial>
                                                <EmissiveMaterial.Brush>
                                                    <SolidColorBrush Color="#191913" Opacity="1.000000"/>
                                                </EmissiveMaterial.Brush>
                                            </EmissiveMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,-0.040000,0.040000 0.400000,-0.040000,0.050000 -0.000000,-0.050000,0.050000 0.400000,-0.040000,0.040000 -0.000000,-0.050000,0.050000 0.400000,-0.040000,0.010000 -0.000000,-0.050000,0.000000 0.400000,-0.040000,0.000000 " Normals="0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 0.024992,-0.999688,0.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#B2B2B2" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="0.200000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#333333" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,-0.040000,0.040000 0.400000,-0.040000,0.010000 0.390427,-0.038838,0.010000 0.400000,-0.040000,0.040000 0.390427,-0.038838,0.010000 0.390427,-0.038838,0.040000 0.381411,-0.035418,0.010000 0.381411,-0.035418,0.040000 0.373475,-0.029940,0.010000 0.373475,-0.029940,0.040000 0.367081,-0.022723,0.010000 0.367081,-0.022723,0.040000 0.362599,-0.014184,0.010000 0.362599,-0.014184,0.040000 0.360292,-0.004821,0.010000 0.360292,-0.004821,0.040000 0.360292,0.004821,0.010000 0.360292,0.004821,0.040000 0.362599,0.014184,0.010000 0.362599,0.014184,0.040000 0.367081,0.022723,0.010000 0.367081,0.022723,0.040000 0.373475,0.029940,0.010000 0.373475,0.029940,0.040000 0.381411,0.035418,0.010000 0.381411,0.035418,0.040000 0.390427,0.038838,0.010000 0.390427,0.038838,0.040000 0.400000,0.040000,0.010000 0.400000,0.040000,0.040000 " Normals="-0.000000,1.000000,0.000000 -0.000000,1.000000,0.000000 0.239316,0.970942,0.000000 -0.000000,1.000000,0.000000 0.239316,0.970942,0.000000 0.239316,0.970942,0.000000 0.464723,0.885456,0.000000 0.464723,0.885456,0.000000 0.663123,0.748511,0.000000 0.663123,0.748511,0.000000 0.822984,0.568065,0.000000 0.822984,0.568065,0.000000 0.935016,0.354605,0.000000 0.935016,0.354605,0.000000 0.992709,0.120537,0.000000 0.992709,0.120537,0.000000 0.992709,-0.120537,0.000000 0.992709,-0.120537,0.000000 0.935016,-0.354605,0.000000 0.935016,-0.354605,0.000000 0.822984,-0.568065,0.000000 0.822984,-0.568065,0.000000 0.663123,-0.748511,0.000000 0.663123,-0.748511,0.000000 0.464723,-0.885456,0.000000 0.464723,-0.885456,0.000000 0.239316,-0.970942,0.000000 0.239316,-0.970942,0.000000 -0.000000,-1.000000,0.000000 -0.000000,-1.000000,0.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 5,6,7 8,7,6 7,8,9 10,9,8 9,10,11 12,11,10 11,12,13 14,13,12 13,14,15 16,15,14 15,16,17 18,17,16 17,18,19 20,19,18 19,20,21 22,21,20 21,22,23 24,23,22 23,24,25 26,25,24 25,26,27 28,27,26 27,28,29 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#B2B2B2" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="0.200000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#333333" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.439708,-0.004821,0.040000 0.437401,-0.014184,0.040000 0.409573,0.038838,0.040000 0.432919,0.022723,0.040000 0.437401,0.014184,0.040000 0.426525,0.029940,0.040000 0.418589,0.035418,0.040000 0.418589,0.035418,0.040000 0.437401,0.014184,0.040000 0.409573,0.038838,0.040000 0.439708,0.004821,0.040000 0.439708,-0.004821,0.040000 0.437401,-0.014184,0.040000 0.432919,-0.022723,0.040000 0.409573,0.038838,0.040000 0.426525,-0.029940,0.040000 0.418589,-0.035418,0.040000 0.418589,-0.035418,0.040000 0.409573,-0.038838,0.040000 0.409573,0.038838,0.040000 0.400000,-0.040000,0.040000 0.400000,0.040000,0.040000 0.390427,-0.038838,0.040000 0.381411,-0.035418,0.040000 0.381411,-0.035418,0.040000 0.373475,-0.029940,0.040000 0.400000,0.040000,0.040000 0.367081,-0.022723,0.040000 0.362599,-0.014184,0.040000 0.362599,-0.014184,0.040000 0.360292,-0.004821,0.040000 0.400000,0.040000,0.040000 0.360292,0.004821,0.040000 0.362599,0.014184,0.040000 0.362599,0.014184,0.040000 0.367081,0.022723,0.040000 0.400000,0.040000,0.040000 0.373475,0.029940,0.040000 0.390427,0.038838,0.040000 0.381411,0.035418,0.040000 " Normals="0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 0.000000,0.000000,-1.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 7,8,9 10,9,8 9,10,11 12,13,14 15,14,13 14,15,16 17,18,19 20,19,18 19,20,21 22,21,20 21,22,23 24,25,26 27,26,25 26,27,28 29,30,31 32,31,30 31,32,33 34,35,36 37,36,35 36,37,38 39,38,37 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                                <GeometryModel3D>
                                    <GeometryModel3D.Material>
                                        <MaterialGroup>
                                            <DiffuseMaterial>
                                                <DiffuseMaterial.Brush>
                                                    <SolidColorBrush Color="#B2B2B2" Opacity="1.000000"/>
                                                </DiffuseMaterial.Brush>
                                            </DiffuseMaterial>
                                            <SpecularMaterial SpecularPower="0.200000">
                                                <SpecularMaterial.Brush>
                                                    <SolidColorBrush Color="#333333" Opacity="1.000000"/>
                                                </SpecularMaterial.Brush>
                                            </SpecularMaterial>
                                        </MaterialGroup>
                                    </GeometryModel3D.Material>
                                    <GeometryModel3D.Geometry>
                                        <MeshGeometry3D Positions="0.400000,0.040000,0.010000 0.437401,-0.014184,0.010000 0.439708,-0.004821,0.010000 0.400000,-0.040000,0.010000 0.409573,-0.038838,0.010000 0.400000,0.040000,0.010000 0.418589,-0.035418,0.010000 0.418589,0.035418,0.010000 0.437401,0.014184,0.010000 0.426525,0.029940,0.010000 0.432919,0.022723,0.010000 0.439708,-0.004821,0.010000 0.439708,0.004821,0.010000 0.400000,0.040000,0.010000 0.437401,0.014184,0.010000 0.409573,0.038838,0.010000 0.418589,0.035418,0.010000 0.418589,-0.035418,0.010000 0.426525,-0.029940,0.010000 0.400000,0.040000,0.010000 0.432919,-0.022723,0.010000 0.437401,-0.014184,0.010000 0.381411,0.035418,0.010000 0.373475,0.029940,0.010000 0.390427,-0.038838,0.010000 0.373475,0.029940,0.010000 0.367081,0.022723,0.010000 0.390427,-0.038838,0.010000 0.362599,0.014184,0.010000 0.360292,0.004821,0.010000 0.362599,-0.014184,0.010000 0.367081,-0.022723,0.010000 0.373475,-0.029940,0.010000 0.400000,-0.040000,0.010000 0.400000,0.040000,0.010000 0.390427,-0.038838,0.010000 0.390427,0.038838,0.010000 0.381411,0.035418,0.010000 0.360292,0.004821,0.010000 0.360292,-0.004821,0.010000 0.390427,-0.038838,0.010000 0.362599,-0.014184,0.010000 0.381411,-0.035418,0.010000 0.373475,-0.029940,0.010000 " Normals="0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 0.000000,0.000000,1.000000 " TriangleIndices="0,1,2 3,4,5 6,5,4 7,8,9 10,9,8 11,12,13 14,13,12 13,14,15 16,15,14 17,18,19 20,19,18 19,20,21 22,23,24 25,26,27 28,27,26 27,28,29 30,31,32 33,34,35 36,35,34 35,36,37 38,39,40 41,40,39 40,41,42 43,42,41 "/>
                                    </GeometryModel3D.Geometry>
                                </GeometryModel3D>
                            </Model3DGroup.Children>
                        </Model3DGroup>
                    </ModelVisual3D.Content>
                    <ModelVisual3D.Children/>
                </ModelVisual3D>
            </ModelVisual3D.Children>
        </ModelVisual3D>
    </Viewport3D.Children>
</Viewport3D>  
  
  </Grid>
</Page>

以上是关于研究一段WPF 3D 机械臂代码的主要内容,如果未能解决你的问题,请参考以下文章

Unity3D空间和变换

图形与游戏中3D数学基础的说明

天威Colido D1315并联臂 3d打印机 打印零件越高尺寸越差

(转)左手坐标系和右手坐标系

Unity3D世界坐标系 ( 左手坐标系 | 游戏物体坐标 | 世界坐标系方向 )

ios SceneKit 3D引擎初探