placing on matrix inside another


    Sep 09 2009 | 9:50 pm
    Hello,
    i am in the process of learning how to use javascript with jitter. at the moment i am stuck with a seemingly very basic problem. I want to place on (smaller) matrix inside anothe (bigger one) to achieve somthing similar like in the patch below.
    My problem is: how do i fill on matrix into another using javascript.
    my javascript code is something like that
    var smallmatrix = new JitterMatrix(4, "char", 320, 240);
    var largematrix = new JitterMatrix(4, "char", 720, 450);
    largematrix.usedstdim = 1;
    largematrix.dstdimstart = [10, 10];
    largematrix.dstdimend = [330, 250];
    //[some foo filling the small matrix]
    function bang() {
    // and here starts my problem. If I use:
    largematrix = smallmatrix;
    // the largematrix is just identical to the smallmatrix.
    //is there a function that i can use?

    • Sep 10 2009 | 10:54 pm
      I don't have much time to write up a fresh example, but perhaps this will help you:
      var noiz = new JitterObject("jit.noise");
      noiz.type = "char";
      noiz.planecount = 1;
      noiz.dim = [4, 4];
      noiz.name = "noisay";
      
      function bang()
      {
        copymat(noiz);
      }
      
      function copymat(iname)
      {
        var input = new JitterMatrix("inamed", iname.planecount, iname.type, iname.dim);
        var output = new JitterMatrix("outr", iname.planecount, iname.type, iname.dim);
        noiz.matrixcalc(input, output);
        outlet(0, "jit_matrix", output.name);
      }
      jml