From: Scott Worley Date: Fri, 9 May 2014 06:48:12 +0000 (-0700) Subject: Better names for loop index variables X-Git-Url: http://git.scottworley.com/nt3d/commitdiff_plain/78a4b7fabddc2a9b113c019a597379a91b3c4e9f?ds=sidebyside Better names for loop index variables --- diff --git a/medusa.html b/medusa.html index 58319c0..e077aff 100644 --- a/medusa.html +++ b/medusa.html @@ -6,14 +6,14 @@ function medusa(base_ring_radius, num_fingers, finger_radius, finger_faces, finger_points, finger_twirl, finger_height) { var finger_crosssection = nt3d.circle(finger_radius, finger_faces); var fingers = []; - for (var i = 0; i < num_fingers; i++) { - var finger_angle = i / num_fingers; + for (var finger_num = 0; finger_num < num_fingers; finger_num++) { + var finger_angle = finger_num / num_fingers; var path = []; - for (var j = 0; j <= finger_points; j++) { - var angle = (finger_angle + finger_twirl * j / finger_points) * 2 * Math.PI; + for (var finger_point = 0; finger_point <= finger_points; finger_point++) { + var angle = (finger_angle + finger_twirl * finger_point / finger_points) * 2 * Math.PI; var x = base_ring_radius * Math.cos(angle); var y = base_ring_radius * Math.sin(angle); - path.push([x, y, finger_height * j / finger_points]); + path.push([x, y, finger_height * finger_point / finger_points]); } var finger = nt3d.extrude(path, finger_crosssection, [0, 0, 1], nt3d.pathnormals_from_point(path, [0, 0, 0])); fingers = fingers.concat(finger);