tidy3d.plugins.polyslab.ComplexPolySlab

tidy3d.plugins.polyslab.ComplexPolySlab#

class ComplexPolySlab[source]#

Bases: ComplexPolySlabBase

Interface for dividing a complex polyslab where self-intersecting polygon can occur during extrusion.

Parameters:
  • axis (Literal[0, 1, 2] = 2) – Specifies dimension of the planar axis (0,1,2) -> (x,y,z).

  • sidewall_angle (Union[float, autograd.tracer.Box] = 0.0) – [units = rad]. Angle of the sidewall. sidewall_angle=0 (default) specifies a vertical wall; 0<sidewall_angle<np.pi/2 specifies a shrinking cross section along the axis direction; and -np.pi/2<sidewall_angle<0 specifies an expanding cross section along the axis direction.

  • reference_plane (Literal['bottom', 'middle', 'top'] = middle) – The position of the plane where the supplied cross section are defined. The plane is perpendicular to the axis. The plane is located at the bottom, middle, or top of the geometry with respect to the axis. E.g. if axis=1, bottom refers to the negative side of the y-axis, and top refers to the positive side of the y-axis.

  • slab_bounds (tuple[Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box]]) – [units = um]. Minimum and maximum positions of the slab along axis dimension.

  • dilation (float = 0.0) – [units = um]. Dilation of the supplied polygon by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.

  • vertices (Union[ArrayLike[dtype=float, ndim=2], autograd.tracer.Box]) – [units = um]. List of (d1, d2) defining the 2 dimensional positions of the polygon face vertices at the reference_plane. The index of dimension should be in the ascending order: e.g. if the slab normal axis is axis=y, the coordinate of the vertices will be in (x, z)

  • bulges (Optional[ArrayLike[dtype=float, ndim=1]] = None) – List of values describing the bulge of each edge, following the typical convention: bulge = tan(θ/4) where θ is the included angle of the arc. When bulges=None, all segments are straight lines; otherwise, the number of bulge values must equal the number of vertices. bulges[i] defines the arc on the edge from vertex i to vertex (i+1) mod N. Sign convention: bulge=0 means straight line; bulge>0 bulges outward (for CCW polygons); bulge<0 bulges inward. All values must be finite. Canonicalization: bulges are kept synchronized with vertices during internal canonicalization. When winding order is reversed to CCW (i.e., when the input polygon is CW), bulges are permuted to match the reversed edges and their signs are flipped. When duplicate adjacent vertices are removed, the corresponding zero-bulge entry is dropped; a zero-length edge with non-zero bulge raises SetupError.

Example

>>> import tidy3d as td
>>> from tidy3d.plugins.polyslab import ComplexPolySlab
>>> vertices = ((0, 0), (1, 0), (1, 1), (0, 1), (0, 0.9), (0, 0.11))
>>> p = ComplexPolySlab(vertices=vertices, axis=2, slab_bounds=(0, 1), sidewall_angle=0.785)
>>> # To obtain the divided polyslabs, there are two approaches:
>>> # 1) a list of divided polyslabs
>>> geo_list = p.sub_polyslabs
>>> # 2) geometry group containing the divided polyslabs
>>> geo_group = p.geometry_group
>>> # Or directly obtain the structure with a user-specified medium
>>> mat = td.Medium(permittivity=2)
>>> structure = p.to_structure(mat)
...

Note

This version is limited to neighboring vertex-vertex crossing type of self-intersecting events. Extension to cover all types of self-intersecting events is expected in the future.

The algorithm is as follows (for the convenience of illustration, let’s consider the reference plane to lie at the bottom of the polyslab),

1. Starting from the reference plane, find out the critical extrusion distance for the first vertices degeneracy event when marching towards the top of the polyslab;

2. Construct a sub-polyslab whose base is the polygon at the reference plane and height to be the critical extrusion distance;

3. At the critical extrusion distance, constructing a new polygon that keeps only one of the degenerate vertices;

4. Set the reference plane to the position of the new polygon, and repeating 1-3 to construct sub-polyslabs until reaching the top of the polyslab, or all vertices collapsed into a 1D curve or a 0D point.

Attributes

slab_bounds

dilation

vertices

bulges

axis

sidewall_angle

reference_plane

Methods

to_structure(medium)

Construct a structure containing a user-specified medium and a GeometryGroup made of all the divided PolySlabs from this object.

to_structure(medium)[source]#

Construct a structure containing a user-specified medium and a GeometryGroup made of all the divided PolySlabs from this object.

Parameters:

medium (MediumType) – Medium for the complex polyslab.

Returns:

The structure containing all divided polyslabs made of a user-specified medium.

Return type:

Structure