It looks like you're new here. If you want to get involved, click one of these buttons!

I would much apritiate help on constructing a design based on an analytical function:

size= 2x2 mm. shape of layout (f):f(x,y)=0.5+0.5*sign(cos(a*x-b*atan2(y,x))), where a&b are consts.

Thank you for any help,

Shlomi.

## Comments

Hi Shlomi,

How can a such a function define a shape (polygon)? Do you mean "a polygon which includes all points where f(x,y) = 1"?

That will be tricky because KLayout is no equation solver.

But here is an approach:

atan2(y,x) will give you the angle the current point (x,y) forms with the x axis. For all points along a line with a given angle s this will be a constant.

So we can reformulate your function in polar coordinates:

This function will be 1 for

or

Since u is linear with r this will basically become a kind of periodic dark/clear pattern: a transition from clear to dark will happen at

The opposite transition will happen at

So each of these conditions renders a function r(s):

Since

This allows you to compute a x/y trajectory which defines the border between clear and dark and another one which defines the border between dark and clear. If we connect both trajectories properly we can make them form a closed polygon. Having this is the first step towards your solution. Here is some code that illustrates that approach:

Maybe that leads somewhat further. Next thing then will be to clip this down to your target rectangle with a boolean operation. But remember, KLayout is not MatLab, not even "MatLab light". And some of the solutions look kind of naughty, but maybe that's just my fantasy ...

BTW: you're not a student trying to fool me into solving your quiz problem, are you? Your teacher is going to hate me for this ...

Matthias