jscad / OpenJSCAD.org

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.
https://openjscad.xyz/
MIT License
2.63k stars 512 forks source link

Issue with core Matrix4x4.translation function #148

Closed rasmuskr closed 7 years ago

rasmuskr commented 8 years ago

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

// 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.

z3dev commented 8 years ago

@rasmuskr Can you open an issue against CSG.js at the following repository? That's the original repository and you'll get faster answers there.

https://github.com/joostn/OpenJsCad

z3dev commented 7 years ago

This issue was moved to jscad/csg.js#17