{
  "title": "PolySlab",
  "public_path": "flex_rf.tidy3d.PolySlab",
  "lookup_path": "tidy3d.PolySlab",
  "slug": "flex_rf/tidy3d/PolySlab",
  "public_url": "/rf/latest/autogenerated/flex_rf/tidy3d/polyslab/",
  "object_kind": "class",
  "introduction": "Polygon extruded with optional sidewall angle along axis direction.\n\nPolygon edges may optionally be circular arcs via the `bulges` parameter, which\nfollows the convention: `bulge = tan(θ/4)` where `θ` is the\nincluded angle of the arc. For CCW polygon, a positive bulge produces an arc that bulges outward\n; a negative bulge bulges inward; and zero means a straight edge.",
  "notes": "",
  "examples": "```python\nvertices = np.array([(0,0), (1,0), (1,1)])\np = PolySlab(vertices=vertices, axis=2, slab_bounds=(-1, 1))\n# With arc segments (a rounded edge from vertex 1 to vertex 2):\np_arc = PolySlab(\n    vertices=vertices, axis=2, slab_bounds=(-1, 1), bulges=[0, 0.5, 0]\n)\n```",
  "references": "",
  "signature": "class PolySlab(Planar)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/components/geometry/polyslab.py",
    "url": "",
    "lineno": 442,
    "endlineno": 3202
  },
  "bases": [
    "base.Planar"
  ],
  "parameter_rows": [
    {
      "name": "slab_bounds",
      "annotation": "tuple[TracedFloat, TracedFloat]",
      "default": "",
      "description": "Minimum and maximum positions of the slab along axis dimension.",
      "origin": "declared"
    },
    {
      "name": "dilation",
      "annotation": "float",
      "default": "0.0",
      "description": "Dilation of the supplied polygon by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.",
      "origin": "declared"
    },
    {
      "name": "vertices",
      "annotation": "TracedArrayFloat2D",
      "default": "",
      "description": "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)",
      "origin": "declared"
    },
    {
      "name": "bulges",
      "annotation": "ArrayFloat1D | None",
      "default": "None",
      "description": "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`.",
      "origin": "declared"
    },
    {
      "name": "attrs",
      "annotation": "dict",
      "default": "factory: dict",
      "description": "Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, `attrs` are mutable. For example, the following is allowed for setting an `attr` `obj.attrs['foo'] = bar`. Also note that Tidy3D will raise a `TypeError` if `attrs` contain objects that can not be serialized. One can check if `attrs` are serializable by calling `obj.model_dump_json()`.",
      "origin": "inherited"
    },
    {
      "name": "axis",
      "annotation": "Axis",
      "default": "2",
      "description": "Specifies dimension of the planar axis (0,1,2) -> (x,y,z).",
      "origin": "inherited"
    },
    {
      "name": "sidewall_angle",
      "annotation": "TracedFloat",
      "default": "0.0",
      "description": "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.",
      "origin": "inherited"
    },
    {
      "name": "reference_plane",
      "annotation": "PlanePosition",
      "default": "'middle'",
      "description": "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.",
      "origin": "inherited"
    }
  ],
  "members": [
    {
      "name": "array_to_vertices",
      "kind": "function",
      "signature": "array_to_vertices(arr_vertices: NDArray)",
      "description": "Converts a numpy array of vertices to a list of tuples."
    },
    {
      "name": "base_polygon",
      "kind": "function",
      "signature": "base_polygon()",
      "description": "The polygon at the base, derived from the `middle_polygon`."
    },
    {
      "name": "bounds",
      "kind": "function",
      "signature": "bounds()",
      "description": "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."
    },
    {
      "name": "center_axis",
      "kind": "attribute",
      "signature": "center_axis: float",
      "description": "Gets the position of the center of the geometry in the out of plane dimension."
    },
    {
      "name": "compute_derivative_slab_bounds_line",
      "kind": "function",
      "signature": "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)",
      "description": "Handle degenerate line cross-section case"
    },
    {
      "name": "compute_derivative_slab_bounds_surface",
      "kind": "function",
      "signature": "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)",
      "description": "2d surface integral on a Gauss quadrature grid"
    },
    {
      "name": "correct_shape",
      "kind": "function",
      "signature": "correct_shape(val: ArrayFloat2D)",
      "description": "Makes sure vertices size is correct. Make sure no intersecting edges."
    },
    {
      "name": "edge_basis_vectors",
      "kind": "function",
      "signature": "edge_basis_vectors(edges: NDArray)",
      "description": "Normalized basis vectors for `normal` direction, `slab` tangent direction and `edge`."
    },
    {
      "name": "finite_length_axis",
      "kind": "attribute",
      "signature": "finite_length_axis: float",
      "description": "Gets the length of the PolySlab along the out of plane dimension. First clips the slab bounds to LARGE_NUMBER and then returns difference."
    },
    {
      "name": "from_gds",
      "kind": "function",
      "signature": "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')",
      "description": "Import `PolySlab` from a `gdstk.Cell`."
    },
    {
      "name": "inside",
      "kind": "function",
      "signature": "inside(x: NDArray[float], y: NDArray[float], z: NDArray[float])",
      "description": "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."
    },
    {
      "name": "interior_angle",
      "kind": "function",
      "signature": "interior_angle()",
      "description": "Angle formed inside polygon by two adjacent edges."
    },
    {
      "name": "is_ccw",
      "kind": "function",
      "signature": "is_ccw()",
      "description": "Is this `PolySlab` CCW-oriented?"
    },
    {
      "name": "length_axis",
      "kind": "attribute",
      "signature": "length_axis: float",
      "description": "Gets the length of the geometry along the out of plane dimension."
    },
    {
      "name": "make_shapely_polygon",
      "kind": "function",
      "signature": "make_shapely_polygon(vertices: ArrayLike)",
      "description": "Make a shapely polygon from some vertices, first ensures they are untraced."
    },
    {
      "name": "middle_polygon",
      "kind": "function",
      "signature": "middle_polygon()",
      "description": "The polygon at the middle."
    },
    {
      "name": "no_complex_self_intersecting_polygon_at_reference_plane",
      "kind": "function",
      "signature": "no_complex_self_intersecting_polygon_at_reference_plane()",
      "description": "At the reference plane, check if the polygon is self-intersecting."
    },
    {
      "name": "no_self_intersecting_polygon_during_extrusion",
      "kind": "function",
      "signature": "no_self_intersecting_polygon_during_extrusion()",
      "description": "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."
    },
    {
      "name": "normalize_vect",
      "kind": "function",
      "signature": "normalize_vect(arr: NDArray)",
      "description": "normalize an array shaped (N, d) along the `d` axis and return (N, 1)."
    },
    {
      "name": "pop_axis_vect",
      "kind": "function",
      "signature": "pop_axis_vect(coord: NDArray)",
      "description": "Combine coordinate along axis with coordinates on the plane tangent to the axis."
    },
    {
      "name": "reference_polygon",
      "kind": "function",
      "signature": "reference_polygon()",
      "description": "The polygon at the reference plane."
    },
    {
      "name": "reflected",
      "kind": "function",
      "signature": "reflected(normal: Coordinate)",
      "description": "Return a reflected copy of this geometry."
    },
    {
      "name": "rotated",
      "kind": "function",
      "signature": "rotated(angle: float, axis: Axis | Coordinate)",
      "description": "Return a rotated copy of this geometry."
    },
    {
      "name": "scaled",
      "kind": "function",
      "signature": "scaled(x: float = 1.0, y: float = 1.0, z: float = 1.0)",
      "description": "Return a scaled copy of this geometry."
    },
    {
      "name": "slab_bounds_order",
      "kind": "function",
      "signature": "slab_bounds_order(val: tuple[float, float])",
      "description": "Maximum position of the slab should be no smaller than its minimal position."
    },
    {
      "name": "top_polygon",
      "kind": "function",
      "signature": "top_polygon()",
      "description": "The polygon at the top, derived from the `middle_polygon`."
    },
    {
      "name": "translated",
      "kind": "function",
      "signature": "translated(x: float, y: float, z: float)",
      "description": "Return a translated copy of this geometry."
    },
    {
      "name": "unpop_axis_vect",
      "kind": "function",
      "signature": "unpop_axis_vect(ax_coords: NDArray, plane_coords: NDArray)",
      "description": "Combine coordinate along axis with coordinates on the plane tangent to the axis."
    },
    {
      "name": "vertices_to_array",
      "kind": "function",
      "signature": "vertices_to_array(vertices_tuple: ArrayFloat2D)",
      "description": "Converts a list of tuples (vertices) to a numpy array."
    }
  ],
  "group": "flex_rf.tidy3d"
}
