Merge pull request #802 from KLayout/issue-801

Implemented #801: update, added test case
This commit is contained in:
Matthias Köfferlein 2021-05-21 00:52:22 +02:00 committed by GitHub
commit 72c225839d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -842,18 +842,23 @@ CODE
# @name smoothed
# @brief Smoothes the polygons of the region
# @synopsis layer.smoothed(d)
# @synopsis layer.smoothed(d, hv_keep)
#
# "Smoothing" returns a simplified version of the polygons. Simplification is
# achieved by removing vertices unless the resulting polygon deviates by more
# than the given distance d from the original polygon.
#
# "hv_keep" is a boolean parameter which makes the smoothing function maintain
# horizontal or vertical edges. The default is false, meaning horizontal or
# vertical edges may be changed into tilted ones.
#
# This method return a layer wit the modified polygons. Merged semantics applies for this
# method (see \raw and \clean).
def smoothed(d)
def smoothed(d, hv_keep = false)
@engine._context("smoothed") do
requires_region
DRCLayer::new(@engine, @engine._tcmd(self.data, 0, RBA::Region, :smoothed, @engine._make_value(d)))
DRCLayer::new(@engine, @engine._tcmd(self.data, 0, RBA::Region, :smoothed, @engine._make_value(d), hv_keep))
end
end

View File

@ -12,6 +12,7 @@ c1.output(3, 0)
c1.rounded_corners(0.5, 0.5, 16).output(1010, 0)
c1.smoothed(1.5).output(1011, 0)
c1.smoothed(1.5, true).output(1012, 0)
a1.texts.output(1020, 0)
a1.texts("A*").output(1021, 0)

Binary file not shown.