3 <title>Box by rotation
</title>
4 <script type=
"text/javascript" src=
"nt3d.js"></script>
5 <script type=
"text/javascript">
6 function box_by_rotation(size) {
7 var origin = [
0,
0,
0 ];
10 var xy = [size, size,
0 ];
11 var xy_face = nt3d.quad(origin, y, xy, x);
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
20 var params = [["Size",
1]];
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>