Skip to content

flex_rf.tidy3d.PolySlab

Type: class Base(s): Planar

Polygon extruded with optional sidewall angle along axis direction.

Polygon edges may optionally be circular arcs via the bulges parameter, which follows the convention: bulge = tan(θ/4) where θ is the included angle of the arc. For CCW polygon, a positive bulge produces an arc that bulges outward ; a negative bulge bulges inward; and zero means a straight edge.

vertices = np.array([(0,0), (1,0), (1,1)])
p = PolySlab(vertices=vertices, axis=2, slab_bounds=(-1, 1))
# With arc segments (a rounded edge from vertex 1 to vertex 2):
p_arc = PolySlab(
vertices=vertices, axis=2, slab_bounds=(-1, 1), bulges=[0, 0.5, 0]
)
slab_bounds [tuple[TracedFloat, TracedFloat]]

Minimum and maximum positions of the slab along axis dimension.

vertices [TracedArrayFloat2D]

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)

axis [Axis] = 2

Specifies dimension of the planar axis (0,1,2) -> (x,y,z).

sidewall_angle [TracedFloat] = 0.0

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 [PlanePosition] = '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.

dilation [float] = 0.0

Dilation of the supplied polygon by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.

bulges [ArrayFloat1D | None] = 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.

center_axis [float]

Gets the position of the center of the geometry in the out of plane dimension.

finite_length_axis [float]

Gets the length of the PolySlab along the out of plane dimension. First clips the slab bounds to LARGE_NUMBER and then returns difference.

length_axis [float]

Gets the length of the geometry along the out of plane dimension.

array_to_vertices(arr_vertices: NDArray)

Converts a numpy array of vertices to a list of tuples.

base_polygon()

The polygon at the base, derived from the middle_polygon.

bounds()

Returns bounding box min and max coordinates. The dilation and slant angle are not taken into account exactly for speed. Instead, the polygon may be slightly smaller than the returned bounds, but it should always be fully contained.

compute_derivative_slab_bounds_line(derivative_info: DerivativeInfo, extents: NDArray, r1_min: float, r1_max: float, r2_min: float, r2_max: float, ax_val: float, face_poly: shapely.Polygon, min_max_index: int, interpolators: dict)

Handle degenerate line cross-section case

compute_derivative_slab_bounds_surface(derivative_info: DerivativeInfo, extents: NDArray, r1_min: float, r1_max: float, r2_min: float, r2_max: float, ax_val: float, face_poly: shapely.Polygon, min_max_index: int, interpolators: dict)

2d surface integral on a Gauss quadrature grid

correct_shape(val: ArrayFloat2D)

Makes sure vertices size is correct. Make sure no intersecting edges.

edge_basis_vectors(edges: NDArray)

Normalized basis vectors for normal direction, slab tangent direction and edge.

from_gds(gds_cell: Cell, axis: Axis, slab_bounds: tuple[float, float], gds_layer: int, gds_dtype: int | None = None, gds_scale: PositiveFloat = 1.0, dilation: float = 0.0, sidewall_angle: float = 0, reference_plane: PlanePosition = 'middle')

Import PolySlab from a gdstk.Cell.

inside(x: NDArray[float], y: NDArray[float], z: NDArray[float])

For input arrays x, y, z of arbitrary but identical shape, return an array with the same shape which is True for every point in zip(x, y, z) that is inside the volume of the Geometry, and False otherwise.

interior_angle()

Angle formed inside polygon by two adjacent edges.

is_ccw()

Is this PolySlab CCW-oriented?

make_shapely_polygon(vertices: ArrayLike)

Make a shapely polygon from some vertices, first ensures they are untraced.

middle_polygon()

The polygon at the middle.

no_complex_self_intersecting_polygon_at_reference_plane()

At the reference plane, check if the polygon is self-intersecting.

no_self_intersecting_polygon_during_extrusion()

In this simple polyslab, we don’t support self-intersecting polygons yet, meaning that any normal cross section of the PolySlab cannot be self-intersecting. This part checks if any self-interction will occur during extrusion with non-zero sidewall angle.

normalize_vect(arr: NDArray)

normalize an array shaped (N, d) along the d axis and return (N, 1).

pop_axis_vect(coord: NDArray)

Combine coordinate along axis with coordinates on the plane tangent to the axis.

reference_polygon()

The polygon at the reference plane.

reflected(normal: Coordinate)

Return a reflected copy of this geometry.

rotated(angle: float, axis: Axis | Coordinate)

Return a rotated copy of this geometry.

scaled(x: float = 1.0, y: float = 1.0, z: float = 1.0)

Return a scaled copy of this geometry.

slab_bounds_order(val: tuple[float, float])

Maximum position of the slab should be no smaller than its minimal position.

top_polygon()

The polygon at the top, derived from the middle_polygon.

translated(x: float, y: float, z: float)

Return a translated copy of this geometry.

unpop_axis_vect(ax_coords: NDArray, plane_coords: NDArray)

Combine coordinate along axis with coordinates on the plane tangent to the axis.

vertices_to_array(vertices_tuple: ArrayFloat2D)

Converts a list of tuples (vertices) to a numpy array.