minor bug fixes, added note about OpenJsCad.log()
This commit is contained in:
parent
e2a146af4e
commit
471b99d5ba
8
csg.js
8
csg.js
|
@ -1062,10 +1062,8 @@ CSG.roundedCube = function(options) {
|
||||||
var resolution = CSG.parseOptionAsFloat(options, "resolution", 8);
|
var resolution = CSG.parseOptionAsFloat(options, "resolution", 8);
|
||||||
if(resolution < 4) resolution = 4;
|
if(resolution < 4) resolution = 4;
|
||||||
var roundradius = CSG.parseOptionAsFloat(options, "roundradius", 0.2);
|
var roundradius = CSG.parseOptionAsFloat(options, "roundradius", 0.2);
|
||||||
var innercuberadius=cuberadius.clone();
|
var innercuberadius=cuberadius;
|
||||||
innercuberadius.x -= roundradius;
|
innercuberadius = innercuberadius.minus(new CSG.Vector3D(roundradius));
|
||||||
innercuberadius.y -= roundradius;
|
|
||||||
innercuberadius.z -= roundradius;
|
|
||||||
var result = CSG.cube({center: center, radius: [cuberadius.x, innercuberadius.y, innercuberadius.z]});
|
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, cuberadius.y, innercuberadius.z]}),false,false);
|
||||||
result = result.unionSub( CSG.cube({center: center, radius: [innercuberadius.x, innercuberadius.y, cuberadius.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 = {
|
CSG.Node.prototype = {
|
||||||
// Convert solid space to empty space and empty space to solid space.
|
// Convert solid space to empty space and empty space to solid space.
|
||||||
invert: function() {
|
invert: function() {
|
||||||
this.plane = this.plane.flipped();
|
if (this.plane) this.plane = this.plane.flipped();
|
||||||
if (this.front) this.front.invert();
|
if (this.front) this.front.invert();
|
||||||
if (this.back) this.back.invert();
|
if (this.back) this.back.invert();
|
||||||
var temp = this.front;
|
var temp = this.front;
|
||||||
|
|
|
@ -590,7 +590,9 @@ view the source of csg.js:
|
||||||
var vec1 = new CSG.Vector3D(1,2,3); // 3 arguments
|
var vec1 = new CSG.Vector3D(1,2,3); // 3 arguments
|
||||||
var vec2 = new CSG.Vector3D( [1,2,3] ); // 1 array argument
|
var vec2 = new CSG.Vector3D( [1,2,3] ); // 1 array argument
|
||||||
var vec3 = new CSG.Vector3D(vec2); // cloning a vector
|
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!
|
// 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.negated()
|
||||||
vec.abs()
|
vec.abs()
|
||||||
vec.plus(othervector)
|
vec.plus(othervector)
|
||||||
|
@ -607,6 +609,8 @@ vec.distanceTo(othervector)
|
||||||
vec.distanceToSquared(othervector) // == vec.distanceTo(othervector)^2
|
vec.distanceToSquared(othervector) // == vec.distanceTo(othervector)^2
|
||||||
vec.equals(othervector)
|
vec.equals(othervector)
|
||||||
vec.multiply4x4(matrix4x4) // right multiply by a 4x4 matrix
|
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 ---------------------
|
// --------- Vector2D ---------------------
|
||||||
var vec1 = new CSG.Vector2D(1,2); // 2 arguments
|
var vec1 = new CSG.Vector2D(1,2); // 2 arguments
|
||||||
|
|
|
@ -199,7 +199,13 @@ Then press the Debug button above. The debugger will stop just before executing
|
||||||
<br><br>
|
<br><br>
|
||||||
For more information about debugging in Chrome see
|
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>
|
<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>
|
<br><br>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue