]> git.scottworley.com Git - nt3d/blob - torus_by_extrude.html
ef323a95a5d38ecd239a1f61d8becf2480da494c
[nt3d] / torus_by_extrude.html
1 <html>
2 <head>
3 <title>Torus by extrude</title>
4 <script type="text/javascript" src="nt3d.js"></script>
5 <script type="text/javascript">
6 function torus_by_extrude(params) {
7 var path = nt3d.circle(params.torus_radius, params.long_steps);
8 path = nt3d.rotate_about_origin(path, [0,1,0], params.rotation * 2*Math.PI);
9 return nt3d.closed_extrude(
10 path,
11 nt3d.circle(params.cross_section_radius, params.short_steps),
12 nt3d.shapenormals_from_closed_path(path),
13 [0, 0, 1]);
14 }
15 var params = [["torus_radius", 100],
16 ["cross_section_radius", 40],
17 ["rotation", 0.001, "Rotation (in turns)"],
18 ["long_steps", 50, "Steps around the long way"],
19 ["short_steps", 16, "Steps around the short way"]];
20 </script>
21 </head>
22 <body onload="nt3d.framework(torus_by_extrude, params)">
23 <h1>Torus by extrude</h1>
24 <p>Make a torus by extruding a circle.</p>
25 </body>
26 </html>