]>
Commit | Line | Data |
---|---|---|
1e62819c SW |
1 | <html> |
2 | <head> | |
3 | <title>Box by rotation</title> | |
4 | <script type="text/javascript" src="nt3d.js"></script> | |
5 | <script type="text/javascript"> | |
3bafa9bd SW |
6 | function box_by_rotation(params) { |
7 | var origin = [0, 0, 0]; | |
8 | var x = [params.size, 0, 0]; | |
9 | var y = [0, params.size, 0]; | |
10 | var xy = [params.size, params.size, 0]; | |
1e62819c SW |
11 | var xy_face = nt3d.quad(origin, y, xy, x); |
12 | return [].concat( | |
13 | xy_face, | |
14 | nt3d.rotate_about_origin(xy_face, nt3d.unit([1,1,1]), 2*Math.PI/3), // yz | |
15 | nt3d.rotate_about_origin(xy_face, nt3d.unit([1,1,1]), -2*Math.PI/3), // xz | |
16 | nt3d.rotate(xy_face, [0.5, 0, 0.5], [0, 1, 0], Math.PI), // far xy (top) | |
17 | nt3d.rotate(xy_face, [1, 1, 0], nt3d.unit([-1, -1, 1]), 2*Math.PI/3), // far yz | |
18 | nt3d.rotate(xy_face, [1, 1, 0], nt3d.unit([-1, -1, 1]), -2*Math.PI/3)); // far xz | |
19 | } | |
3bafa9bd | 20 | var params = [["size", 1]]; |
1e62819c SW |
21 | </script> |
22 | </head> | |
23 | <body onload="nt3d.framework(box_by_rotation, params)"> | |
24 | <h1>Box by rotation</h1> | |
25 | <p>Make a box by specifying one face, then copy-rotating it five times.</p> | |
26 | </body> | |
27 | </html> |