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

  • 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 polygon in the base by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.

  • sidewall_angle (ConstrainedFloatValue = 0.0) – [units = rad]. 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.

  • vertices (Union[Tuple[Tuple[float, float], ...], Array]) – [units = um]. List of (d1, d2) defining the 2 dimensional positions of the base polygon face vertices along dimensions parallel to slab normal axis.

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).\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 polygon in the base by shifting each edge along its normal outwards direction by a distance; a negative value corresponds to erosion.\nsidewall_angle : ConstrainedFloatValue = 0.0\n    [units = rad].  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.\nvertices : Union[Tuple[Tuple[float, float], ...], Array]\n    [units = um].  List of (d1, d2) defining the 2 dimensional positions of the base polygon face vertices along dimensions parallel to slab normal axis.\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"
      },
      "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 polygon in the base 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"
      },
      "sidewall_angle": {
         "title": "Sidewall angle",
         "description": "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.",
         "default": 0.0,
         "exclusiveMaximum": 1.5707963267948966,
         "minimum": 0.0,
         "units": "rad",
         "type": "number"
      },
      "vertices": {
         "title": "Vertices",
         "description": "List of (d1, d2) defining the 2 dimensional positions of the base polygon face vertices along dimensions parallel to slab normal axis.",
         "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
}

Fields
  • dilation (float)

  • sidewall_angle (float)

  • slab_bounds (Tuple[float, float])

  • vertices (Union[Tuple[Tuple[float, float], ...], tidy3d.components.types.Array])

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

attribute sidewall_angle: float = 0.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.

Constraints
  • exclusiveMaximum = 1.5707963267948966

  • minimum = 0.0

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 base polygon face vertices along dimensions parallel to slab normal axis.

Validated by
  • correct_shape

  • no_self_intersecting_polygon

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, **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.

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]