任何人都可以解釋下面的代碼嗎?忘記正弦和餘弦部分。它試圖爲對象建立一個空間嗎?任何人都可以解釋JavaScript的這個片段?
objectsInScene = new Array();
for (var i=space; i<180; i+=space) {
for (var angle=0; angle<360; angle+=space) {
var object = {};
var x = Math.sin(radian*i)*radius;
object.x = Math.cos(angle*radian)*x;
object.y = Math.cos(radian*i)*radius;
object.z = Math.sin(angle*radian)*x;
objectsInScene.push(object);
}
}
哦,你說得對。 – Artelius 2010-06-12 04:04:13