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/buildGridPositions.ts

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

export const buildGridPositions = (
  bounds: Bounds,
  step: number,
): Array<{ pcbX: number; pcbY: number }> => {
  const positions: Array<{ pcbX: number; pcbY: number }> = []
  for (let x = bounds.minX; x <= bounds.maxX + 1e-9; x += step) {
    for (let y = bounds.minY; y <= bounds.maxY + 1e-9; y += step) {
      positions.push({ pcbX: x, pcbY: y })
    }
  }
  return positions
}