]> git.scottworley.com Git - nt3d/blame_incremental - torus_by_extrude.html
Torus by extrude demo
[nt3d] / torus_by_extrude.html
... / ...
CommitLineData
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) {
7 var cross_section = nt3d.circle(cross_section_radius, short_steps);
8 var path = nt3d.circle(torus_radius, long_steps);
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 }
15 return nt3d.closed_extrude(cross_section, path, cross_section_normals, path_normals);
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>