diff --git a/csg.js b/csg.js index e07488d..01c1be1 100644 --- a/csg.js +++ b/csg.js @@ -1062,10 +1062,8 @@ CSG.roundedCube = function(options) { var resolution = CSG.parseOptionAsFloat(options, "resolution", 8); if(resolution < 4) resolution = 4; var roundradius = CSG.parseOptionAsFloat(options, "roundradius", 0.2); - var innercuberadius=cuberadius.clone(); - innercuberadius.x -= roundradius; - innercuberadius.y -= roundradius; - innercuberadius.z -= roundradius; + var innercuberadius=cuberadius; + innercuberadius = innercuberadius.minus(new CSG.Vector3D(roundradius)); var result = CSG.cube({center: center, radius: [cuberadius.x, innercuberadius.y, innercuberadius.z]}); result = result.unionSub( CSG.cube({center: center, radius: [innercuberadius.x, cuberadius.y, innercuberadius.z]}),false,false); result = result.unionSub( CSG.cube({center: center, radius: [innercuberadius.x, innercuberadius.y, cuberadius.z]}),false,false); @@ -2213,7 +2211,7 @@ CSG.Node = function(parent) { CSG.Node.prototype = { // Convert solid space to empty space and empty space to solid space. invert: function() { - this.plane = this.plane.flipped(); + if (this.plane) this.plane = this.plane.flipped(); if (this.front) this.front.invert(); if (this.back) this.back.invert(); var temp = this.front; diff --git a/index.html b/index.html index e76d696..66ede79 100644 --- a/index.html +++ b/index.html @@ -590,7 +590,9 @@ view the source of csg.js: var vec1 = new CSG.Vector3D(1,2,3); // 3 arguments var vec2 = new CSG.Vector3D( [1,2,3] ); // 1 array argument var vec3 = new CSG.Vector3D(vec2); // cloning a vector +// get the values as: vec1.x, vec.y, vec1.z // vector math. All operations return a new vector, the original is unmodified! +// vectors cannot be modified. Instead you should create a new vector. vec.negated() vec.abs() vec.plus(othervector) @@ -607,6 +609,8 @@ vec.distanceTo(othervector) vec.distanceToSquared(othervector) // == vec.distanceTo(othervector)^2 vec.equals(othervector) vec.multiply4x4(matrix4x4) // right multiply by a 4x4 matrix +vec.min(othervector) // returns a new vector with the minimum x,y and z values +vec.max(othervector) // returns a new vector with the maximum x,y and z values // --------- Vector2D --------------------- var vec1 = new CSG.Vector2D(1,2); // 2 arguments diff --git a/processfile.html b/processfile.html index bfca818..3809a56 100644 --- a/processfile.html +++ b/processfile.html @@ -199,7 +199,13 @@ Then press the Debug button above. The debugger will stop just before executing

For more information about debugging in Chrome see Chrome Developer Tools: Overview - +

+You can output log messages from your script using: +
+OpenJsCad.log("Hello");
+
+The log messages will appear in the browser's console (shown using Ctrl+Shift+I in Chrome). They will appear +even while not actually debugging.