KLayout / klayout

KLayout Main Sources
http://www.klayout.org
GNU General Public License v3.0
808 stars 206 forks source link

`interacting` operation between EdgePairs and Region (or edges) #1816

Closed tvt173 closed 3 months ago

tvt173 commented 3 months ago

Hi @klayoutmatthias ,

Sometimes it is useful to filter edge pairs based on those which interact with a Region. I know I can convert the EdgePairs to a region or edges and then run interacting between those two objects. However, in some cases it would be nice to keep the result of the operation as EdgePairs, and I'm not sure if there is a straightforward way to do that today. The best I could think of would be to implement an EdgePairFilter that checks interacting between each of the edges in the pair and Region and returns True if either are True. Obviously this is an extra hoop, and I assume there would also be a performance hit vs. a native implementation in C code.

What do you think about implementing this operation? I think it would be useful, and it seems pretty straightforward.

Thanks, Troy

klayoutmatthias commented 3 months ago

Yes, I think that makes sense and it is possible. There is a certain effort, because EdgePairs are not primary objects, but that can be changed.

klayoutmatthias commented 3 months ago

The linked PR provides a first implementation.

Use is straightforward - the following DRC functions now also act on edge pair layers:

All features work in deep or flat mode.

For these operations, edge pairs are treated like polygons covering the area between the edges of the pair. Edge pairs are not treated as two edges. That makes some difference when considering interactions between edge pairs and polygons shooting between the edges.

tvt173 commented 3 months ago

this is great @klayoutmatthias ! thank you!