ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2011-03-03T02:59:11+02:00 https://brainmodular.com/forums/app.php/feed/topic/2734 2011-03-03T02:59:11+02:00 2011-03-03T02:59:11+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18342#p18342 <![CDATA[Angle and distance in an XY Pad]]>
It works !

The only thing, is that if you want to control angle with a value from 0 to 360 the formula should be :

x = distance * cos(angle/360*pi*2)
y = distance * sin(angle/360*pi*2)

Statistics: Posted by gthibert — 03 Mar 2011, 01:59


]]>
2011-03-03T01:42:41+02:00 2011-03-03T01:42:41+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18339#p18339 <![CDATA[Angle and distance in an XY Pad]]> works fine

Statistics: Posted by nay-seven — 03 Mar 2011, 00:42


]]>
2011-03-03T00:59:00+02:00 2011-03-03T00:59:00+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18336#p18336 <![CDATA[Angle and distance in an XY Pad]]> to reverse the formula:

x = distance*cos(angle)
y = distance*sin(angle)

Statistics: Posted by senso — 02 Mar 2011, 23:59


]]>
2011-03-02T21:42:47+02:00 2011-03-02T21:42:47+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18331#p18331 <![CDATA[Angle and distance in an XY Pad]]> Statistics: Posted by nay-seven — 02 Mar 2011, 20:42


]]>
2011-03-02T21:18:01+02:00 2011-03-02T21:18:01+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18329#p18329 <![CDATA[Angle and distance in an XY Pad]]>
It works on my side...

Statistics: Posted by gthibert — 02 Mar 2011, 20:18


]]>
2011-03-02T21:09:28+02:00 2011-03-02T21:09:28+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18327#p18327 <![CDATA[Angle and distance in an XY Pad]]> don't have anything from the out of the script...

Statistics: Posted by nay-seven — 02 Mar 2011, 20:09


]]>
2011-03-02T21:08:00+02:00 2011-03-02T21:08:00+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18326#p18326 <![CDATA[Angle and distance in an XY Pad]]>
Getting X-Y from angle and distance ?

Guillaume

Statistics: Posted by gthibert — 02 Mar 2011, 20:08


]]>
2011-03-02T20:44:37+02:00 2011-03-02T20:44:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18323#p18323 <![CDATA[Angle and distance in an XY Pad]]>
Here is the script :

CODE:

var xIn &#58; Tparameter;var yIn &#58; Tparameter;var angleOut&#58; Tparameter;var distanceOut&#58; Tparameter;procedure init;begin  xIn &#58;= CreateParam&#40;'x',ptDataField&#41;; SetIsOutput&#40;xIn,false&#41;;yIn &#58;= CreateParam&#40;'y',ptDataField&#41;; SetIsOutput&#40;yIn,false&#41;;angleOut &#58;= CreateParam&#40;'angle', ptDataField &#41;; setIsInput&#40;angleOut,false&#41;;distanceOut &#58;= CreateParam&#40;'distance', ptDataField &#41;; setIsInput&#40;distanceOut,false&#41;;end;function sgn &#40;a &#58; real&#41; &#58; real;beginif a < 0  then  sgn &#58;= -1else  sgn &#58;=  1;end;function atan2 &#40;y, x &#58; real&#41; &#58; real;beginif x > 0       then  atan2 &#58;= arctan &#40;y/x&#41;else if x < 0  then  atan2 &#58;= arctan &#40;y/x&#41; + pielse                 atan2 &#58;= pi/2 * sgn &#40;y&#41;;end;Procedure Callback&#40;n&#58;integer&#41;;var x&#58;single;var y&#58;single;var angle&#58;single;var distance&#58;single;beginif &#40;n=xIn&#41; or &#40;n=yIn&#41; then beginx &#58;= &#40;getValue&#40;xIn&#41; - 0.5&#41;;y &#58;= &#40;abs&#40;getValue&#40;yIn&#41; - 1&#41; - 0.5&#41;;//angleangle &#58;= atan2&#40;x,y&#41; * 180 / pi;if angle < 0 then angle&#58;= angle + 360;setValue&#40;angleOut, round&#40;angle&#41;&#41;;//distancedistance &#58;= sqrt&#40;x*x + y*y&#41;;setValue &#40;distanceOut, distance&#41;;end;end;

Statistics: Posted by gthibert — 02 Mar 2011, 19:44


]]>
2011-03-01T16:09:52+02:00 2011-03-01T16:09:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18284#p18284 <![CDATA[Angle and distance in an XY Pad]]> Statistics: Posted by gthibert — 01 Mar 2011, 15:09


]]>
2011-03-01T09:30:43+02:00 2011-03-01T09:30:43+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18270#p18270 <![CDATA[Angle and distance in an XY Pad]]> the match formula is

distance = /¯ [ (X1-X2)² + (Y1-Y2)²]

i will look if if i find about angle

Statistics: Posted by nay-seven — 01 Mar 2011, 08:30


]]>
2011-03-01T01:09:55+02:00 2011-03-01T01:09:55+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18265#p18265 <![CDATA[Angle and distance in an XY Pad]]>
It's more a math question than an patching question, but here's the idea.

To control Ambisonic plugins, I want to get the angle (0 to 360) and the distance (0 to 1) of a ball in an XY pad, relative to the center.

Examples :
Ball at the middle = angle of 0, distance of 0.
Ball at upper left corner = angle of 135, distance of 1.
Ball at bottom right corner = angle of 315, distance of 1.

Anyone have an idea ?

- Guillaume

Statistics: Posted by gthibert — 01 Mar 2011, 00:09


]]>
BrainModular BrainModular Users Forum 2011-03-03T02:59:11+02:00 https://brainmodular.com/forums/app.php/feed/topic/2734 2011-03-03T02:59:11+02:00 2011-03-03T02:59:11+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18342#p18342 <![CDATA[Angle and distance in an XY Pad]]>
It works !

The only thing, is that if you want to control angle with a value from 0 to 360 the formula should be :

x = distance * cos(angle/360*pi*2)
y = distance * sin(angle/360*pi*2)

Statistics: Posted by gthibert — 03 Mar 2011, 01:59


]]>
2011-03-03T01:42:41+02:00 2011-03-03T01:42:41+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18339#p18339 <![CDATA[Angle and distance in an XY Pad]]> works fine

Statistics: Posted by nay-seven — 03 Mar 2011, 00:42


]]>
2011-03-03T00:59:00+02:00 2011-03-03T00:59:00+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18336#p18336 <![CDATA[Angle and distance in an XY Pad]]> to reverse the formula:

x = distance*cos(angle)
y = distance*sin(angle)

Statistics: Posted by senso — 02 Mar 2011, 23:59


]]>
2011-03-02T21:42:47+02:00 2011-03-02T21:42:47+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18331#p18331 <![CDATA[Angle and distance in an XY Pad]]> Statistics: Posted by nay-seven — 02 Mar 2011, 20:42


]]>
2011-03-02T21:18:01+02:00 2011-03-02T21:18:01+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18329#p18329 <![CDATA[Angle and distance in an XY Pad]]>
It works on my side...

Statistics: Posted by gthibert — 02 Mar 2011, 20:18


]]>
2011-03-02T21:09:28+02:00 2011-03-02T21:09:28+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18327#p18327 <![CDATA[Angle and distance in an XY Pad]]> don't have anything from the out of the script...

Statistics: Posted by nay-seven — 02 Mar 2011, 20:09


]]>
2011-03-02T21:08:00+02:00 2011-03-02T21:08:00+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18326#p18326 <![CDATA[Angle and distance in an XY Pad]]>
Getting X-Y from angle and distance ?

Guillaume

Statistics: Posted by gthibert — 02 Mar 2011, 20:08


]]>
2011-03-02T20:44:37+02:00 2011-03-02T20:44:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18323#p18323 <![CDATA[Angle and distance in an XY Pad]]>
Here is the script :

CODE:

var xIn &#58; Tparameter;var yIn &#58; Tparameter;var angleOut&#58; Tparameter;var distanceOut&#58; Tparameter;procedure init;begin  xIn &#58;= CreateParam&#40;'x',ptDataField&#41;; SetIsOutput&#40;xIn,false&#41;;yIn &#58;= CreateParam&#40;'y',ptDataField&#41;; SetIsOutput&#40;yIn,false&#41;;angleOut &#58;= CreateParam&#40;'angle', ptDataField &#41;; setIsInput&#40;angleOut,false&#41;;distanceOut &#58;= CreateParam&#40;'distance', ptDataField &#41;; setIsInput&#40;distanceOut,false&#41;;end;function sgn &#40;a &#58; real&#41; &#58; real;beginif a < 0  then  sgn &#58;= -1else  sgn &#58;=  1;end;function atan2 &#40;y, x &#58; real&#41; &#58; real;beginif x > 0       then  atan2 &#58;= arctan &#40;y/x&#41;else if x < 0  then  atan2 &#58;= arctan &#40;y/x&#41; + pielse                 atan2 &#58;= pi/2 * sgn &#40;y&#41;;end;Procedure Callback&#40;n&#58;integer&#41;;var x&#58;single;var y&#58;single;var angle&#58;single;var distance&#58;single;beginif &#40;n=xIn&#41; or &#40;n=yIn&#41; then beginx &#58;= &#40;getValue&#40;xIn&#41; - 0.5&#41;;y &#58;= &#40;abs&#40;getValue&#40;yIn&#41; - 1&#41; - 0.5&#41;;//angleangle &#58;= atan2&#40;x,y&#41; * 180 / pi;if angle < 0 then angle&#58;= angle + 360;setValue&#40;angleOut, round&#40;angle&#41;&#41;;//distancedistance &#58;= sqrt&#40;x*x + y*y&#41;;setValue &#40;distanceOut, distance&#41;;end;end;

Statistics: Posted by gthibert — 02 Mar 2011, 19:44


]]>
2011-03-01T16:09:52+02:00 2011-03-01T16:09:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18284#p18284 <![CDATA[Angle and distance in an XY Pad]]> Statistics: Posted by gthibert — 01 Mar 2011, 15:09


]]>
2011-03-01T09:30:43+02:00 2011-03-01T09:30:43+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18270#p18270 <![CDATA[Angle and distance in an XY Pad]]> the match formula is

distance = /¯ [ (X1-X2)² + (Y1-Y2)²]

i will look if if i find about angle

Statistics: Posted by nay-seven — 01 Mar 2011, 08:30


]]>
2011-03-01T01:09:55+02:00 2011-03-01T01:09:55+02:00 https://brainmodular.com/forums/viewtopic.php?t=2734&p=18265#p18265 <![CDATA[Angle and distance in an XY Pad]]>
It's more a math question than an patching question, but here's the idea.

To control Ambisonic plugins, I want to get the angle (0 to 360) and the distance (0 to 1) of a ball in an XY pad, relative to the center.

Examples :
Ball at the middle = angle of 0, distance of 0.
Ball at upper left corner = angle of 135, distance of 1.
Ball at bottom right corner = angle of 315, distance of 1.

Anyone have an idea ?

- Guillaume

Statistics: Posted by gthibert — 01 Mar 2011, 00:09


]]>