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/validate-srj/getObstacleThatHavePointsToConnect.ts
import { getBoundFromCenteredRect, isPointInsideBounds } from "lib/maths/box"
import type { Obstacle, SimpleRouteJson } from "tscircuit"
/** Returns obstacles containing at least one connection point. */
export const getObstacleThatHavePointsToConnect = (
obstacle: Obstacle[],
pointToConnect: SimpleRouteJson["connections"][number]["pointsToConnect"],
): Obstacle[] => {
return obstacle.filter((obstacle) => {
const obstacleBounds = getBoundFromCenteredRect(obstacle)
return pointToConnect.some((point) => {
return isPointInsideBounds(point, obstacleBounds)
})
})
}