Page 1 of 1
Rotating and Scaling multiple objects with OSC with a reference point
Posted: Sat Sep 21, 2019 2:11 pm
by themarra
I am trying to scale and rotate my quads simultaneously with the controls in MM, but the problem is that the control only affects the quad separately. For example, when using rotate on 2 quads, each quad will be rotated by an angle with respect to the center point of the quad, not the whole selected quads. I need to control all of the selected quads with one reference point, not separate reference points. I use OSC to control the variables.
Is there any way to get around this problem?
Re: Rotating and Scaling multiple objects with OSC with a reference point
Posted: Tue Sep 24, 2019 11:59 am
by franz
and if you put all your quads in a group, and then rotate the group ?
Re: Rotating and Scaling multiple objects with OSC with a reference point
Posted: Tue Sep 24, 2019 8:45 pm
by mad-matt
Through OSC Query you can request the current quads handles X/Y positions and set them.
If you want to rotate the quad around Z axis at position (centerX,centerY), you can rotate their 4 handles around this point.
To rotate a point (posX,posY) around (centerX,centerY) by N radians, do
relativePosX = posX-centerX
relativePosY = posY-centerY
newRelativePosX = relativePosX * cos(angle) - relativePosY * sin(angle);
newRelativePosY = relativePosX * sin(angle) + relativePosY * cos(angle);
newPosX = newRelativePosX+centerX
newPosY = newRelativePosX+centerY
Re: Rotating and Scaling multiple objects with OSC with a reference point
Posted: Sun Oct 20, 2019 3:19 pm
by themarra
and if you put all your quads in a group, and then rotate the group ?
if I control the group, it will still behave as mentioned (still rotating with reference to their quad's middle point)
Through OSC Query you can request the current quads handles X/Y positions and set them.
If you want to rotate the quad around Z axis at position (centerX,centerY), you can rotate their 4 handles around this point.
To rotate a point (posX,posY) around (centerX,centerY) by N radians, do
relativePosX = posX-centerX
relativePosY = posY-centerY
newRelativePosX = relativePosX * cos(angle) - relativePosY * sin(angle);
newRelativePosY = relativePosX * sin(angle) + relativePosY * cos(angle);
newPosX = newRelativePosX+centerX
newPosY = newRelativePosX+centerY
how do I request the current quad handles? The software only sends an OSC message to my PC, IF I changed those variables in the software. I am not getting any message if I use OSC to send the positions. Am I missing something here?
Re: Rotating and Scaling multiple objects with OSC with a reference point
Posted: Mon Oct 21, 2019 5:03 pm
by mad-matt
You can request all paramter values with OSC Query protocol. You can test typing that in your webbroswer when MadMapper is running:
http://127.0.0.1:8010/
Protocol specifications:
https://github.com/Vidvox/OSCQueryProposal
Demo:
https://www.youtube.com/watch?v=1UTUR7M43no