tidy3d.components.geometry.polyslab.ComplexPolySlabBase#

class ComplexPolySlabBase[source]#

Bases: PolySlab

Interface for dividing a complex polyslab where self-intersecting polygon can occur during extrusion. This class should not be used directly. Use instead plugins.polyslab.ComplexPolySlab.

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.

Attributes

geometry_group

Divide a complex polyslab into a list of simple polyslabs, which are assembled into a GeometryGroup.

sub_polyslabs

Divide a complex polyslab into a list of simple polyslabs.

slab_bounds

dilation

vertices

bulges

axis

sidewall_angle

reference_plane

Methods

from_gds(gds_cell, axis, slab_bounds, gds_layer)

Import PolySlab from a gdstk.Cell.

intersections_tilted_plane(normal, origin, to_2D)

Return a list of shapely geometries at the plane specified by normal and origin.

no_self_intersecting_polygon_during_extrusion()

Turn off the validation for this class.

no_self_intersecting_polygon_during_extrusion()[source]#

Turn off the validation for this class.

classmethod from_gds(gds_cell, axis, slab_bounds, gds_layer, gds_dtype=None, gds_scale=1.0, dilation=0.0, sidewall_angle=0, reference_plane='middle')[source]#

Import PolySlab from a gdstk.Cell.

Parameters:
  • gds_cell (gdstk.Cell) – gdstk.Cell containing 2D geometric data.

  • axis (int) – Integer index into the polygon’s slab axis. (0,1,2) -> (x,y,z).

  • slab_bounds (tuple[float, float]) – Minimum and maximum positions of the slab along axis.

  • gds_layer (int) – Layer index in the gds_cell.

  • gds_dtype (int = None) – Data-type index in the gds_cell. If None, imports all data for this layer into the returned list.

  • gds_scale (float = 1.0) – Length scale used in GDS file in units of MICROMETER. For example, if gds file uses nanometers, set gds_scale=1e-3. Must be positive.

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

  • sidewall_angle (float = 0) – Angle of the sidewall. sidewall_angle=0 (default) specifies vertical wall, while 0<sidewall_angle<np.pi/2 for the base to be larger than the top.

  • reference_plane (PlanePosition = "middle") – The position of the GDS layer. It can be at the bottom, middle, or top of the PolySlab. E.g. if axis=1, bottom refers to the negative side of y-axis, and top refers to the positive side of y-axis.

Returns:

List of PolySlab objects sharing axis and slab bound properties.

Return type:

list[PolySlab]

property geometry_group#

Divide a complex polyslab into a list of simple polyslabs, which are assembled into a GeometryGroup.

Returns:

GeometryGroup for a list of simple polyslabs divided from the complex polyslab.

Return type:

GeometryGroup

property sub_polyslabs#

Divide a complex polyslab into a list of simple polyslabs. Only neighboring vertex-vertex crossing events are treated in this version.

Returns:

A list of simple polyslabs.

Return type:

list[PolySlab]

intersections_tilted_plane(normal, origin, to_2D, cleanup=True, quad_segs=None)[source]#

Return a list of shapely geometries at the plane specified by normal and origin.

Parameters:
  • normal (Coordinate) – Vector defining the normal direction to the plane.

  • origin (Coordinate) – Vector defining the plane origin.

  • to_2D (MatrixReal4x4) – Transformation matrix to apply to resulting shapes.

  • cleanup (bool = True) – If True, removes extremely small features from each polygon’s boundary.

  • quad_segs (Optional[int] = None) – Number of segments used to discretize circular shapes. Not used for PolySlab.

Returns:

List of 2D shapes that intersect plane. For more details refer to Shapely’s Documentation.

Return type:

list[shapely.geometry.base.BaseGeometry]