]> git.scottworley.com Git - nt3d/blobdiff - nt3d.js
Torus by extrude demo
[nt3d] / nt3d.js
diff --git a/nt3d.js b/nt3d.js
index bae29f2fa351aa5a9e90cd5bdc29f4a3806baad0..7472548fddfb800f2df62055983b90dda57a3878 100644 (file)
--- 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