User editable parameters; debugging support; gears demo

This commit is contained in:
Joost Nieuwenhuijse 2012-02-14 18:04:17 +01:00
parent 1b89514039
commit 3544b92a1a
6 changed files with 749 additions and 108 deletions

13
csg.js
View file

@ -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) {