- for (var finger_num = 0; finger_num < params.num_fingers; finger_num++) {
- var finger_angle = finger_num / params.num_fingers;
- var path = [];
- for (var finger_point = 0; finger_point <= params.finger_points; finger_point++) {
- var angle = (finger_angle + params.finger_twirl * finger_point / params.finger_points) * 2 * Math.PI;
- var x = ring_radius * Math.cos(angle);
- var y = ring_radius * Math.sin(angle);
- path.push([x, y, params.finger_height * finger_point / params.finger_points]);
- }
- var finger = nt3d.extrude(path, finger_crosssection, [0, 0, 1], nt3d.pathnormals_from_point(path, [0, 0, 0]));
- fingers = fingers.concat(finger);
+ var num_fingers = Math.round((ring_radius * 2 * Math.PI) / params.finger_spacing);
+ for (var finger_num = 0; finger_num < num_fingers; finger_num++) {
+ var finger_angle = finger_num / num_fingers;
+ fingers = fingers.concat(finger(params, finger_crosssection, ring_radius, finger_angle));