Aypac / GDSLatexConverter

Conversion of gdsII files / gdspy libraries to latex (and subsequent svg and pdf)
5 stars 3 forks source link

Implement detection of circles #9

Open Aypac opened 6 years ago

Aypac commented 6 years ago

Find a way to detect simple circles and replace those polygons with the according TikZ command.

If the gds is created directly by gdspy commands one can detect the use of the Round class and use the original creation parameters ( see https://github.com/heitzmann/gdspy/pull/51 ).

from the gdspy docs:

Examples
--------
>>> circle = gdspy.Round((30, 5), 8)
>>> ring = gdspy.Round((50, 5), 8, inner_radius=5)
>>> pie_slice = gdspy.Round((30, 25), 8, initial_angle=0,
...                             final_angle=-5.0*numpy.pi/6.0)
>>> arc = gdspy.Round((50, 25), 8, inner_radius=5,
...                       initial_angle=-5.0*numpy.pi/6.0,
...                       final_angle=0)

(From discussions with Marc)

If loaded from a file, one can test each polygon if it is a circle, arc, pie slice, ring or ring slice:

For each polygon in a polygon set (with 2 or less polygons):
  go over each polygon and calculate the distance between neighbouring points
  If they are all equal (enough):
    it is a circle
  elif they are all equal (enough), except for one:
    it is an arc

Some more thoughts:

Aypac commented 4 years ago

The discussion at heitzmann/gdspy#51 has resulted in a negative reply (I agree that it does not make sense to implement it there). The reason for this is ofc to reduce the number of polygons and therefore filesize greatly.