在ipkiss中,通过Polygon可以直接获取任意shape的面积:
from si_fab import all as pdk
import ipkiss3.all as i3
from shapely.geometry import Polygon
class Shape(i3.PCell):
class Layout(i3.LayoutView):
def _generate_elements(self, elems):
elems += i3.Boundary(
layer=i3.TECH.PPLAYER.SI,
shape=[(0, 0), (7.7, -23.7),
(32.6, -23.7), (12.4, -38.4),
(20.1, -62.1), (0, -47.4),
(-20.1, -62.1), (-12.4, -38.4),
(-32.6, -23.7), (-7.7, -23.7)])
return elems
if __name__ == '__main__':
Shape().Layout().visualize()
shape = Shape().Layout().elements[0].shape
area = Polygon(shape).area
print("The area is: {}".format(area))
通过Polygon:
area = Polygon(shape).area
就可以直接获取面积。