stuf/circuiteer

Use matrices for positions and dimensions instead of tuples

Closed this issue · 1 comments

stuf commented

For the sakes of simplicity in handling positions and sizes w.r.t. the grid, use Matrix as exported by common/linear instead of manually converting between grid-space and screen-space position.

Remember to create an isomorphism for using relevant data either as scaled to grid-space or screen-space.

Note to self:

// Iso for reading data as a matrix, but data is written as an array
const matrixI = L.iso(xy => new Matrix(xy), m => m.data.flat())

// Parametric iso when for reading values as grid-space but writing them in screen-space
const screenI = gxy => [matrixI, L.iso(m => m.div(gxy).map(Math.round), m => m.mul(gxy))]
stuf commented

Implemented in commit 19234be — create a new issue for ensuring the missing asGridPointI iso lens is implemented.