leomcelroy / svg-pcb

Design PCBs in the Browser
https://www.leomcelroy.com/svg-pcb-website
GNU General Public License v3.0
64 stars 9 forks source link

Builtin geometry math primitives #64

Open ducky64 opened 11 months ago

ducky64 commented 11 months ago

It would be useful to have a more complete library of geometry functions. This might be as simple as importing some common JS geometry library, the key would be something that works out of the box.

The primitives I've used in my boards are:

I'm using points and vectors interchangeably, and they're the same from a data structures point of view, but there may be more accurate terminology.

Additionally, it seems points are currently represented as a list of [x, y]. A geometry library that allows math operations directly (e.g. pt1 + pt2) would also allow for cleaner code.