]> git.scottworley.com Git - nt3d/commitdiff
Start on Medusa.
authorScott Worley <scottworley@scottworley.com>
Fri, 9 May 2014 06:23:40 +0000 (23:23 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 9 May 2014 06:23:40 +0000 (23:23 -0700)
medusa.html [new file with mode: 0644]

diff --git a/medusa.html b/medusa.html
new file mode 100644 (file)
index 0000000..9099f6a
--- /dev/null
@@ -0,0 +1,31 @@
+<html>
+  <head>
+    <title>Medusa</title>
+    <script type="text/javascript" src="nt3d.js"></script>
+    <script type="text/javascript">
+      function medusa(base_ring_radius, num_fingers, finger_radius, finger_faces, finger_height) {
+        var finger_crosssection = nt3d.circle(finger_radius, finger_faces);
+        var fingers = [];
+        for (var i = 0; i < num_fingers; i++) {
+          var base_x = base_ring_radius * Math.cos(i * (2 * Math.PI / num_fingers));
+          var base_y = base_ring_radius * Math.sin(i * (2 * Math.PI / num_fingers));
+          console.log(base_x, base_y);
+          var path = [[base_x, base_y, 0], [base_x, base_y, finger_height]];
+          var finger = nt3d.extrude(path, finger_crosssection, [0, 0, 1], nt3d.pathnormals_from_point(path, [0, 0, 0]));
+          fingers = fingers.concat(finger);
+        }
+
+        return fingers;
+      }
+      var params = [["Base ring radius", 100],
+                    ["Number of fingers", 5],
+                    ["Finger radius", 3],
+                    ["Finger faces", 10],
+                    ["Finger height", 100]];
+    </script>
+  </head>
+  <body onload="nt3d.framework(medusa, params)">
+    <h1>Medusa</h1>
+    <p>An artsy thing.</p>
+  </body>
+</html>