• Convert X-Y coordinates into a range of 360\.

I would like to take the coordinates from objects being tracked on a 2d plane and convert them to a single range of 360 degrees for panning purposes. I am using a quadrophonic setup with speakers on each corner of a rectangular 2d plane, so speaker 1 would be located at 0 degrees, speaker 2 at 90 degrees, 3 at 180, and 4 at 270. The x-y coordinates are ranges of 0-1.

Essentially the values I would like after conversion are:

X:0 Y:0 = 0°
X:1 Y:0 = 90°
X:1 Y:1 = 180°
X:0 Y:1 = 270°

Is there any way I can achieve this?

Edit: Spelling

• Posts 7 | Views 3564
• [cyclone/cartopol] converts the x-y cartesian coordinates to magnitude and phase/angle in radians. You can then convert the radians to degrees using [zexy/rad2deg].

h: http://rickygraham.com | t: @deltasoundlabs | fb: signalsundertests | sc: rickygraham

• Cheers guys. Someone helped me out soon after I posted buy thanks anyway. I didn't know about rad2deg either, useful to know.

• @ricky said:

I can't tell you how many times I've done that...

But in the end, really, doing that stuff has really helped me to understand programming in Pd. I often tend to make Pd versions of externals I already know exist just to see if I can do them and to get a better understanding of how they work. I find I just trust the versions I make more, anyway.

• Agreed!

h: http://rickygraham.com | t: @deltasoundlabs | fb: signalsundertests | sc: rickygraham

• Yeah, I think in this case there are good arguments for rolling your own. Basically, whenever an object can be replaced with a single [expr], I'm inclined to make that replacement.

Posts 7 | Views 3564
Internal error.

Oops! Looks like something went wrong!