using vector operations (subtract)

  • Hello,
    yesterday I needed to modify my 2 axis slicer script for it to be compatible with latest v2 version. The error shown into web console was about subtract, so I first thought there was a problem with CSG subtract and discarded the code using it, but indeed it was vec3.subtract that I'm using as a replacement of now deprecated minus(). I replaced it with

    //d = vec3.subtract(b[1], b[0]);
    d = [b[1][0]-b[0][0], b[1][1]-b[0][1], b[1][2]-b[0][2]];

    but isn't there anymore a way to use vector operations like subtract() because it helps keeping the code easy to read.

  • @z3dev Thanks, I will change to subtract(a, a, b)

  • You can find the API documentation at

    There should be some simple examples as well.

  • @gilboonet you hit one of the differences in the maths.


    subtract(a, b) to subtract(a, a, b)

    If you need to then create a new vec.

    subtract(vec3.create(), a, b)

Log in to reply