首页 > 代码库 > three.js 源码注释(八十)extras/geometries/OctahedronGeometry.js

three.js 源码注释(八十)extras/geometries/OctahedronGeometry.js

商域无疆 (http://blog.csdn.net/omni360/)

本文遵循“署名-非商业用途-保持一致”创作公用协议

转载请保留此句:商域无疆 -  本博客专注于 敏捷开发及移动和物联设备研究:数据可视化、GOLANG、Html5、WEBGL、THREE.JS否则,出自本博客的文章拒绝转载或再转载,谢谢合作。


俺也是刚开始学,好多地儿肯定不对还请见谅.

以下代码是THREE.JS 源码文件中extras/geometries/OctahedronGeometry.js文件的注释.

更多更新在 : https://github.com/omni360/three.js.sourcecode


/**
 * @author timothypratley / https://github.com/timothypratley
 */
/*
///OctahedronGeometry用来在三维空间内创建一个八面体对象.
///
///	用法: var geometry = new THREE.OctahedronGeometry(70);	
/// 	  var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
/// 	  var icos = new THREE.Mesh(geometry,material);
/// 	  scene.add(icos);
*/
///<summary>OctahedronGeometry</summary>
///<param name ="radius" type="float">八面体半径</param>
///<param name ="detail" type="int">细节因子,默认为0,当超过0将会有更多的顶点,当前的几何体就不会是八面体,当参数detail大于1,将会变成一个球体.</param>
THREE.OctahedronGeometry = function ( radius, detail ) {

	this.parameters = {
		radius: radius,	//八面体半径
		detail: detail	//细节因子,默认为0,当超过0将会有更多的顶点,当前的几何体就不会是八面体,当参数detail大于1,将会变成一个球体.
	};

	var vertices = [
		1, 0, 0,   - 1, 0, 0,    0, 1, 0,    0,- 1, 0,    0, 0, 1,    0, 0,- 1
	]; //顶点数组

	var indices = [
		0, 2, 4,    0, 4, 3,    0, 3, 5,    0, 5, 2,    1, 2, 5,    1, 5, 3,    1, 3, 4,    1, 4, 2
	];	//顶点索引

	THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );
};
/*************************************************
****下面是IcosahedronGeometry对象的方法属性定义,继承自Geometry对象.
**************************************************/
THREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );


商域无疆 (http://blog.csdn.net/omni360/)

本文遵循“署名-非商业用途-保持一致”创作公用协议

转载请保留此句:商域无疆 -  本博客专注于 敏捷开发及移动和物联设备研究:数据可视化、GOLANG、Html5、WEBGL、THREE.JS否则,出自本博客的文章拒绝转载或再转载,谢谢合作。


以下代码是THREE.JS 源码文件中extras/geometries/OctahedronGeometry.js文件的注释.

更多更新在 : https://github.com/omni360/three.js.sourcecode

three.js 源码注释(八十)extras/geometries/OctahedronGeometry.js