jit.gen & matrices calculations

    Jun 11 2012 | 9:30 pm
    Hi there, 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 ??

    • Jun 11 2012 | 9:59 pm
      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
    • Jun 11 2012 | 10:12 pm
      Here is the global architecture. vec was there prepared to be fed by azimut / elevation calculated in the future (in the same part)
    • Jun 11 2012 | 10:20 pm
      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?
    • Jun 11 2012 | 10:25 pm
      oops ok yes I know about copy compressed. sorry.
      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 ?
    • Jun 11 2012 | 11:02 pm
      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..