[java-dev] Re: Re: Re: Crash in JitterMatrix.copyMatrixToArray() ?
Peter Castine
pcastine at gmx.net
Wed Feb 6 14:34:37 MST 2008
- Previous message: [java-dev] Re: Re: Crash in JitterMatrix.copyMatrixToArray() ?
- Next message: [java-dev] From Max to Processing (processing.org)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
We're testing the copyVectorToArray() version now.
It took me a while to get the incantation right. For the benefit of anyone looking for a matrix-to-array conversion, here's my code to replace copyMatrixToArray()
==========
JitterMatrix jm = new JitterMatrix(...);
int[] offset = new int[2]; // hard-wired to 2D matrices
int[] matrixBuf = new int[/*whatever it takes*/];
int[] dim = jm.getDim();
...
offset[0] = 0;
for (int j = 0; j < dim[1]; j++) {
offset[1] = j;
jm.copyVectorToArray(0, offset, matrixBuf, 4 * dim[0], 4 * dim[0] * j);
}
===========
Our app only deals with ARGB-plane matrices, a more general implementation would replace the constant 4 in the code with the
current plane count. The same applies to the hard-wired 2D thing.
The modification has worked for as long as I've spent writing this message. If it's still running after supper I'll be more confident.-
-- P.
--
----
Peter Castine
Next Concert: Fri. 8 Feb, 2008
Oscar Peterson Concert Hall, Concordia University, Montréal, QC, CA
"The Door: Theme, Lines, Canon"
--please check with venue for time
- Previous message: [java-dev] Re: Re: Crash in JitterMatrix.copyMatrixToArray() ?
- Next message: [java-dev] From Max to Processing (processing.org)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
