JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
// Create an affine matrix for translation:
CSG.Matrix4x4.translation = function(v) {
// parse as CSG.Vector3D, so we can pass an array or a CSG.Vector3D
var vec = new CSG.Vector3D(v);
var els = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, vec.x, vec.y, vec.z, 1];
return new CSG.Matrix4x4(els);
};
The matrix should look like this
var els = [1, 0, 0, vec.x, 0, 1, 0, vec.y, 0, 0, 1, vec.z, 0, 0, 0, 1];
I may fix this and open a PR but dont have the tools at the computer I am currently on.
Hey
I am pretty sure that the function CSG.Matrix4x4.translation is broken from: https://github.com/Spiritdude/OpenJSCAD.org/blob/master/csg.js#L3586
The matrix should look like this
I may fix this and open a PR but dont have the tools at the computer I am currently on.