Ambisonic trajectory or expr problem

tomgalileo's icon

Hello,
I really cannot figure out how can I move a point along a circle
trajectory, in ambisonic context.

I don't want to use ambisonic rotate mode feature as it has limited
controls.
So i am trying to use expr object.

Let's forget about z coordinates by now,
and say I want to move point A(x,y) knowing just its x coordinate,
the radium (1) and the center point Origin(0,0) of the circumference
I want to move the point along.

I have been using this 2 formulas, but none of them works for
negative values.

Have someone already did that, or know how to deal with negative
values and circumference formulas on a cartesian plane?

really really thanx in advance
im stuck

tom

tomgalileo's icon

Hello again,
this is an update of the problem, to show that the formula works
if I use it for calculating the radium:

thanks

please let me know if you can

tom

tomgalileo's icon

patch with point loaded on startup

Martin Leese's icon

So, what formulae are you using?

jasch's icon

hi tom,

what you really need is to convert your position information into
polar (or spherical) coordinates:
you already went part of the way, you're missing how to get the angle
from x and y

in the attached patch i show the full roundtrip of conversion from
cartesian to polar coordinates:
also have a look at http://mathworld.wolfram.com/PolarCoordinates.html

the icst ambisonic tools mainly work in sperical coordinates, since
this is the native format of the ambisonic domain.

for this reason the ambimonitor can handle both types and
transparently converts between the two.

hth

/*j

Max Patch
Copy patch and select New From Clipboard in Max.

tomgalileo's icon

thank you jasch
very very much.
Now, all the explanation looks great and clear.
I'm studying it now and try to understand if I can do what I want
into polar coordinates.
Il let you know. By now really really thanx

Martin hi,
the formula I was using is this

x2 + y2 - r2 = 0

where x2/y2/r2 mean at the power of 2 (sorry if I dont talk
mathematically correct)

Well the fact is this:
I wanted to be able to just give values of x from -1 to 1 and obtain
the corresponding values for y along a circle trajectory,
using that formula.
By the way jasch teaches me that I cannot do it unless in polar
coordinates, as with cartesian I get stuck with square roots of
negative values,
so that i can draw on ambimonitor only a half-circle trajectory.

Thank you guys, I let you know if I go through it,
but now it's all more clear.

Regards

tom

On 17 Apr 2008, at 17:59, jasch wrote:

> hi tom,
>
> what you really need is to convert your position information into
> polar (or spherical) coordinates:
> you already went part of the way, you're missing how to get the
> angle from x and y
>
> in the attached patch i show the full roundtrip of conversion from
> cartesian to polar coordinates:
> also have a look at http://mathworld.wolfram.com/PolarCoordinates.html
>
> the icst ambisonic tools mainly work in sperical coordinates, since
> this is the native format of the ambisonic domain.
>
> for this reason the ambimonitor can handle both types and
> transparently converts between the two.
>
> hth
>
> /*j
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 551 718 14 196617 y;
> #P comment 514 718 14 196617 x;
> #P comment 713 651 112 196617 eq. 2 on the same page;
> #P comment 713 633 112 196617 eq. 1 on the same page;
> #P comment 636 491 147 196617 eq. 4 on the same page:;
> #P flonum 595 510 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 595 489 35 196617 atan2;
> #P window linecount 4;
> #P message 679 412 145 196617 ; max launchbrowser http://
> mathworld.wolfram.com/PolarCoordinates.html;
> #P window linecount 1;
> #P comment 678 395 147 196617 eq. 3 on the following page:;
> #P comment 577 602 80 196617 angle in radian;
> #P comment 616 651 84 196617 y = r*cos(theta);
> #P comment 616 635 84 196617 x = r*sin(theta);
> #P comment 520 617 38 196617 radius;
> #P flonum 550 700 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 513 700 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 513 633 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 550 679 29 196617 * 1.;
> #P flonum 569 633 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 513 679 29 196617 * 1.;
> #P newex 569 653 21 196617 sin;
> #P newex 532 653 23 196617 cos;
> #P window linecount 4;
> #P message 681 725 147 196617 ; max launchbrowser http://
> mathworld.wolfram.com/PythagoreanTheorem.html;
> #P window linecount 2;
> #P message 379 46 221 196617 ; max launchbrowser www.icst.net/
> downloads;
> #P window linecount 1;
> #P comment 378 30 232 196617 this patch uses the ICST's ambimonitor-
> external:;
> #P newex 309 659 90 196617 pak xyz 1 0. 0. 0.;
> #P user ambimonitor 309 682 105 105 0 1 0 0 0 0 777;
> #X rgb1 255 255 255;
> #X rgb2 255 255 255;
> #X rgb3 255 255 255;
> #X rgb4 255 255 255;
> #X rgb5 32 22 60;
> #X rgb6 0 0 0;
> #X rgb7 16 55 100;
> #X rgb8 1 45 139;
> #P newex 286 534 22 196617 b 1;
> #P comment 490 562 46 196617 deg2rad;
> #P comment 490 449 46 196617 rad2deg;
> #P comment 383 585 109 196617 angle in radian (theta);
> #P newex 433 115 60 196617 loadmess 5;
> #P comment 322 114 47 196617 distance;
> #P comment 268 114 51 196617 elevation;
> #P flonum 222 133 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 259 133 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 296 133 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 225 160 88 196617 pak aed 1 0. 0. 0.;
> #P flonum 345 636 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 308 636 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 345 538 40 196617 * -1.;
> #P flonum 345 585 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 345 518 33 196617 - 90.;
> #P newex 345 560 143 196617 expr $f1 * (3.141593/180.);
> #P window setfont "Sans Serif" 18.;
> #P comment 51 531 188 196626 and how to go back:;
> #B frgb 255 255 255;
> #P window setfont "Sans Serif" 9.;
> #P newex 308 612 47 196617 poltocar;
> #P window linecount 2;
> #P comment 384 495 143 196617 angle in degrees with zero straight
> ahead;
> #P flonum 345 495 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 345 467 36 196617 !- 90.;
> #P newex 345 447 143 196617 expr $f1 * (180./3.141593);
> #P comment 381 424 109 196617 angle in radian (theta);
> #P comment 268 495 38 196617 radius;
> #P flonum 345 423 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 308 495 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 308 384 47 196617 cartopol;
> #P comment 682 708 105 196617 pythagorean theorem;
> #P comment 223 96 263 196617 it's so much easier to do a rotation
> in polar coordinates:;
> #P comment 125 347 99 196617 distance == RADIUS;
> #P newex 228 326 35 196617 * 0.1;
> #P flonum 228 346 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 2;
> #P comment 33 305 120 196617 Here you get azimuth elevation
> distance values;
> #P window linecount 1;
> #P newex 156 306 102 196617 unpack s 0 0. 0. 0. 0;
> #P newex 272 306 102 196617 unpack s 0 0. 0. 0. 0;
> #P flonum 345 334 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 308 334 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 636 374 193 196617 expr sqrt(pow($f1\,2) + pow($f2\,2));
> #P flonum 636 394 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user ambimonitor 225 184 105 105 0 1 0 0 0 0 777;
> #X rgb1 255 255 255;
> #X rgb2 255 255 255;
> #X rgb3 255 255 255;
> #X rgb4 255 255 255;
> #X rgb5 32 22 60;
> #X rgb6 0 0 0;
> #X rgb7 16 55 100;
> #X rgb8 1 45 139;
> #P comment 379 308 100 196617 Here I get x y values;
> #P comment 648 339 75 196617 RADIUS value:;
> #P window setfont "Sans Serif" 18.;
> #P window linecount 2;
> #P comment 37 384 231 196626 how to go from cartesian to polar
> coordinates:;
> #B frgb 255 255 255;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 222 114 45 196617 azimuth;
> #P user panel 27 378 259 61;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 29 527 248 34;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 296 609 74 24;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 300 380 74 24;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P comment 223 60 100 196617 jasch 20080417;
> #P window setfont "Sans Serif" 18.;
> #P comment 33 32 285 196626 polar and cartesian coordinates;
> #P window setfont "Sans Serif" 9.;
> #P comment 576 617 33 196617 theta;
> #P connect 11 0 17 0;
> #P connect 41 0 11 0;
> #P connect 17 4 20 0;
> #P connect 20 0 19 0;
> #P connect 44 0 41 2;
> #P connect 11 1 16 0;
> #P connect 43 0 41 3;
> #P connect 31 0 51 0;
> #P connect 47 0 42 0;
> #P connect 42 0 41 4;
> #P hidden connect 16 2 14 0;
> #P connect 14 0 24 0;
> #P connect 24 0 25 0;
> #P connect 25 0 33 0;
> #P connect 51 0 33 0;
> #P connect 33 0 39 0;
> #P connect 53 0 52 0;
> #P hidden connect 16 3 15 0;
> #P connect 15 0 24 1;
> #P connect 24 1 26 0;
> #P connect 26 0 29 0;
> #P connect 29 0 30 0;
> #P connect 30 0 31 0;
> #P connect 31 0 36 0;
> #P connect 36 0 38 0;
> #P connect 38 0 35 0;
> #P connect 35 0 37 0;
> #P connect 37 0 33 1;
> #P connect 33 1 40 0;
> #P connect 39 0 53 2;
> #P connect 40 0 53 3;
> #P fasten 25 0 62 0 313 605 518 605;
> #P connect 62 0 59 0;
> #P connect 59 0 63 0;
> #P connect 60 0 57 0;
> #P connect 57 0 59 1;
> #P fasten 62 0 61 0 518 674 555 674;
> #P connect 61 0 64 0;
> #P fasten 37 0 60 0 350 601 574 601;
> #P connect 60 0 58 0;
> #P connect 58 0 61 1;
> #P fasten 15 0 71 0 350 374 600 374;
> #P connect 71 0 72 0;
> #P fasten 14 0 71 1 313 368 625 368;
> #P fasten 14 0 13 0 313 362 641 362;
> #P connect 13 0 12 0;
> #P fasten 15 0 13 1 350 356 824 356;
> #P window clipboard copycount 78;
>

tomgalileo's icon

well, no words to thanks.

tom

On 17 Apr 2008, at 17:59, jasch wrote:

> hi tom,
>
> what you really need is to convert your position information into
> polar (or spherical) coordinates:
> you already went part of the way, you're missing how to get the
> angle from x and y
>
> in the attached patch i show the full roundtrip of conversion from
> cartesian to polar coordinates:
> also have a look at http://mathworld.wolfram.com/PolarCoordinates.html
>
> the icst ambisonic tools mainly work in sperical coordinates, since
> this is the native format of the ambisonic domain.
>
> for this reason the ambimonitor can handle both types and
> transparently converts between the two.
>
> hth
>
> /*j
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 551 718 14 196617 y;
> #P comment 514 718 14 196617 x;
> #P comment 713 651 112 196617 eq. 2 on the same page;
> #P comment 713 633 112 196617 eq. 1 on the same page;
> #P comment 636 491 147 196617 eq. 4 on the same page:;
> #P flonum 595 510 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 595 489 35 196617 atan2;
> #P window linecount 4;
> #P message 679 412 145 196617 ; max launchbrowser http://
> mathworld.wolfram.com/PolarCoordinates.html;
> #P window linecount 1;
> #P comment 678 395 147 196617 eq. 3 on the following page:;
> #P comment 577 602 80 196617 angle in radian;
> #P comment 616 651 84 196617 y = r*cos(theta);
> #P comment 616 635 84 196617 x = r*sin(theta);
> #P comment 520 617 38 196617 radius;
> #P flonum 550 700 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 513 700 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 513 633 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 550 679 29 196617 * 1.;
> #P flonum 569 633 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 513 679 29 196617 * 1.;
> #P newex 569 653 21 196617 sin;
> #P newex 532 653 23 196617 cos;
> #P window linecount 4;
> #P message 681 725 147 196617 ; max launchbrowser http://
> mathworld.wolfram.com/PythagoreanTheorem.html;
> #P window linecount 2;
> #P message 379 46 221 196617 ; max launchbrowser www.icst.net/
> downloads;
> #P window linecount 1;
> #P comment 378 30 232 196617 this patch uses the ICST's ambimonitor-
> external:;
> #P newex 309 659 90 196617 pak xyz 1 0. 0. 0.;
> #P user ambimonitor 309 682 105 105 0 1 0 0 0 0 777;
> #X rgb1 255 255 255;
> #X rgb2 255 255 255;
> #X rgb3 255 255 255;
> #X rgb4 255 255 255;
> #X rgb5 32 22 60;
> #X rgb6 0 0 0;
> #X rgb7 16 55 100;
> #X rgb8 1 45 139;
> #P newex 286 534 22 196617 b 1;
> #P comment 490 562 46 196617 deg2rad;
> #P comment 490 449 46 196617 rad2deg;
> #P comment 383 585 109 196617 angle in radian (theta);
> #P newex 433 115 60 196617 loadmess 5;
> #P comment 322 114 47 196617 distance;
> #P comment 268 114 51 196617 elevation;
> #P flonum 222 133 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 259 133 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 296 133 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 225 160 88 196617 pak aed 1 0. 0. 0.;
> #P flonum 345 636 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 308 636 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 345 538 40 196617 * -1.;
> #P flonum 345 585 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 345 518 33 196617 - 90.;
> #P newex 345 560 143 196617 expr $f1 * (3.141593/180.);
> #P window setfont "Sans Serif" 18.;
> #P comment 51 531 188 196626 and how to go back:;
> #B frgb 255 255 255;
> #P window setfont "Sans Serif" 9.;
> #P newex 308 612 47 196617 poltocar;
> #P window linecount 2;
> #P comment 384 495 143 196617 angle in degrees with zero straight
> ahead;
> #P flonum 345 495 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 345 467 36 196617 !- 90.;
> #P newex 345 447 143 196617 expr $f1 * (180./3.141593);
> #P comment 381 424 109 196617 angle in radian (theta);
> #P comment 268 495 38 196617 radius;
> #P flonum 345 423 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 308 495 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 308 384 47 196617 cartopol;
> #P comment 682 708 105 196617 pythagorean theorem;
> #P comment 223 96 263 196617 it's so much easier to do a rotation
> in polar coordinates:;
> #P comment 125 347 99 196617 distance == RADIUS;
> #P newex 228 326 35 196617 * 0.1;
> #P flonum 228 346 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 2;
> #P comment 33 305 120 196617 Here you get azimuth elevation
> distance values;
> #P window linecount 1;
> #P newex 156 306 102 196617 unpack s 0 0. 0. 0. 0;
> #P newex 272 306 102 196617 unpack s 0 0. 0. 0. 0;
> #P flonum 345 334 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 308 334 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 636 374 193 196617 expr sqrt(pow($f1\,2) + pow($f2\,2));
> #P flonum 636 394 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user ambimonitor 225 184 105 105 0 1 0 0 0 0 777;
> #X rgb1 255 255 255;
> #X rgb2 255 255 255;
> #X rgb3 255 255 255;
> #X rgb4 255 255 255;
> #X rgb5 32 22 60;
> #X rgb6 0 0 0;
> #X rgb7 16 55 100;
> #X rgb8 1 45 139;
> #P comment 379 308 100 196617 Here I get x y values;
> #P comment 648 339 75 196617 RADIUS value:;
> #P window setfont "Sans Serif" 18.;
> #P window linecount 2;
> #P comment 37 384 231 196626 how to go from cartesian to polar
> coordinates:;
> #B frgb 255 255 255;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 222 114 45 196617 azimuth;
> #P user panel 27 378 259 61;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 29 527 248 34;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 296 609 74 24;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 300 380 74 24;
> #X brgb 255 127 0;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P comment 223 60 100 196617 jasch 20080417;
> #P window setfont "Sans Serif" 18.;
> #P comment 33 32 285 196626 polar and cartesian coordinates;
> #P window setfont "Sans Serif" 9.;
> #P comment 576 617 33 196617 theta;
> #P connect 11 0 17 0;
> #P connect 41 0 11 0;
> #P connect 17 4 20 0;
> #P connect 20 0 19 0;
> #P connect 44 0 41 2;
> #P connect 11 1 16 0;
> #P connect 43 0 41 3;
> #P connect 31 0 51 0;
> #P connect 47 0 42 0;
> #P connect 42 0 41 4;
> #P hidden connect 16 2 14 0;
> #P connect 14 0 24 0;
> #P connect 24 0 25 0;
> #P connect 25 0 33 0;
> #P connect 51 0 33 0;
> #P connect 33 0 39 0;
> #P connect 53 0 52 0;
> #P hidden connect 16 3 15 0;
> #P connect 15 0 24 1;
> #P connect 24 1 26 0;
> #P connect 26 0 29 0;
> #P connect 29 0 30 0;
> #P connect 30 0 31 0;
> #P connect 31 0 36 0;
> #P connect 36 0 38 0;
> #P connect 38 0 35 0;
> #P connect 35 0 37 0;
> #P connect 37 0 33 1;
> #P connect 33 1 40 0;
> #P connect 39 0 53 2;
> #P connect 40 0 53 3;
> #P fasten 25 0 62 0 313 605 518 605;
> #P connect 62 0 59 0;
> #P connect 59 0 63 0;
> #P connect 60 0 57 0;
> #P connect 57 0 59 1;
> #P fasten 62 0 61 0 518 674 555 674;
> #P connect 61 0 64 0;
> #P fasten 37 0 60 0 350 601 574 601;
> #P connect 60 0 58 0;
> #P connect 58 0 61 1;
> #P fasten 15 0 71 0 350 374 600 374;
> #P connect 71 0 72 0;
> #P fasten 14 0 71 1 313 368 625 368;
> #P fasten 14 0 13 0 313 362 641 362;
> #P connect 13 0 12 0;
> #P fasten 15 0 13 1 350 356 824 356;
> #P window clipboard copycount 78;
>