minor bug fixes, added note about OpenJsCad.log()

gh-pages
Joost Nieuwenhuijse 2012-02-21 17:11:29 +01:00
parent e2a146af4e
commit 471b99d5ba
3 changed files with 14 additions and 6 deletions

8
csg.js
View File

@ -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;

View File

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

View File

@ -199,7 +199,13 @@ Then press the Debug button above. The debugger will stop just before executing
<br><br>
For more information about debugging in Chrome see
<a href="http://code.google.com/chrome/devtools/docs/overview.html" target="_blank">Chrome Developer Tools: Overview</a>
<br><br>
You can output log messages from your script using:
<pre>
OpenJsCad.log("Hello");
</pre>
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.
<br><br>
</body>