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

import { mapLayerNameToZ } from "lib/layer/mapLayerNameToZ"
import type { Obstacle } from "tscircuit"

/** Checks whether two obstacles share at least one layer. */
export const obstacleShareLayers = (
  obstacle1: Obstacle,
  obstacle2: Obstacle,
  layerCount: number,
): boolean => {
  const layers1 = obstacle1.layers.map((layer) =>
    mapLayerNameToZ(layer, layerCount),
  )
  const layers2 = obstacle2.layers.map((layer) =>
    mapLayerNameToZ(layer, layerCount),
  )
  return layers1.some((layer) => layers2.includes(layer))
}