jit.gen & matrices calculations
I have a big matrix (1,x) with 3 plane and a pretty short one (1,1)
I need to substract each big matrix' elements by the only one of the short one:
(1,1) – (1,1)
(1,2) – (1,1)
I want to have a (1,x) as the results matrix
here as attached documents, what I did.
my resulting matrix is (1,x) but with all triplets all equals :-(
in the jit.gen subpatcher, I tried different things as you can see…
anyone would help me with that basic things but still sticking me ??
If you could post a simple example patch with some comments, that would be really helpful. I don’t think you need that last vec
By post a patch, I actually ment posting a copy compressed patch that could be edited. If you select all and then go to Edit > Copy Compressed, you can paste it into the forums so others can run the patch too.
Your output in this case is going to be all the same value because you’re calculating a distance, which is a scalar. Since your input is 3-planed, your output will be as well. When the scalar result of the length operator gets sent to the output, it will be copied to all three output planes. This is how it should behave. Were you expecting something different?
yes I know about copy compressed.
It is logic.
But I didn’t want to do that.
I need to calculate the distance between my cam (x,y,z inside the 1,1 matrix) and all my x points (inside my 1,x matrix)
probably, I have to decompose in different plane.. and I finally cannot use length, isn’t it ?
using this, it works very fine, filling the matrix at the end with values like:
(0., 0., distance)
the cell index being the considered objects.
finally, it was the first gen stuff dtr adviced me.
maybe I could remove the sqrt() to improve things but … I have to say it works quite nice.
indeed, that distance calculation costs, but it provides a way to disable all OB3D too far from the camera, and it saves a lot of cpu..