mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-07 03:21:34 +02:00
Update on issue 1422 fix - fixing an array index out of bounds issue; do no use control points for first and last point as splines may not be designed to terminate at those.
This commit is contained in:
@@ -817,12 +817,12 @@ static db::DPoint
|
||||
b_spline_point (double x, const std::vector<std::pair<db::DPoint, double> > &control_points, int p, const std::vector<double> &t, int &k)
|
||||
{
|
||||
k = (int) (std::lower_bound (t.begin (), t.end (), x - 1e-6) - t.begin ());
|
||||
if (k < p) {
|
||||
return control_points.front ().first;
|
||||
} else if (k > (int) control_points.size ()) {
|
||||
return control_points.back ().first;
|
||||
}
|
||||
--k;
|
||||
if (k < p) {
|
||||
k = p;
|
||||
} else if (k >= (int) control_points.size ()) {
|
||||
k = (int) control_points.size () - 1;
|
||||
}
|
||||
|
||||
std::vector<db::DPoint> d;
|
||||
std::vector<double> dw;
|
||||
|
||||
@@ -517,10 +517,22 @@ TEST(34)
|
||||
}
|
||||
|
||||
// issue #1422
|
||||
TEST(35)
|
||||
TEST(35a)
|
||||
{
|
||||
db::DXFReaderOptions opt;
|
||||
run_test_public (_this, "issue_1422a.dxf", "issue_1422a_au.gds.gz", opt);
|
||||
}
|
||||
|
||||
// issue #1422
|
||||
TEST(35b)
|
||||
{
|
||||
db::DXFReaderOptions opt;
|
||||
run_test_public (_this, "issue_1422b.dxf", "issue_1422b_au.gds.gz", opt);
|
||||
}
|
||||
|
||||
// issue #1422
|
||||
TEST(35c)
|
||||
{
|
||||
db::DXFReaderOptions opt;
|
||||
run_test_public (_this, "issue_1422c.dxf", "issue_1422c_au.gds.gz", opt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user