mirror of https://github.com/KLayout/klayout.git
* Fixed isse #578 (CIF writer issue with arbitrary angle) * Added missing files.
This commit is contained in:
parent
2d0a9418f9
commit
8db1e3577f
|
|
@ -165,23 +165,18 @@ CIFWriter::write (db::Layout &layout, tl::OutputStream &stream, const db::SaveLa
|
|||
}
|
||||
|
||||
double a = t.angle();
|
||||
while (a < 0) {
|
||||
a += 360.0;
|
||||
}
|
||||
double ya = 0.0, xa = 0.0;
|
||||
if (a < 45 || a > 315) {
|
||||
xa = 1.0;
|
||||
ya = tan(a / 180.0 * M_PI);
|
||||
} else if (a < 135) {
|
||||
xa = 1.0 / tan(a / 180.0 * M_PI);
|
||||
ya = 1.0;
|
||||
} else if (a < 225) {
|
||||
xa = -1.0;
|
||||
ya = tan(a / 180.0 * M_PI);
|
||||
double xa = cos(a / 180.0 * M_PI);
|
||||
double ya = sin(a / 180.0 * M_PI);
|
||||
|
||||
// normalize xa or ya whichever is better
|
||||
double n;
|
||||
if (fabs (xa) >= M_SQRT1_2) {
|
||||
n = 1.0 / fabs (xa);
|
||||
} else {
|
||||
xa = 1.0 / tan(a / 180.0 * M_PI);
|
||||
ya = -1.0;
|
||||
}
|
||||
n = 1.0 / fabs (ya);
|
||||
}
|
||||
xa *= n;
|
||||
ya *= n;
|
||||
|
||||
// TODO: that can be done smarter ...
|
||||
for (int n = 0; n < 20 && (fabs (xa - floor (0.5 + xa)) > 1e-3 || fabs (ya - floor (0.5 + ya)) > 1e-3); ++n) {
|
||||
|
|
|
|||
|
|
@ -200,3 +200,9 @@ TEST(rot_instances)
|
|||
{
|
||||
run_test (_this, tl::testsrc (), "issue_568.cif", "issue_568_au.gds");
|
||||
}
|
||||
|
||||
// Issue #578
|
||||
TEST(rot_instances2)
|
||||
{
|
||||
run_test (_this, tl::testsrc (), "issue_578.cif", "issue_578_au.gds");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
(CIF file written 2020-06-04 16:17:46 by KLayout);
|
||||
DS 1 1 10;
|
||||
9 F;
|
||||
L L1D0;
|
||||
P 0,0 0,7000 4000,7000 4000,6000 1000,6000 1000,4000 2000,4000 2000,3000 1000,3000 1000,0;
|
||||
DF;
|
||||
DS 2 1 10;
|
||||
9 ALL;
|
||||
C1 R1,0 T0,0;
|
||||
C1 R1,1 T0,0;
|
||||
C1 R0,1 T0,0;
|
||||
C1 R-1,-1 T0,0;
|
||||
C1 R-1,0 T0,0;
|
||||
C1 R-1,1 T0,0;
|
||||
C1 R0,-1 T0,0;
|
||||
C1 R1,-1 T0,0;
|
||||
DF;
|
||||
E
|
||||
Binary file not shown.
Loading…
Reference in New Issue