From fc382d22506415e4c481587aad501e25b96f11ba Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 20 Dec 2012 01:11:52 -0800 Subject: [PATCH] Torus by extrude demo --- nt3d.js | 9 +++++++++ torus_by_extrude.html | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 torus_by_extrude.html diff --git a/nt3d.js b/nt3d.js index bae29f2..7472548 100644 --- a/nt3d.js +++ b/nt3d.js @@ -46,6 +46,15 @@ nt3d = { closed_quadstrip: function(strip) { return this.quadstrip(strip.concat([strip[0], strip[1]])); }, + circle: function(r, n) { + var points = []; + for (var i = 0; i < n; i++) { + points.push([r*Math.cos(2*Math.PI*i/n), + r*Math.sin(2*Math.PI*i/n), + 0]); + } + return points; + }, extrude: function(shape, path, shapenormals, pathnormals) { var guts_result = nt3d._extrude_guts(shape, path, shapenormals, pathnormals); // Add the end-caps diff --git a/torus_by_extrude.html b/torus_by_extrude.html new file mode 100644 index 0000000..323ad14 --- /dev/null +++ b/torus_by_extrude.html @@ -0,0 +1,27 @@ + + + Torus by extrude + + + + +

Torus by extrude

+

Make a torus by extruding a circle.

+ + -- 2.44.1