tidy3d.GeometryGroup#

class tidy3d.GeometryGroup#

A collection of Geometry objects that can be called as a single geometry object.

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

  • geometries (List[Union[Box, Sphere, Cylinder, PolySlab]] = []) – List of geometries in a single grouping. Can provide significant performance enhancement in Structure when all geometries are assigned the same medium.

Show JSON schema
{
   "title": "GeometryGroup",
   "description": "A collection of Geometry objects that can be called as a single geometry object.\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.\ngeometries : List[Union[Box, Sphere, Cylinder, PolySlab]] = []\n    List of geometries in a single grouping. Can provide significant performance enhancement in ``Structure`` when all geometries are assigned the same medium.",
   "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": "GeometryGroup",
         "enum": [
            "GeometryGroup"
         ],
         "type": "string"
      },
      "geometries": {
         "title": "Geometries",
         "description": "List of geometries in a single grouping. Can provide significant performance enhancement in ``Structure`` when all geometries are assigned the same medium.",
         "default": [],
         "minItems": 1,
         "type": "array",
         "items": {
            "anyOf": [
               {
                  "$ref": "#/definitions/Box"
               },
               {
                  "$ref": "#/definitions/Sphere"
               },
               {
                  "$ref": "#/definitions/Cylinder"
               },
               {
                  "$ref": "#/definitions/PolySlab"
               }
            ]
         }
      }
   },
   "additionalProperties": false,
   "definitions": {
      "Box": {
         "title": "Box",
         "description": "Rectangular prism.\n   Also base class for :class:`Simulation`, :class:`Monitor`, and :class:`Source`.\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.\nsize : Tuple[NonNegativeFloat, NonNegativeFloat, NonNegativeFloat] = None\n    [units = um].  Size in x, y, and z directions.\n\nExample\n-------\n>>> b = Box(center=(1,2,3), size=(2,2,2))",
         "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": "Box",
               "enum": [
                  "Box"
               ],
               "type": "string"
            },
            "size": {
               "title": "Size",
               "description": "Size in x, y, and z directions.",
               "units": "um",
               "type": "array",
               "minItems": 3,
               "maxItems": 3,
               "items": [
                  {
                     "type": "number",
                     "minimum": 0
                  },
                  {
                     "type": "number",
                     "minimum": 0
                  },
                  {
                     "type": "number",
                     "minimum": 0
                  }
               ]
            }
         },
         "required": [
            "size"
         ],
         "additionalProperties": false
      },
      "Sphere": {
         "title": "Sphere",
         "description": "Spherical geometry.\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.\nradius : NonNegativeFloat = None\n    [units = um].  Radius of geometry.\n\nExample\n-------\n>>> b = Sphere(center=(1,2,3), radius=2)",
         "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": "Sphere",
               "enum": [
                  "Sphere"
               ],
               "type": "string"
            },
            "radius": {
               "title": "Radius",
               "description": "Radius of geometry.",
               "units": "um",
               "minimum": 0,
               "type": "number"
            }
         },
         "required": [
            "radius"
         ],
         "additionalProperties": false
      },
      "Cylinder": {
         "title": "Cylinder",
         "description": "Cylindrical geometry.\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 : NonNegativeFloat = None\n    [units = um].  Defines thickness of cylinder along axis dimension.\nradius : NonNegativeFloat = None\n    [units = um].  Radius of geometry.\n\nExample\n-------\n>>> c = Cylinder(center=(1,2,3), radius=2, length=5, axis=2)",
         "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": "Cylinder",
               "enum": [
                  "Cylinder"
               ],
               "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 cylinder along axis dimension.",
               "units": "um",
               "minimum": 0,
               "type": "number"
            },
            "radius": {
               "title": "Radius",
               "description": "Radius of geometry.",
               "units": "um",
               "minimum": 0,
               "type": "number"
            }
         },
         "required": [
            "length",
            "radius"
         ],
         "additionalProperties": false
      },
      "PolySlab": {
         "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
  • geometries (List[Union[tidy3d.components.geometry.Box, tidy3d.components.geometry.Sphere, tidy3d.components.geometry.Cylinder, tidy3d.components.geometry.PolySlab]])

attribute geometries: List[Union[tidy3d.components.geometry.Box, tidy3d.components.geometry.Sphere, tidy3d.components.geometry.Cylinder, tidy3d.components.geometry.PolySlab]] = []#

List of geometries in a single grouping. Can provide significant performance enhancement in Structure when all geometries are assigned the same medium.

Constraints
  • minItems = 1

inside(x, y, z) bool#

Returns True if point (x,y,z) is inside volume of GeometryGroup.

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

True if point (x,y,z) is inside geometry.

Return type

bool

intersections(x: Optional[float] = None, y: Optional[float] = None, z: Optional[float] = None) List[shapely.geometry.base.BaseGeometry]#

Returns list of shapely geoemtries at plane specified by one non-None value of x,y,z.

Parameters
  • x (float = None) – Position of plane in x direction, only one of x,y,z can be specified to define plane.

  • y (float = None) – Position of plane in y direction, only one of x,y,z can be specified to define plane.

  • z (float = None) – Position of plane in z direction, only one of x,y,z can be specified to define plane.

Returns

List of 2D shapes that intersect plane. For more details refer to Shapely’s Documentaton.

Return type

List[shapely.geometry.base.BaseGeometry]

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

Returns bounding box min and max coordinates.

Returns

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

Return type

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