]>
Commit | Line | Data |
---|---|---|
20ba9ac8 SW |
1 | <html> |
2 | <head> | |
3 | <title>The Thing the Rostock Was Printing in Make Magazine</title> | |
4 | <script type="text/javascript" src="nt3d.js"></script> | |
5 | <script type="text/javascript"> | |
6 | function pointy_sin(x) { | |
7 | // Similar to sin(x*pi) over the range [-1,1], | |
8 | // but with more movement towards the extremes. | |
9 | // https://plus.google.com/101508799331795210529/posts/Yg7LmV8BpTw | |
10 | return 3.7*x + (Math.log(1-.95*x)-Math.log(.95*x+1)); | |
11 | } | |
3bafa9bd | 12 | function rmm(params) { |
20ba9ac8 SW |
13 | var tau = Math.PI*2; |
14 | var path = []; | |
15 | // Short arc | |
3bafa9bd SW |
16 | for (var i = 0; i < params.steps_along; i++) { |
17 | var progress = i/params.steps_along; | |
18 | var x_separation = Math.cos(progress*tau/2)*params.base_separation; | |
19 | var y_offset = -Math.sin(progress*tau/4)*params.base_offset; | |
20 | var y_arc = Math.sin(progress*tau)*params.width; | |
21 | var z_arc = -Math.cos(progress*tau)*params.short_arc_height + params.short_arc_height; | |
20ba9ac8 SW |
22 | path.push([x_separation, y_offset + y_arc, z_arc]); |
23 | } | |
24 | // Tall arc | |
3bafa9bd SW |
25 | for (var i = 0; i < params.steps_along; i++) { |
26 | var progress = i/params.steps_along; | |
27 | var x_arc = -Math.cos(progress*tau*1.5)*params.base_separation; | |
28 | var y_offset = -Math.cos(progress*tau/4)*params.base_offset; | |
29 | var y_twist = -pointy_sin(progress*2 - 1)*params.width/2; | |
30 | var z_arc = -Math.cos(progress*tau)*params.tall_arc_height + params.tall_arc_height; | |
20ba9ac8 SW |
31 | path.push([x_arc, y_offset + y_twist, z_arc]); |
32 | } | |
33 | return nt3d.closed_extrude( | |
34 | path, | |
3bafa9bd | 35 | nt3d.circle(params.tube_width, params.steps_around), |
20ba9ac8 SW |
36 | nt3d.shapenormals_from_closed_path(path), |
37 | nt3d.pathnormals_from_point(path, [0,0,0])); | |
38 | } | |
3bafa9bd SW |
39 | var params = [["base_separation", 30], |
40 | ["base_offset", 10], | |
41 | ["width", 40], | |
42 | ["short_arc_height", 60], | |
43 | ["tall_arc_height", 80], | |
44 | ["tube_width", 10], | |
45 | ["steps_along", 70, "Steps Along Each Arc"], | |
46 | ["steps_around", 12]]; | |
20ba9ac8 SW |
47 | </script> |
48 | </head> | |
49 | <body onload="nt3d.framework(rmm, params)"> | |
50 | <h1>The Thing the Rostock Was Printing in Make Magazine</h1> | |
51 | <p><a href="http://www.flickr.com/photos/jcrocholl/8065968929/sizes/l/in/photostream/">This thing</a>.</p> | |
52 | <!-- My notes after staring at it: | |
53 | x y z | |
54 | 1 0 0 Bottom front | |
55 | .5 1 .5s 1/4 up short arc | |
56 | 0 0 s Top of short arc | |
57 | -.5 -1 .5s Coming down short arc | |
58 | -1 0 0 Bottom back | |
59 | 1 .33 .5t 1/4 up long arc | |
60 | 0 0 t Top of tall arc | |
61 | -1 -.33 .5t Coming down tall arc | |
62 | 1 0 0 Bottom front (Repeated from above) | |
63 | ||
64 | x = cos over 1/2 period for short arc, -cos over 1.5 periods for tall arc | |
65 | y = sin over 1 period for short arc, sin/3 over 1 period for tall arc | |
66 | z = -cos over 1 period for short arc, -cos over 1 period for tall arc | |
67 | --> | |
68 | </body> | |
69 | </html> | |
70 |