From: Scott Worley Date: Fri, 21 Dec 2012 05:40:57 +0000 (-0800) Subject: Flip the order of shape,path in extrude args X-Git-Url: http://git.scottworley.com/nt3d/commitdiff_plain/0ee732b2898771d951a5dc4b79c1aaa3ce47b48b?hp=1a18e646fe84c30984a5298c284d959e925e6a54 Flip the order of shape,path in extrude args --- diff --git a/box_by_extrude.html b/box_by_extrude.html index a95a7d3..be95de6 100644 --- a/box_by_extrude.html +++ b/box_by_extrude.html @@ -8,8 +8,8 @@ var x = [size, 0, 0]; var y = [0, size, 0]; var xy = [size, size, 0]; - return nt3d.extrude([origin, x, xy, y], - [[0, 0, 0], [0, 0, 1]], + return nt3d.extrude([[0, 0, 0], [0, 0, 1]], + [origin, x, xy, y], [[0, 0, 1], [0, 0, 1]], [[1, 0, 0], [1, 0, 0]]); } diff --git a/nt3d.js b/nt3d.js index 0443913..a4d3977 100644 --- a/nt3d.js +++ b/nt3d.js @@ -62,8 +62,9 @@ nt3d = { 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); + extrude: function(path, shape, shapenormals, pathnormals) { + + var guts_result = nt3d._extrude_guts(path, shape, shapenormals, pathnormals); // Add the end-caps // XXX: This doesn't work if shape is not convex return guts_result.points.concat( @@ -71,8 +72,8 @@ nt3d = { nt3d.trianglefan(guts_result.last_loop)); }, - closed_extrude: function(shape, path, shapenormals, pathnormals) { - var guts_result = nt3d._extrude_guts(shape, path, shapenormals, pathnormals); + closed_extrude: function(path, shape, shapenormals, pathnormals) { + var guts_result = nt3d._extrude_guts(path, shape, shapenormals, pathnormals); // Stitch the ends together return guts_result.points.concat( nt3d.closed_quadstrip(nt3d.zip(guts_result.first_loop, guts_result.last_loop))); @@ -88,7 +89,7 @@ nt3d = { } return fixedpathnormals; }, - _extrude_guts: function(shape, path, shapenormals, pathnormals) { + _extrude_guts: function(path, shape, shapenormals, pathnormals) { var fixedpathnormals = this._fix_pathnormals(shapenormals, pathnormals); var result = { points: [] }; var prev_loop; diff --git a/torus_by_extrude.html b/torus_by_extrude.html index 323ad14..69bbdab 100644 --- a/torus_by_extrude.html +++ b/torus_by_extrude.html @@ -4,15 +4,15 @@