placing on matrix inside another

Sep 9, 2009 at 9:50pm

placing on matrix inside another

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?

– Pasted Max Patch, click to expand. –
#45405
Sep 10, 2009 at 10:54pm

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

#163634
Sep 10, 2009 at 10:54pm

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

#163644

You must be logged in to reply to this topic.