Limit the movement of the pictslider in a circle

Just Evan's icon

Hi,

I'm trying to make a circle X Y slider, for this I'm going to use the [pictslider] object. My problem is that the UI of the [pictslider] object has a square shape.

How can I make [pictslider] move in a circle?

Or use 2 [pictslider] the coordinates of the first one will be converted to circular and sent to the 2nd [pictslider], then just make the first one transparent, or something like that...

Maybe someone can help me with this?

TFL's icon

The easy way here is to use [cartopol] + [poltocar].

I thought sending the limited values prepended by "set" back to the same [pictslider] would work, as mentioned by Roman here, but apparently not: you can still visually move the slider outside of the imaginary circle. But connecting a second pictslider only to display the result as you suggested will work:

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

Roman Thilenius's icon

maybe modern version of max broke that?... getting mouse data while mouse button down is always good for a surprise.... but the "set to maximum" method still works with lcd or jitter based GUI elements ;)

TFL's icon

Doesn't work in Max 8.6.5 either (I could swear it was! But maybe not).

The funny thing is that it works for a simple slider, and many other objects. I tried with [nodes] and... it works too, but not very well (gets a bit stuck when reaching borders of the circle limit). I never realized you cannot set the [nodes] slider position in cartesian coordinates, you have to use polar coordinates, starting with the angle in degrees, shifted by half-pi...

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

Roman Thilenius's icon

it obviously draws before it outputs when the mouse is down.

or can it be that the update frequency has a min time?

the only other object where you are also moving a loaded graphics file is lcd/sprites (11 years deprecated and most likely a different drawing method), so we have nothing to test against.

i just tried overdrive, defer and using ints with "set", but it doesnt change a thing.

Christopher Dobrian's icon

If you know JavaScript, you can design your own circular slider in v8ui (jsui). Here's the basic idea, but using v8 and lcd.

circularXYslider.maxpat
Max Patch