Added tests for fill tool

This commit is contained in:
Matthias Koefferlein 2021-03-05 16:27:57 +01:00
parent af5435f869
commit 0d04937c91
8 changed files with 69 additions and 6 deletions

View File

@ -383,15 +383,15 @@ rasterize_extended (const db::Polygon &fp, const db::Box &fc_bbox, db::AreaMap &
}
static db::IMatrix2d
compute_shear_matrix (const db::Vector &row_step, const db::Vector &column_step)
compute_shear_matrix (const db::Vector &r, const db::Vector &c)
{
db::IMatrix2d mr = db::IMatrix2d (1.0, 0.0, -double (row_step.y ()) / double (row_step.x ()), 1.0);
double det = r.x () * c.y () - r.y () * c.x ();
double csy = column_step.y () + mr.m21 () * column_step.x ();
double m11 = c.y () * r.x () / det;
double m12 = -c.x () * r.x () / det;
double m22 = c.y () * r.x () / det;
db::IMatrix2d mc = db::IMatrix2d (1.0, -double (column_step.x ()) / csy, 0.0, 1.0);
return mc * mr;
return IMatrix2d (m11, m12, m12, m22);
}
DB_PUBLIC bool

View File

@ -52,3 +52,66 @@ TEST(1)
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/algo/fill_tool_au1.gds");
}
TEST(2)
{
db::Layout ly;
{
std::string fn (tl::testsrc ());
fn += "/testdata/algo/fill_tool2.gds";
tl::InputStream stream (fn);
db::Reader reader (stream);
reader.read (ly);
}
db::cell_index_type fill_cell = ly.cell_by_name ("FILL_CELL").second;
db::cell_index_type top_cell = ly.cell_by_name ("TOP").second;
unsigned int fill_layer = ly.get_layer (db::LayerProperties (1, 0));
db::Region fill_region (db::RecursiveShapeIterator (ly, ly.cell (top_cell), fill_layer));
db::Region remaining_parts, remaining_polygons;
db::fill_region (&ly.cell (top_cell), fill_region, fill_cell, ly.cell (fill_cell).bbox (), db::Point (), true, &remaining_parts, db::Vector (50, 100), &remaining_polygons);
unsigned int l100 = ly.insert_layer (db::LayerProperties (100, 0));
unsigned int l101 = ly.insert_layer (db::LayerProperties (101, 0));
remaining_parts.insert_into (&ly, top_cell, l100);
remaining_polygons.insert_into (&ly, top_cell, l101);
CHECKPOINT();
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/algo/fill_tool_au2.gds");
}
TEST(3)
{
db::Layout ly;
{
std::string fn (tl::testsrc ());
fn += "/testdata/algo/fill_tool3.gds";
tl::InputStream stream (fn);
db::Reader reader (stream);
reader.read (ly);
}
db::cell_index_type fill_cell = ly.cell_by_name ("FILL_CELL").second;
db::cell_index_type top_cell = ly.cell_by_name ("TOP").second;
unsigned int fill_layer = ly.get_layer (db::LayerProperties (1, 0));
db::Region fill_region (db::RecursiveShapeIterator (ly, ly.cell (top_cell), fill_layer));
db::Region remaining_parts, remaining_polygons;
db::Vector ko (-100, -130);
db::Vector rs (230, 40);
db::Vector cs (40, 230);
db::fill_region (&ly.cell (top_cell), fill_region, fill_cell, ko, rs, cs, db::Point (), true, &remaining_parts, db::Vector (50, 100), &remaining_polygons);
unsigned int l100 = ly.insert_layer (db::LayerProperties (100, 0));
unsigned int l101 = ly.insert_layer (db::LayerProperties (101, 0));
remaining_parts.insert_into (&ly, top_cell, l100);
remaining_polygons.insert_into (&ly, top_cell, l101);
CHECKPOINT();
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/algo/fill_tool_au3.gds");
}

Binary file not shown.

BIN
testdata/algo/fill_tool2.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/fill_tool3.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/fill_tool_au1.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/fill_tool_au2.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/fill_tool_au3.gds vendored Normal file

Binary file not shown.