]>
Commit | Line | Data |
---|---|---|
00406c26 SW |
1 | <html> |
2 | <head> | |
3 | <title>Medusa</title> | |
4 | <script type="text/javascript" src="nt3d.js"></script> | |
5 | <script type="text/javascript"> | |
88dc31f4 | 6 | function medusa(first_ring_radius, num_rings, ring_spacing, num_fingers, finger_radius, finger_faces, finger_points, finger_twirl, finger_height) { |
00406c26 SW |
7 | var finger_crosssection = nt3d.circle(finger_radius, finger_faces); |
8 | var fingers = []; | |
88dc31f4 SW |
9 | for (var ring_num = 0; ring_num < num_rings; ring_num++) { |
10 | var ring_radius = first_ring_radius + ring_num * ring_spacing; | |
11 | for (var finger_num = 0; finger_num < num_fingers; finger_num++) { | |
12 | var finger_angle = finger_num / num_fingers; | |
13 | var path = []; | |
14 | for (var finger_point = 0; finger_point <= finger_points; finger_point++) { | |
15 | var angle = (finger_angle + finger_twirl * finger_point / finger_points) * 2 * Math.PI; | |
16 | var x = ring_radius * Math.cos(angle); | |
17 | var y = ring_radius * Math.sin(angle); | |
18 | path.push([x, y, finger_height * finger_point / finger_points]); | |
19 | } | |
20 | var finger = nt3d.extrude(path, finger_crosssection, [0, 0, 1], nt3d.pathnormals_from_point(path, [0, 0, 0])); | |
21 | fingers = fingers.concat(finger); | |
911d073b | 22 | } |
00406c26 SW |
23 | } |
24 | ||
25 | return fingers; | |
26 | } | |
88dc31f4 SW |
27 | var params = [["First ring radius", 20], |
28 | ["Number of rings", 10], | |
29 | ["Space between rings", 10], | |
00406c26 SW |
30 | ["Number of fingers", 5], |
31 | ["Finger radius", 3], | |
88dc31f4 | 32 | ["Finger faces", 5], |
911d073b SW |
33 | ["Finger points", 20], |
34 | ["Finger twirl (in turns)", .1], | |
00406c26 SW |
35 | ["Finger height", 100]]; |
36 | </script> | |
37 | </head> | |
38 | <body onload="nt3d.framework(medusa, params)"> | |
39 | <h1>Medusa</h1> | |
40 | <p>An artsy thing.</p> | |
41 | </body> | |
42 | </html> |