--- /dev/null
+<html>
+ <head>
+ <title>Cone primitive</title>
+ <script type="text/javascript" src="nt3d.js"></script>
+ <script type="text/javascript">
+ function cone_primitive(height, radius, steps) {
+ return nt3d.cone([0,0,0], [0,0,height], radius, steps);
+ }
+ var params = [["Height", 100],
+ ["Radius", 50],
+ ["Steps", 30]];
+ </script>
+ </head>
+ <body onload="nt3d.framework(cone_primitive, params)">
+ <h1>Cone primitive</h1>
+ <p>There's a cone primitive.</p>
+ </body>
+</html>
}
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