]> git.scottworley.com Git - nt3d/blobdiff - nt3d.js
Cones.
[nt3d] / nt3d.js
diff --git a/nt3d.js b/nt3d.js
index 7472548fddfb800f2df62055983b90dda57a3878..0443913962128ee0a511cb805d9ac404d24a509b 100644 (file)
--- a/nt3d.js
+++ b/nt3d.js
@@ -55,6 +55,13 @@ nt3d = {
                }
                return points;
        },
+       cone: function(base_center, apex, radius, steps) {
+               var base = this.circle(radius, steps);
+               base = this.rotate_onto(base, [0,0,1], this.sub(apex, base_center));
+               base = this.translate(base, base_center);
+               return this.closed_trianglefan([apex].concat(base)).concat(
+                      this.trianglefan(base.reverse()));
+       },
        extrude: function(shape, path, shapenormals, pathnormals) {
                var guts_result = nt3d._extrude_guts(shape, path, shapenormals, pathnormals);
                // Add the end-caps