transcriptaze / vpd

VCV panel design web application
MIT License
1 stars 0 forks source link

Add supported component and position items in polar coordinates #4

Open matchaxnb opened 1 month ago

matchaxnb commented 1 month ago

Hi!

Could you add the following components to the app? (source: vcv component library)

This covers most panel use cases I can think of.

Another great option would be to position items radially around a given point in polar coordinates. Typically something like

new module "example" 1U 20HP
new guide vertical 10HP # v1
new guide horizontal 62.4mm # h1
new input "centerInput" v1,h1 PJ301M # i1
new output twelveOClock (input i1x30mm,0deg) PJ301M # top of clock
new output oneOClock (input i1x30mm,30deg) PJ301M # 1:00
new output twoOClock (input i1x30mm,60deg) PJ301M # 2:00
new output threeOClock (input i1x30mm,90deg) PJ301M # 3:00
...

would make sense for positioning elements in the plane with systems other than cartesian (i frequently use that in CAD software).

WDYT? I would help, but ramping up in Rust will take time. :) Thanks for your awesome piece.

twystd commented 1 month ago

That all looks quite reasonable :-) ... thanks for the suggestions!

It may make more sense to implement the polar coordinates as guidelines rather than positions .. although the twelveoclock idea is kinda intriguing. Let me see what happens when I get to that point...

I'll post updates here as things are available for you to look at and comment on.

twystd commented 3 weeks ago

Hi,

Quick note to let you know that the slider, trimpot, button and pushbutton components have been added to the online VPD - it turns out that the VCV horizontal slider is completely broken and unusable so I didn't implement that:

Screenshot 2024-09-27 at 10 29 23

This is just a first pass - I still need to go through and zoot it up a bit and do the documentation, etc, etc, and I also want to rethink the grammar a bit, along with the internals to make adding components easier and logical in future.

But - it's at least usable in the current form, e.g.:

new parameter t1  v1,h1 Trimpot
new parameter pb1 v1,h2 PushButton
new parameter b1  v1,h3 Button
new parameter sl1 v2,h2 Slider

There's a demo project in doc/extras that implements all the controls. Let me know what you think.

Now for the polar coordinates ..

matchaxnb commented 3 weeks ago

Hey,

I'm delighted :) alright, i guess we can avoid using the horizontal slider anyway. Vertical is very fine.

twystd commented 3 weeks ago

Cool! Thanks for taking a look :-).

I did do a quick informal survey of the modules (at least the ones in my Rack) and it looks like vertical sliders are the norm. Not too sure why - it might be a carry-over from physical mixing desks and synths or maybe just they fit better visually with the panel dimensions. But if you can find a horizontal slider implementation you like am happy to add it.

twystd commented 1 week ago

That turned out to be a little more complicated than anticipated .. however, VPD now has support for polar coordinates: 1cc1e42a-6f6d-4e88-995e-0779b1695b60

I still need to update the documentation and cleanup the code a bit, but the basic syntax looks like:

new light Red @30°,15.24mm LED
new light Red 30°,15.24mm LED
new light Red (v1,h1 30°,15.24mm) LED
new light Red (centre,middle 30°,15.24mm) LED
new light Red (input i1 30°,15.24mm) LED

You can use either the ° symbol (Option-Shift-8 on a Mac) or deg or degrees:

new light Red (v1,h1 30°,15.24mm) LED
new light Red (v1,h1 30deg,15.24mm) LED
new light Red (v1,h1 30degrees,15.24mm) LED
matchaxnb commented 1 week ago

C'est magnifique, thanks a lot. Is this published on the online version? That's a very smart implementation, thanks a lot.

twystd commented 1 week ago

It turned out to be a very neat idea (plus it gave me the incentive to clean up some very gnarly code) so thanks for that! And yup, the online version has the latest and greatest so you can try it out there. Oh, and the set ... syntax looks like:

set parameter p1 xy @30°,20mm
set parameter p1 xy 30°,20mm
set parameter p1 xy (v1,h1 30°,20mm)
set parameter p1 xy (left,middle 30°,20mm)
set parameter p1 xy (input i1 30°,20mm)

The user guide will (hopefully) get updated over the course of the next couple of days..