]> git.scottworley.com Git - nt3d/blame - torus_by_extrude.html
Flip the order of shape,path in extrude args
[nt3d] / torus_by_extrude.html
CommitLineData
fc382d22
SW
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(torus_radius, cross_section_radius, long_steps, short_steps) {
fc382d22 7 var path = nt3d.circle(torus_radius, long_steps);
0ee732b2 8 var cross_section = nt3d.circle(cross_section_radius, short_steps);
fc382d22
SW
9 var cross_section_normals = nt3d.rotate_about_origin(path, [0,0,1], Math.PI/2);
10 var path_normals = [];
11 path_normals.length = long_steps;
12 for (var i = 0; i < long_steps; i++) {
13 path_normals[i] = [0, 0, 1];
14 }
0ee732b2 15 return nt3d.closed_extrude(path, cross_section, cross_section_normals, path_normals);
fc382d22
SW
16 }
17 var params = [["Torus radus", 100],
18 ["Cross section radius", 40],
19 ["Steps around the long way", 50],
20 ["Steps around the short way", 16]];
21 </script>
22 </head>
23 <body onload="nt3d.framework(torus_by_extrude, params)">
24 <h1>Torus by extrude</h1>
25 <p>Make a torus by extruding a circle.</p>
26 </body>
27</html>