Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
1 to 5 of 5
Hello! First of all I'd like to say thanks for developing such nice tool! I'm writing python script and I've catched something strange on my way. Today I was confused one more time, so I decided to registrate here to ask my questions.
I've found that "inside" method works incorrect for the distances between point and polygon much lager than it may be according to lack of precision in notation of doubles.
[print(point) for point in dpoly.each_point()]
With the output:
But this point is obviously out of polygon. The polygon was read from layout and converted to DSimplePolygon via from_ipoly.
Also there is annoying behaviour when script consist of multiple files. When I modify one of the files that are imported in the main I have to relaunch IDE. I suppose this connected with reason mentioned here https://www.klayout.de/forum/comments.php?DiscussionID=905 so I'm asking for workaround.
I found that reimporting solved last problem:
thanks for the hint about the "reload" feature.
Regarding your "inside" issue: the "inside" detection is based on a certain fuzziness which is far bigger (actually in the order of 0.1) than the actual floating point resolution. In fact, the DSimplePolygon is not intended for these kind of computations. Instead, you should use the integer versions. The floating point objects are provided for representing polygons in physical units, but not for computational purposes.
If you want to use DSimplePolygon and the other "D" objects, you should scale then to units close to your resolution limit (for example nm or even better: DBU).
Actually you can convert a SimplePolygon into "canonical" polygons. Those are: decomposed into hulls and holes, not self-overlapping, normalized in terms of orientation and without redundant points. The canonical form is obtained through "merging". There are cases where the simple polygon can fall apart into pieces during this process. Hence there is no simple "SimplePolygon" to "Polygon" conversion. But it's fairly convenient using the Region#each_merged iterator:
sp = ... # simple polygon
RBA::Region::new(sp).each_merged do |p|
p = ... # a "canonical" polygon
Usually, the "each_merged" loop will produce only one polygon. But please be aware that multiple or even zero polygons may be produced. You can also put multiple simple polygons into the region. "each_merged" will then also remove overlaps between such polygons.