]> git.scottworley.com Git - nt3d/blobdiff - torus_by_extrude.html
Reduce defaults for a smaller output file
[nt3d] / torus_by_extrude.html
index c95f8216532e4ac27bff2c4ed48bbd2cb7aa0772..ef323a95a5d38ecd239a1f61d8becf2480da494c 100644 (file)
@@ -3,18 +3,20 @@
     <title>Torus by extrude</title>
     <script type="text/javascript" src="nt3d.js"></script>
     <script type="text/javascript">
-      function torus_by_extrude(torus_radius, cross_section_radius, long_steps, short_steps) {
-       var path = nt3d.circle(torus_radius, long_steps);
+      function torus_by_extrude(params) {
+       var path = nt3d.circle(params.torus_radius, params.long_steps);
+       path = nt3d.rotate_about_origin(path, [0,1,0], params.rotation * 2*Math.PI);
        return nt3d.closed_extrude(
          path,
-         nt3d.circle(cross_section_radius, short_steps),
-         nt3d.rotate_about_origin(path, [0,0,1], Math.PI/2),
+         nt3d.circle(params.cross_section_radius, params.short_steps),
+         nt3d.shapenormals_from_closed_path(path),
          [0, 0, 1]);
       }
-      var params = [["Torus radus", 100],
-                    ["Cross section radius", 40],
-                    ["Steps around the long way", 50],
-                    ["Steps around the short way", 16]];
+      var params = [["torus_radius", 100],
+                    ["cross_section_radius", 40],
+                    ["rotation", 0.001, "Rotation (in turns)"],
+                    ["long_steps", 50, "Steps around the long way"],
+                    ["short_steps", 16, "Steps around the short way"]];
     </script>
   </head>
   <body onload="nt3d.framework(torus_by_extrude, params)">