gokul/fieldkit-usb

USB-C-powered ESP32-S3 Wi-Fi/Bluetooth handheld with an SMD 128x32 OLED, six navigation buttons, USB-C power/data, complete checked routing, and four native schematic sheets.

Version
0.4.2
License
UNLICENSED
Stars
0

lib/board-path.ts

import { applyToPoint, compose, inverse, rotateDEG, translate } from "transformation-matrix"
import type { PcbPathPoint } from "@tscircuit/props"

export const boardPath = ({ origin, rotationDegrees = 0, points }: {
  origin: { x: number; y: number }
  rotationDegrees?: number
  points: (Omit<PcbPathPoint, "x" | "y"> & { x: number; y: number })[]
}) => {
  const boardToComponent = inverse(compose(translate(origin.x, origin.y), rotateDEG(rotationDegrees)))
  return points.map(point => ({ ...point, ...applyToPoint(boardToComponent, point) }))
}