tscircuit/autorouting-dataset-01

This code manages the hardware and electronic components for circuit design and PCB layout, defining components like resistors, capacitors, transistors, connectors, and footprints, and providing tools for component placement, PCB topology, and electrical connections.

Version
1.0.102
License
unset
Stars
4

scripts/random-circuits/getBoardBoundsWithPadding.ts

import type { Bounds } from "lib/maths/box"

/**
 * Calculates the inner board boundaries based on board size and padding.
 */
export const getBoardBoundsWithPadding = (
  boardSize: { width: number; height: number },
  padding: number,
): Bounds => {
  return {
    minX: -boardSize.width / 2 + padding,
    maxX: boardSize.width / 2 - padding,
    minY: -boardSize.height / 2 + padding,
    maxY: boardSize.height / 2 - padding,
  }
}