setcell and setall in jit.gen
Hello , is there a way to translate this patch into jit.gen ?
I need to fill specific cells with specific values, and I wonder if it is possible to do it inside jit.gen, like for example, to do what is explained in this tutorial using jit.gen ?
https://docs.cycling74.com/max8/tutorials/05-Jitter%20Matrix%201
just put a jit.matrix object right before the jit.gen inlet and call the messages on that. you could come up with some complicate logic using gen parameters, but it depends on your situation which is more viable
Hi there,
I have tried what you suggested @Rob Ramirez and have got this going but some strange behaviour. Im not really sure what Im doing. Can you explain the strange rotation behaviour for me please?
Would really appreciate your input.
Thank you,
Tim.
have to add jit.matrix before rotation inlet - same as scale inlet
Hey Wil,
Thanks for this. What I am trying to achieve is a normal rotation of a single grid shape. At the moment I am getting this odd scale thing happening when Y and Z are on 0. Then when I non zero them I get unusual rotation... Do you see what I mean? So, when you put that matrix after jit.gen as you suggest I get all the shapes rotation instead of just one. Thanks.
Tim.
Tim Horne What do you want to do precisely? Why using x-y-z rotation and converting it to quaternion then? Do you want to rotate each object relatively to their own center of relatively to the jit.gl.multiple center?
If you just need x-y-z rotation relatively to the objects center, then no need for the euler2quat conversion and the jit.gen. Just change [jit.gl.multiple]'s rotatexyz matrix instead of its rotate matrix:
Thankyou TFL for your help. To answer your question "what are trying to do?" The answer is, exactly what you achieved in your patch which is to having individual shapes rotating around their own central axis as opposed to the worlds central axis. I now understand that the ordering of multiple params is the answer to getting what I want. I wrongly thought it had something to do with quaternions. When you have position first in the list of multiple params the grid shape will rotate around its own axis. However, when you put rotatexyz first in multiple params it then rotates around the worlds central axis.
Do you know why that is, please?
Thanks,
Tim.
Yes, it's because the way you order the glparams in your jit.gl.multiple will define the order in which they are applied. The position, rotatexyz and scale values you set for each shape are applied in the shape's local coordinates. Imagine that from the beginning, all shapes are at the same position (0,0,0), all facing the same direction (no rotation). If you rotatexyz a shape before defining its position, you also rotate its x-y-z axis directions. Then when you update its position, the change occurs toward these new directions. In other words, the rotation is still applied relatively to the shapes center, but because it happens before translating it, it will change the direction (relatively to the world) of that translation.
You can make the experience yourself: if you stand at the middle of a room, then move two steps forward then rotate 45°, you won't reach the same position as if you rotate 45° first then move two steps forward.
Does that make sense?
Also, don't forget that you defined a 3-dimensionnal matrix to define your shapes, so you need 3 values to address each shape individually:
Hey TFL,
Thanks for your reply.
"You can make the experience yourself: if you stand at the middle of a room, then move two steps forward then rotate 45°, you won't reach the same position as if you rotate 45° first then move two steps forward."
I just spent a few days mulling this one over and think Ive got it now.
Thank you for your clear and useful explanation.
All the best,
Tim.