three.js 源碼注釋(七十八)extras/geometries/IcosahedronGeometry.js

來源:互聯網
上載者:User

標籤:webgl   three.js   三維   資料視覺效果   web3d   

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

本文遵循“署名-非商業用途-保持一致”創作公用協議

轉載請保留此句:商域無疆 -  本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。


俺也是剛開始學,好多地兒肯定不對還請見諒.

以下代碼是THREE.JS 源碼檔案中extras/geometries/IcosahedronGeometry.js檔案的注釋.

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


/** * @author timothypratley / https://github.com/timothypratley *//*///IcosahedronGeometry用來在三維空間內建立一個二十面體對象.//////用法: var geometry = new THREE.IcosahedronGeometry(70);///   var material = new THREE.MeshBasicMaterial({color: 0x00ff00});///   var icos = new THREE.Mesh(geometry,material);///   scene.add(icos);*////<summary>IcosahedronGeometry</summary>///<param name ="radius" type="float">二十面體半徑</param>///<param name ="detail" type="int">細節因子,預設為0,當超過0將會有更多的頂點,當前的幾何體就不會是二十面體,當參數detail大於1,將會變成一個球體.</param>THREE.IcosahedronGeometry = function ( radius, detail ) {this.parameters = {radius: radius,//二十面體半徑detail: detail//細節因子,預設為0,當超過0將會有更多的頂點,當前的幾何體就不會是二十面體,當參數detail大於1,將會變成一個球體};var t = ( 1 + Math.sqrt( 5 ) ) / 2;var vertices = [- 1,  t,  0,    1,  t,  0,   - 1, - t,  0,    1, - t,  0, 0, - 1,  t,    0,  1,  t,    0, - 1, - t,    0,  1, - t, t,  0, - 1,    t,  0,  1,   - t,  0, - 1,   - t,  0,  1]; //頂點數組var indices = [ 0, 11,  5,    0,  5,  1,    0,  1,  7,    0,  7, 10,    0, 10, 11, 1,  5,  9,    5, 11,  4,   11, 10,  2,   10,  7,  6,    7,  1,  8, 3,  9,  4,    3,  4,  2,    3,  2,  6,    3,  6,  8,    3,  8,  9, 4,  9,  5,    2,  4, 11,    6,  2, 10,    8,  6,  7,    9,  8,  1];//指數.THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );//調用PolyhedronGeometry對象的call方法,將原本屬於Geometry的方法交給當前對象IcosahedronGeometry來使用.};/*****************************************************下面是IcosahedronGeometry對象的方法屬性定義,繼承自Geometry對象.**************************************************/THREE.IcosahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );


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

本文遵循“署名-非商業用途-保持一致”創作公用協議

轉載請保留此句:商域無疆 -  本部落格專註於 敏捷開發及移動和物聯裝置研究:資料視覺效果、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。


以下代碼是THREE.JS 源碼檔案中extras/geometries/IcosahedronGeometry.js檔案的注釋.

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

three.js 源碼注釋(七十八)extras/geometries/IcosahedronGeometry.js

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.