]> git.scottworley.com Git - nt3d/blame - torus_by_extrude.html
Remove degenerate faces
[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">
c92a9d3f 6 function torus_by_extrude(torus_radius, cross_section_radius, rotation, long_steps, short_steps) {
fc382d22 7 var path = nt3d.circle(torus_radius, long_steps);
c92a9d3f 8 path = nt3d.rotate_about_origin(path, [0,1,0], rotation * 2*Math.PI);
08c25ec8
SW
9 return nt3d.closed_extrude(
10 path,
11 nt3d.circle(cross_section_radius, short_steps),
2d38f724 12 nt3d.shapenormals_from_closed_path(path),
08c25ec8 13 [0, 0, 1]);
fc382d22
SW
14 }
15 var params = [["Torus radus", 100],
16 ["Cross section radius", 40],
c92a9d3f 17 ["Rotation (turns)", 0.001],
fc382d22
SW
18 ["Steps around the long way", 50],
19 ["Steps around the short way", 16]];
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>