]>
Commit | Line | Data |
---|---|---|
1 | <html> | |
2 | <head> | |
3 | <title>Medusa</title> | |
4 | <script type="text/javascript" src="nt3d.js"></script> | |
5 | <script type="text/javascript"> | |
6 | function medusa(base_ring_radius, num_fingers, finger_radius, finger_faces, finger_height) { | |
7 | var finger_crosssection = nt3d.circle(finger_radius, finger_faces); | |
8 | var fingers = []; | |
9 | for (var i = 0; i < num_fingers; i++) { | |
10 | var base_x = base_ring_radius * Math.cos(i * (2 * Math.PI / num_fingers)); | |
11 | var base_y = base_ring_radius * Math.sin(i * (2 * Math.PI / num_fingers)); | |
12 | console.log(base_x, base_y); | |
13 | var path = [[base_x, base_y, 0], [base_x, base_y, finger_height]]; | |
14 | var finger = nt3d.extrude(path, finger_crosssection, [0, 0, 1], nt3d.pathnormals_from_point(path, [0, 0, 0])); | |
15 | fingers = fingers.concat(finger); | |
16 | } | |
17 | ||
18 | return fingers; | |
19 | } | |
20 | var params = [["Base ring radius", 100], | |
21 | ["Number of fingers", 5], | |
22 | ["Finger radius", 3], | |
23 | ["Finger faces", 10], | |
24 | ["Finger height", 100]]; | |
25 | </script> | |
26 | </head> | |
27 | <body onload="nt3d.framework(medusa, params)"> | |
28 | <h1>Medusa</h1> | |
29 | <p>An artsy thing.</p> | |
30 | </body> | |
31 | </html> |