JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    using vector operations (subtract)

    Development Discussions
    2
    4
    412
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gilboonet
      gilboonet last edited by

      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 2 Replies Last reply Reply Quote 0
      • gilboonet
        gilboonet @z3dev last edited by

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

        1 Reply Last reply Reply Quote 0
        • z3dev
          z3dev @gilboonet last edited by

          You can find the API documentation at www.Openjscad.xyz/docs/

          There should be some simple examples as well.

          1 Reply Last reply Reply Quote 0
          • z3dev
            z3dev @gilboonet last edited by

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

            Change

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

            If you need to then create a new vec.

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

            gilboonet 1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB | Contributors