svg-pcb
svg-pcb copied to clipboard
Builtin geometry math primitives
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:
- Point addition
- Point subtraction
- Midpoint of two points
- Vector rotation
- Vector scaling
- Vector projection (projection of some vector onto a reference vector)
- But there's probably something more general
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.