Forums > MaxMSP

### 'Circular' Scaling Question

Aug 26 2011 | 12:18 pm

Hello all,

Mathematics related problem, maybe someone with more knowledge can help me out:

I’m currently scaling 0. to 360. to get -180. to 180. so that 180. = 0.

I’d also like to scale 0. to 360. to get 90. to 90. so that 180. = -90.

I hope that makes enough sense? Sorry maths isn’t my strong point, I’ve encountered difficult problems before and found my way via trial and error but this has me stumped.

Thanks

Aug 26 2011 | 12:38 pm

This is what I have so far, got to be a simpler way:

— Pasted Max Patch, click to expand. —
Aug 26 2011 | 12:49 pm

DEvo – What I mean is it needs to stay within the -180. to 180. range but 0. needs to equal 90. rather than -180.

Aug 26 2011 | 12:49 pm

Isn’t this the first one? The second one is a bit more tricky. I’ll see if i can wrap my head around that one.

`

— Pasted Max Patch, click to expand. —

We almost posted simultaneous, i think you need a sin/cos/tan function for that.

Aug 26 2011 | 12:51 pm

Yes FRid that’s right, that was no problem. As you say the second problem is trickier and my patch doesn’t do it very cleanly.

Thanks for the input and interest so far! I have faith someone can help me!

Aug 26 2011 | 1:12 pm

Attached a rough diagram demonstrating what I mean. Sorry for any confusion!

[attachment=169705,2577]

###### Attachments:
1. CircScale.png

Aug 26 2011 | 1:40 pm

This is my best solution so far, realised I didn’t need that gate before:

— Pasted Max Patch, click to expand. —
Aug 26 2011 | 2:21 pm

You could also use [% 360] to get what you need.

``````
-- Pasted Max  Patch, click to expand. --

```
```
Aug 26 2011 | 2:22 pm

Ah man. I wish i had paid more attention during class. Feels a bit like cheating.

``````
-- Pasted Max  Patch, click to expand. --

```
This one is correct
```
Aug 26 2011 | 2:30 pm

Oops, no not correct according to the diagram. I focussed too much on the 0. 360. >> 90. 90. my bad.

Concerning the diagram whats up with -180/180 in the innercircle? And won’t poltocar/cartopol help out here somehow?

Aug 26 2011 | 2:31 pm

Thanks for all of the suggestions, I’ve now got several methods to compare. What a nice brain workout eh?

FRid – the 180/-180 is the overlap for each side of the circle. 0 to 180 on one side 0 to -180 on the other. Sorry that was a quick Paintbrush diagram.

Aug 26 2011 | 2:46 pm

That was also my bad (again!) After taking a second look i got it. Maybe i should start paying more attention in general :) And these are nice puzzles indeed.

FRid

@ p.m. Nice one! Somehow the "funny" symbols remain obscure to me

Sep 01 2011 | 12:29 pm

[%] The funny symbol? :) That’s a good way to call it.
The modulo is perfectly suited for circular operation since it will always output a value within a given range, whatever is the input. Combining a [% 360] with a [-180], you will always get a output within -180,180. If you want that to be scaled, just do the scale operation before.

``````
-- Pasted Max  Patch, click to expand. --

```
```
Sep 07 2011 | 7:15 pm

Yeah, i didn’t have a better description at hand. For some reason i focussed too much on the exclamation-mark family of operators and modulo never really came to mind.