Merge pull request #308 from KLayout/issue-305

Fixed issue #305 (CIF reader issue with rotated boxes)
This commit is contained in:
Matthias Köfferlein 2019-07-21 23:49:11 +02:00 committed by GitHub
commit 8a66f59b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 4 deletions

View File

@ -592,11 +592,13 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level)
double xw = sf * w * 0.5 * rx * n, yw = sf * w * 0.5 * ry * n;
double xh = -sf * h * 0.5 * ry * n, yh = sf * h * 0.5 * rx * n;
db::Point c (sf * x, sf * y);
db::Point points [4];
points [0] = db::Point (x - xw - xh, y - yw - yh);
points [1] = db::Point (x - xw + xh, y - yw + yh);
points [2] = db::Point (x + xw + xh, y + yw + yh);
points [3] = db::Point (x + xw - xh, y + yw - yh);
points [0] = c + db::Vector (-xw - xh, -yw - yh);
points [1] = c + db::Vector (-xw + xh, -yw + yh);
points [2] = c + db::Vector (xw + xh, yw + yh);
points [3] = c + db::Vector (xw - xh, yw - yh);
db::Polygon p;
p.assign_hull (points, points + 4);

View File

@ -189,3 +189,8 @@ TEST(lasi)
run_test (_this, tl::testsrc (), "lasi.cif.gz", "lasi_au.gds.gz");
}
// Issue #305
TEST(rot_boxes)
{
run_test (_this, tl::testsrc (), "issue_305.cif", "issue_305_au.gds");
}

18
testdata/cif/issue_305.cif vendored Normal file
View File

@ -0,0 +1,18 @@
DS 1 10 1;
9 test;
L TEST;
(Origin marker)
B 1 1 0,0;
(Draw two offset boxes without rotation)
B 10 1 20,-10;
B 10 1 20,10;
(Try drawing the same boxes with rotation)
(They appear nearly centered on the origin in Klayout, the offset is wrong?)
B 10 1 20,-10 5,-2;
B 10 1 20,10 5,2;
DF;
E

BIN
testdata/cif/issue_305_au.gds vendored Normal file

Binary file not shown.