import numpy as np
from gdshelpers.geometry.chip import Cell
from gdshelpers.parts.port import Port
from gdshelpers.parts.waveguide import Waveguide

int_line = Waveguide.make_at_port(Port(origin=(10, 10), angle=-np.pi / 4, width=0.2))
int_line.add_straight_segment(length=30)

wg_1 = Waveguide.make_at_port(Port(origin=(0, 0), angle=np.pi / 8, width=0.2))
wg_1.add_straight_segment_to_intersection(line_origin=(10, 10), line_angle=-np.pi / 4)

wg_2 = Waveguide.make_at_port(Port(origin=(1, -5), angle=0, width=0.2))
wg_2.add_straight_segment_to_intersection(line_origin=(10, 10), line_angle=-np.pi / 4)

wg_3 = Waveguide.make_at_port(Port(origin=(20, 10), angle=-np.pi / 2, width=0.2))
wg_3.add_straight_segment_to_intersection(line_origin=(10, 10), line_angle=-np.pi / 4)

cell = Cell('CELL')
cell.add_to_layer(1, int_line)  # red
cell.add_to_layer(2, wg_1)  # green
cell.add_to_layer(2, wg_2)  # green
cell.add_to_layer(2, wg_3)  # green
cell.show()