tidy3d.PolySlab#

class tidy3d.PolySlab#

Polygon extruded with optional sidewall angle along axis direction.

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

  • sidewall_angle (ConstrainedFloatValue = 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'] = bottom) – 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[float, float]) – [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[Tuple[Tuple[float, float], ...], Array]) – [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)

Example

>>> vertices = np.array([(0,0), (1,0), (1,1)])
>>> p = PolySlab(vertices=vertices, axis=2, slab_bounds=(-1, 1))

Show JSON schema
{
   "title": "PolySlab",
   "description": "Polygon extruded with optional sidewall angle along axis direction.\n\nParameters\n----------\naxis : Literal[0, 1, 2] = 2\n    Specifies dimension of the planar axis (0,1,2) -> (x,y,z).\nsidewall_angle : ConstrainedFloatValue = 0.0\n    [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.\nreference_plane : Literal['bottom', 'middle', 'top'] = bottom\n    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.\nslab_bounds : Tuple[float, float]\n    [units = um].  Minimum and maximum positions of the slab along axis dimension.\ndilation : float = 0.0\n    [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.\nvertices : Union[Tuple[Tuple[float, float], ...], Array]\n    [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)\n\nExample\n-------\n>>> vertices = np.array([(0,0), (1,0), (1,1)])\n>>> p = PolySlab(vertices=vertices, axis=2, slab_bounds=(-1, 1))",
   "type": "object",
   "properties": {
      "type": {
         "title": "Type",
         "default": "PolySlab",
         "enum": [
            "PolySlab"
         ],
         "type": "string"
      },
      "axis": {
         "title": "Axis",
         "description": "Specifies dimension of the planar axis (0,1,2) -> (x,y,z).",
         "default": 2,
         "enum": [
            0,
            1,
            2
         ],
         "type": "integer"
      },
      "sidewall_angle": {
         "title": "Sidewall angle",
         "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.",
         "default": 0.0,
         "exclusiveMinimum": -1.5707963267948966,
         "exclusiveMaximum": 1.5707963267948966,
         "units": "rad",
         "type": "number"
      },
      "reference_plane": {
         "title": "Reference plane for cross section",
         "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.",
         "default": "bottom",
         "enum": [
            "bottom",
            "middle",
            "top"
         ],
         "type": "string"
      },
      "slab_bounds": {
         "title": "Slab Bounds",
         "description": "Minimum and maximum positions of the slab along axis dimension.",
         "units": "um",
         "type": "array",
         "minItems": 2,
         "maxItems": 2,
         "items": [
            {
               "type": "number"
            },
            {
               "type": "number"
            }
         ]
      },
      "dilation": {
         "title": "Dilation",
         "description": "Dilation of the supplied polygon by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.",
         "default": 0.0,
         "units": "um",
         "type": "number"
      },
      "vertices": {
         "title": "Vertices",
         "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)",
         "units": "um",
         "anyOf": [
            {
               "type": "array",
               "items": {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 2,
                  "items": [
                     {
                        "type": "number"
                     },
                     {
                        "type": "number"
                     }
                  ]
               }
            },
            {
               "title": "Array Like",
               "description": "Accepts sequence (tuple, list, numpy array) and converts to tuple.",
               "type": "tuple",
               "properties": {},
               "required": []
            }
         ]
      }
   },
   "required": [
      "slab_bounds",
      "vertices"
   ],
   "additionalProperties": false
}

attribute 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.

attribute slab_bounds: Tuple[float, float] [Required]#

Minimum and maximum positions of the slab along axis dimension.

attribute vertices: Union[Tuple[Tuple[float, float], ...], tidy3d.components.types.Array] [Required]#

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)

Validated by
  • correct_shape

  • no_self_intersecting_polygon_at_reference_plane

  • no_self_intersecting_polygon_during_extrusion

static array_to_vertices(arr_vertices: numpy.ndarray) Union[Tuple[Tuple[float, float], ...], tidy3d.components.types.Array]#

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

classmethod from_gds(gds_cell, axis: Literal[0, 1, 2], slab_bounds: Tuple[float, float], gds_layer: int, gds_dtype: Optional[int] = None, gds_scale: pydantic.types.PositiveFloat = 1.0, dilation: float = 0.0, sidewall_angle: float = 0, reference_plane: Literal['bottom', 'middle', 'top'] = 'bottom', **kwargs) List[tidy3d.components.geometry.PolySlab]#

Import PolySlab from a gdspy.Cell.

Parameters
  • gds_cell (gdspy.Cell) – gdspy.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 = "bottom") – 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]

inside(x, y, z) bool#

Returns True if point (x,y,z) inside volume of geometry. For slanted polyslab and x/y/z to be np.ndarray, a loop over z-axis is performed to find out the offsetted polygon at each z-coordinate.

Parameters
  • x (float) – Position of point in x direction.

  • y (float) – Position of point in y direction.

  • z (float) – Position of point in z direction.

Returns

Whether point (x,y,z) is inside geometry.

Return type

bool

static vertices_to_array(vertices_tuple: Union[Tuple[Tuple[float, float], ...], tidy3d.components.types.Array]) numpy.ndarray#

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

property base_polygon: Union[Tuple[Tuple[float, float], ...], tidy3d.components.types.Array]#

The polygon at the base after potential dilation operation. The vertices will always be transformed to be “proper”.

Returns

The vertices of the polygon at the base.

Return type

ArrayLike[float, float]

property bounds: Tuple[Tuple[float, float, float], Tuple[float, float, float]]#

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.

Returns

Min and max bounds packaged as (minx, miny, minz), (maxx, maxy, maxz).

Return type

Tuple[float, float, float], Tuple[float, float float]

property center_axis: float#

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

property length_axis: float#

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

property top_polygon: Union[Tuple[Tuple[float, float], ...], tidy3d.components.types.Array]#

The polygon at the top after potential dilation and sidewall operation.

Returns

The vertices of the polygon at the top.

Return type

ArrayLike[float, float]