<html>
  <head>
    <title>The Thing the Rostock Was Printing in Make Magazine</title>
    <script type="text/javascript" src="nt3d.js"></script>
    <script type="text/javascript">
      function pointy_sin(x) {
        // Similar to sin(x*pi) over the range [-1,1],
        // but with more movement towards the extremes.
        // https://plus.google.com/101508799331795210529/posts/Yg7LmV8BpTw
        return 3.7*x + (Math.log(1-.95*x)-Math.log(.95*x+1));
      }
      function rmm(params) {
        var tau = Math.PI*2;
        var path = [];
        // Short arc
        for (var i = 0; i < params.steps_along; i++) {
          var progress = i/params.steps_along;
          var x_separation =  Math.cos(progress*tau/2)*params.base_separation;
          var y_offset     = -Math.sin(progress*tau/4)*params.base_offset;
          var y_arc        =  Math.sin(progress*tau)*params.width;
          var z_arc        = -Math.cos(progress*tau)*params.short_arc_height + params.short_arc_height;
          path.push([x_separation, y_offset + y_arc, z_arc]);
        }
        // Tall arc
        for (var i = 0; i < params.steps_along; i++) {
          var progress = i/params.steps_along;
          var x_arc        = -Math.cos(progress*tau*1.5)*params.base_separation;
          var y_offset     = -Math.cos(progress*tau/4)*params.base_offset;
          var y_twist      = -pointy_sin(progress*2 - 1)*params.width/2;
          var z_arc        = -Math.cos(progress*tau)*params.tall_arc_height + params.tall_arc_height;
          path.push([x_arc, y_offset + y_twist, z_arc]);
        }
        return nt3d.closed_extrude(
          path,
          nt3d.circle(params.tube_width, params.steps_around),
          nt3d.shapenormals_from_closed_path(path),
          nt3d.pathnormals_from_point(path, [0,0,0]));
      }
      var params = [["base_separation", 30],
                    ["base_offset", 10],
                    ["width", 40],
                    ["short_arc_height", 60],
                    ["tall_arc_height", 80],
                    ["tube_width", 10],
                    ["steps_along", 70, "Steps Along Each Arc"],
                    ["steps_around", 12]];
    </script>
  </head>
  <body onload="nt3d.framework(rmm, params)">
    <h1>The Thing the Rostock Was Printing in Make Magazine</h1>
    <p><a href="http://www.flickr.com/photos/jcrocholl/8065968929/sizes/l/in/photostream/">This thing</a>.</p>
<!-- My notes after staring at it:
x       y       z
1       0       0       Bottom front
.5      1       .5s     1/4 up short arc
0       0       s       Top of short arc
-.5     -1      .5s     Coming down short arc
-1      0       0       Bottom back
1       .33     .5t     1/4 up long arc
0       0       t       Top of tall arc
-1      -.33    .5t     Coming down tall arc
1       0       0       Bottom front (Repeated from above)

x =  cos over 1/2 period for short arc, -cos  over 1.5 periods for tall arc
y =  sin over  1  period for short arc, sin/3 over 1 period for tall arc
z = -cos over  1  period for short arc, -cos  over 1 period for tall arc
-->
  </body>
</html>