Rotating and Scaling multiple objects with OSC with a reference point
  • themarra
    junior Member
    Posts: 7
    Joined: Mon Sep 02, 2019 11:55 am

    Rotating and Scaling multiple objects with OSC with a reference point

    by themarra » Sat Sep 21, 2019 2:11 pm

    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?
  • franz
    madMapper master
    Posts: 1033
    Joined: Fri Feb 18, 2005 7:05 pm
    Location: Paris, France
    Contact:

    Re: Rotating and Scaling multiple objects with OSC with a reference point

    by franz » Tue Sep 24, 2019 11:59 am

    and if you put all your quads in a group, and then rotate the group ?
  • mad-matt
    garageCube team
    Posts: 1476
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Rotating and Scaling multiple objects with OSC with a reference point

    by mad-matt » Tue Sep 24, 2019 8:45 pm

    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
  • themarra
    junior Member
    Posts: 7
    Joined: Mon Sep 02, 2019 11:55 am

    Re: Rotating and Scaling multiple objects with OSC with a reference point

    by themarra » Sun Oct 20, 2019 3:19 pm

    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?
  • mad-matt
    garageCube team
    Posts: 1476
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Rotating and Scaling multiple objects with OSC with a reference point

    by mad-matt » Mon Oct 21, 2019 5:03 pm

    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

Who is online

Users browsing this forum: No registered users and 23 guests