| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1528 人关注过本帖
标题:[OGL][探讨]正二十面体(Icosahedron)的顶点坐标取值
只看楼主 加入收藏
if_exist
Rank: 2
等 级:论坛游民
帖 子:86
专家分:41
注 册:2009-4-20
结帖率:100%
收藏
 问题点数:0 回复次数:0 
[OGL][探讨]正二十面体(Icosahedron)的顶点坐标取值
编辑:523066680@  from: http://www.
" border="0" />

" border="0" />
红皮书中举了个绘制正二十面体的例子,部分代码如下
(参见“2.10 创建多边形表面模型的一些提示”)

An Example: Building an Icosahedron:
程序代码:
#define X .525731112119133606
#define Z .850650808352039932

static GLfloat vdata[12][3] = {
    {-X, 0.0, Z}, {X, 0.0, Z}, {-X, 0.0, -Z}, {X, 0.0, -Z},
    {0.0, Z, X}, {0.0, Z, -X}, {0.0, -Z, X}, {0.0, -Z, -X},
    {Z, X, 0.0}, {-Z, X, 0.0}, {Z, -X, 0.0}, {-Z, -X, 0.0}
};

static GLuint tindices[20][3] = {
    {1,4,0}, {4,9,0}, {4,5,9}, {8,5,4}, {1,8,4},
    {1,10,8}, {10,3,8}, {8,3,5}, {3,2,5}, {3,7,2},
    {3,10,7}, {10,6,7}, {6,11,7}, {6,0,11}, {6,1,0},
    {10,1,6}, {11,0,9}, {2,11,9}, {5,2,9}, {11,2,7}
};

int i;
glBegin(GL_TRIANGLES);
for (i = 0; i < 20; i++) {
/* color information here */
    glVertex3fv(&vdata[tindices[i][0]][0]);
    glVertex3fv(&vdata[tindices[i][1]][0]);
    glVertex3fv(&vdata[tindices[i][2]][0]);
}
glEnd();



#define X .525731112119133606
#define Z .850650808352039932
原版以及中文版关于这两个常量的注释:
    The strange numbers X and Z are chosen so that the distance from the
origin to any of the vertices of the icosahedron is 1.0.
    我们为X 和Y 选择了两个似乎很奇怪的数,其用意在于使原点到这二十面体的每个顶点的
距离均为1.0。

至于这两个常量怎么来的,只能自己查了。
在wikipedia找到了完整的注释:
英文 http://en.
中文对照(页面未完善) http://zh.

" border="0" />

若以正二十面体的中心为原点,
各顶点的坐标分别为
(0,±1,±Φ)
(±1,±Φ,0)
(±Φ,0,±1)
在此Φ = (1+√5)/2,即黄金分割数。
因此,这些顶点能组成一些黄金矩形。

有了wikipedia的这个坐标数组,就可以自己选取顶点坐标值了,下面算一下红皮书
那两个常量取值是怎么来的:

黄金分割数计算公式的源头可以参考百科 http://baike.baidu.com/view/45073.htm
一种是通过斐波那契数列算得近似值  一种是通过几何代数的方式求出公式 黄金比=(√5-1)/2
(√5+1)/2 和(√5-1)/2互为倒数 所以 1 : (√5+1)/2 =(√5-1)/2
这是一组黄金分割数
" border="0" />

PDF版请件附件
[探讨]正二十面体的顶点取值.pdf (109.82 KB)


[ 本帖最后由 if_exist 于 2012-4-2 10:42 编辑 ]
搜索更多相关主题的帖子: 编辑 模型 红皮书 color 
2012-04-02 08:35
快速回复:[OGL][探讨]正二十面体(Icosahedron)的顶点坐标取值
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016479 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved