tidy3d.PolySlab#

class tidy3d.PolySlab#

Polygon extruded with optional sidewall angle along axis direction.

Parameters
  • center (Tuple[float, float, float] = (0.0, 0.0, 0.0)) – [units = um]. Center of object in x, y, and z.

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

  • length (Optional[NonNegativeFloat] = None) – [units = um]. Defines thickness of geometry along axis dimension.

  • slab_bounds (Tuple[float, float] = None) – [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[List[Tuple[float, float]], tidynumpy] = None) – [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----------\ncenter : Tuple[float, float, float] = (0.0, 0.0, 0.0)\n    [units = um].  Center of object in x, y, and z.\naxis : Literal[0, 1, 2] = 2\n    Specifies dimension of the planar axis (0,1,2) -> (x,y,z).\nlength : Optional[NonNegativeFloat] = None\n    [units = um].  Defines thickness of geometry along axis dimension.\nslab_bounds : Tuple[float, float] = None\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[List[Tuple[float, float]], tidynumpy] = None\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": {
      "center": {
         "title": "Center",
         "description": "Center of object in x, y, and z.",
         "default": [
            0.0,
            0.0,
            0.0
         ],
         "units": "um",
         "type": "array",
         "minItems": 3,
         "maxItems": 3,
         "items": [
            {
               "type": "number"
            },
            {
               "type": "number"
            },
            {
               "type": "number"
            }
         ]
      },
      "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"
      },
      "length": {
         "title": "Length",
         "description": "Defines thickness of geometry along axis dimension.",
         "units": "um",
         "minimum": 0,
         "type": "number"
      },
      "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": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            }
         ]
      }
   },
   "required": [
      "slab_bounds",
      "vertices"
   ],
   "additionalProperties": false
}

Fields
  • dilation (float)

  • sidewall_angle (float)

  • slab_bounds (Tuple[float, float])

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

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.

Validated by
  • set_length

attribute vertices: Union[List[Tuple[float, float]], tidy3d.components.types.tidynumpy] [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
  • no_self_intersecting_polygon

  • correct_shape

  • set_center

static array_to_vertices(arr_vertices: numpy.ndarray) List[Tuple[float, float]]#

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: List[Tuple[float, float]]) numpy.ndarray#

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

property base_polygon: tidy3d.components.types.tidynumpy#

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

tidynumpy

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 top_polygon: tidy3d.components.types.tidynumpy#

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

Returns

The vertices of the polygon at the top.

Return type

tidynumpy