Can anyone explain this pience of snippet?

Posted by karthick6891 on Stack Overflow See other posts from Stack Overflow or by karthick6891
Published on 2010-06-12T03:06:38Z Indexed on 2010/06/12 3:12 UTC
Read the original article Hit count: 262

Filed under:

Can anyone explain the following code,forget the sin and cosine parts..Is it trying to build a space for the object

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);
  }
}

© Stack Overflow or respective owner

Related posts about JavaScript