Introduction
The vbias
tool is used to shrink GDS shapes according to their thickness. It is
predominantly intended to be used as a CLI tool, but some public functions are
available.
Quick Index
Quick Start
To run vbias
on a gds file with default settings, you can just run:
vbias input.gds
This will create a new GDS file called biased.gds
.
However, you can also specify options to the vbias
cli:
vbias input.gds -o output.gds -l 6/0 -I 10/0 -E 10/1 -c 0.05,-0.04
This will run the biasing on input.gds
and save the biased version to output.gds
.
Polygons on layer 6/0
will be considered for biasing if they are under the
inclusion layer 10/0
but not under the exclusion layer 10/1. The width of each
polygon (distance between vertex and the closed point at the opposite side of the
polygon) will be reduced by the bias delta equation:
$$
\Delta=0.05 - 0.04 * x
$$
To understand some of the flags better and get some insight in the algorithm, please
have a look at the algorithm overview. You can also get more info on
all available cli flags here, or run vbias --help
The biasing algorithm considers each cell individually, hence inclusion and exclusion layers are only considered if they are at exactly the same hierarchy level as the polygons to bias! You can circumvent this limitation by flattening the GDS.
Algorithm
For an in-depth algorithm overview, click here!
The variable biasing algorithm can roughly be described by the following steps:
- Read the gds file into cells containing simple polygons boundaries.
- Select the relevant boundaries for updates (the layer to bias is determined
-l
cli flag.) - Merge polygons into bigger polygons where possible and combine those merged polygons into a collection of polygons for which none of the polygons touch (as otherwise they would have been merged together).
- Apply variable bias on the exterior and each of the interiors of each of the polygons in the multi polygon: see Algorithm.
- Convert the biased polygons back into simple polygon boundaries with no holes, possibly adding fracture lines to do so.
- Save the GDS file
- Sync with KLayout viewer (if the viewer is open).
The core of the biasing of a single polygons can be summarized as follows:
- Convert the exterior and interior into line strings with counter-clockwise and clockwise winding respectively.
- Loop through each point in each line string
- For each point find the closest point on the closest edge segment on either the same line string or any other line string which still belongs to the same polygon, taking into account a bunch of filtering conditions.
- Use the distance between the point and the edge segment to calculate the bias delta.
- Move the point by the calculated bias delta amount in the direction of the opposite point.
what's described above is just a shortened version of the whole story. Read the full algorithm walkthrough here.