From 3544b92a1ab563781ab9aa6d75034f178ffa2436 Mon Sep 17 00:00:00 2001 From: Joost Nieuwenhuijse Date: Tue, 14 Feb 2012 18:04:17 +0100 Subject: [PATCH] User editable parameters; debugging support; gears demo --- csg.js | 13 ++ gearsdemo.html | 187 ++++++++++++++++++++ index.html | 117 ++++++++++++- openjscad.css | 41 +++++ openjscad.js | 448 +++++++++++++++++++++++++++++++++++++++-------- processfile.html | 51 +++--- 6 files changed, 749 insertions(+), 108 deletions(-) create mode 100644 gearsdemo.html create mode 100644 openjscad.css diff --git a/csg.js b/csg.js index b5c3aa0..43deb7f 100644 --- a/csg.js +++ b/csg.js @@ -144,6 +144,15 @@ CSG.prototype = { return result; }, + // Like union, but when we know that the two solids are not intersecting + // Do not use if you are not completely sure that the solids do not intersect! + unionForNonIntersecting: function(csg) { + var newpolygons = this.polygons.concat(csg.polygons); + var result = CSG.fromPolygons(newpolygons); + result.properties = this.properties._merge(csg.properties); + return result; + }, + // Return a new CSG solid representing space in this solid but not in the // solid `csg`. Neither this solid nor the solid `csg` are modified. // @@ -2258,6 +2267,10 @@ CSG.Vector2D = function(x, y) { } }; +CSG.Vector2D.fromAngle = function(radians) { + return new CSG.Vector2D(Math.cos(radians), Math.sin(radians)); +}; + CSG.Vector2D.prototype = { // extend to a 3D vector by adding a z coordinate: toVector3D: function(z) { diff --git a/gearsdemo.html b/gearsdemo.html new file mode 100644 index 0000000..ee08e28 --- /dev/null +++ b/gearsdemo.html @@ -0,0 +1,187 @@ + + + + + + + + + + +OpenJsCad demo: involute gears + + +

OpenJsCad demo: involute gears

+
+

Source code

+Below is the OpenJsCad script for this demo. To build your own models, create a .jscad script +and use the OpenJsCad parser. For more information see the +OpenJsCad documentation. +

+
+ +

+ + \ No newline at end of file diff --git a/index.html b/index.html index 848d61f..62a0eeb 100644 --- a/index.html +++ b/index.html @@ -35,6 +35,8 @@ textarea:focus { canvas { cursor: move; } + + - -canvas { cursor: move; } + -