WPF 3D 球面导览

基于WPF的3D Sphere实现模式,升级实现了该3D导览Demo。先pose一张demo效果图

Regular3DPoints3.gif

所有顶点的坐标来源于足球的顶点。足球整个球面完全由正五边形和正六边形拼成,每条拼缝的长度一致,故知道球体半径后即可设法求出60个顶点的坐标。

       image.png

具体求法属于数学的立体几何范畴,反正求解时废了我蛮多精力的,完全是工匠精神支撑我求解完成,具体就不做详述了,可参考以下图: 

来源:http://blog.sina.cn/dpool/blog/s/blog_49966d1d0100tc0d.html

image.png

image.png

image.png

image.png

 

得到所有定点坐标后,即可创建Viewport3D控件,并在坐标位置创建相应的ModelVisual3D对象。

我计算得到的60个点3维坐标:

private List<Point3D> GetBuckyBallPoints()
{
    List<Point3D> ltPoints = new List<Point3D>();
    ltPoints.Add(new Point3D(.850651, 0, 2.327438));
    ltPoints.Add(new Point3D(.262866, .809017, 2.327438));
    ltPoints.Add(new Point3D(-.688191, .5, 2.327438));
    ltPoints.Add(new Point3D(-.688191, -.5, 2.327438));
    ltPoints.Add(new Point3D(.262866, -.809017, 2.327438));

    ltPoints.Add(new Point3D(1.701301, 0, 1.801708));
    ltPoints.Add(new Point3D(.52573, 1.618035, 1.801708));
    ltPoints.Add(new Point3D(.52573, -1.618035, 1.801708));
    ltPoints.Add(new Point3D(-1.376383, -.999999, 1.801708));
    ltPoints.Add(new Point3D(-1.376383, .999999, 1.801708));

    ltPoints.Add(new Point3D(1.964166, .809017, 1.275977));
    ltPoints.Add(new Point3D(1.376381, 1.618035, 1.275977));
    ltPoints.Add(new Point3D(-.162461, 2.118035, 1.275977));
    ltPoints.Add(new Point3D(-1.113517, 1.809017, 1.275977));
    ltPoints.Add(new Point3D(-2.064574, .5, 1.275977));
    ltPoints.Add(new Point3D(-2.064574, -.5, 1.275977));
    ltPoints.Add(new Point3D(-1.113517, -1.809017, 1.275977));
    ltPoints.Add(new Point3D(-.162461, -2.118035, 1.275977));
    ltPoints.Add(new Point3D(1.376381, -1.618035, 1.275977));
    ltPoints.Add(new Point3D(1.964166, -.809017, 1.275977));

    ltPoints.Add(new Point3D(2.389492, .5, .425326));
    ltPoints.Add(new Point3D(1.213921, 2.118035, .425326));
    ltPoints.Add(new Point3D(.262865, 2.427051, .425326));
    ltPoints.Add(new Point3D(-1.639248, 1.809017, .425326));
    ltPoints.Add(new Point3D(-2.227033, .999999, .425326));
    ltPoints.Add(new Point3D(-2.227033, -.999999, .425326));
    ltPoints.Add(new Point3D(-1.639248, -1.809017, .425326));
    ltPoints.Add(new Point3D(.262865, -2.427051, .425326));
    ltPoints.Add(new Point3D(1.213921, -2.118035, .425326));
    ltPoints.Add(new Point3D(2.389492, -.5, .425326));

    ltPoints.Add(new Point3D(2.227033, .999999, -.425326));
    ltPoints.Add(new Point3D(1.639248, 1.809017, -.425326));
    ltPoints.Add(new Point3D(-.262865, 2.427051, -.425326));
    ltPoints.Add(new Point3D(-1.213921, 2.118035, -.425326));
    ltPoints.Add(new Point3D(-2.389492, .5, -.425326));
    ltPoints.Add(new Point3D(-2.389492, -.5, -.425326));
    ltPoints.Add(new Point3D(-1.213921, -2.118035, -.425326));
    ltPoints.Add(new Point3D(-.262865, -2.427051, -.425326));
    ltPoints.Add(new Point3D(1.639248, -1.809017, -.425326));
    ltPoints.Add(new Point3D(2.227033, -.999999, -.425326));

    ltPoints.Add(new Point3D(2.064574, .5, -1.275977));
    ltPoints.Add(new Point3D(1.113517, 1.809017, -1.275977));
    ltPoints.Add(new Point3D(.162461, 2.118035, -1.275977));
    ltPoints.Add(new Point3D(-1.376381, 1.618035, -1.275977));
    ltPoints.Add(new Point3D(-1.964166, .809017, -1.275977));
    ltPoints.Add(new Point3D(-1.964166, -.809017, -1.275977));
    ltPoints.Add(new Point3D(-1.376381, -1.618035, -1.275977));
    ltPoints.Add(new Point3D(.162461, -2.118035, -1.275977));
    ltPoints.Add(new Point3D(1.113517, -1.809017, -1.275977));
    ltPoints.Add(new Point3D(2.064574, -.5, -1.275977));

    ltPoints.Add(new Point3D(1.376383, .999999, -1.801708));
    ltPoints.Add(new Point3D(-.52573, 1.618035, -1.801708));
    ltPoints.Add(new Point3D(-1.701301, 0, -1.801708));
    ltPoints.Add(new Point3D(-.52573, -1.618035, -1.801708));
    ltPoints.Add(new Point3D(1.376383, -.999999, -1.801708));

    ltPoints.Add(new Point3D(.688191, .5, -2.327438));
    ltPoints.Add(new Point3D(-.262866, .809017, -2.327438));
    ltPoints.Add(new Point3D(-.850651, 0, -2.327438));
    ltPoints.Add(new Point3D(-.262866, -.809017, -2.327438));
    ltPoints.Add(new Point3D(.688191, -.5, -2.327438));

    return ltPoints;
}

实现的效果图

Regular3DPoints2.gif

Regular3DPoints4.gif

Regular3DPoints5.gif

    工具:Visual Studio 2017

    工程:WPF C#

    源码下载:

     

 

 

 

posted @ 2019-12-10 19:12  DuelCode  阅读(599)  评论(1编辑  收藏