tidy3d.Box#
- class Box[source]#
- Bases: - Centered- Rectangular prism.
- Also base class for - Simulation,- Monitor, and- Source.
 - Parameters:
- center (Tuple[float, float, float] = (0.0, 0.0, 0.0)) – [units = um]. Center of object in x, y, and z. 
- size (Tuple[NonNegativeFloat, NonNegativeFloat, NonNegativeFloat]) – [units = um]. Size in x, y, and z directions. 
 
 - Example - >>> b = Box(center=(1,2,3), size=(2,2,2)) - Attributes - Returns bounding box min and max coordinates. - Boxrepresentation of self (used for subclasses of Box).- A list of axes along which the - Boxis zero-sized.- Methods - from_bounds(rmin, rmax, **kwargs)- Constructs a - Boxfrom minimum and maximum coordinate bounds- inside(x, y, z)- For input arrays - x,- y,- zof arbitrary but identical shape, return an array with the same shape which is- Truefor every point in zip(x, y, z) that is inside the volume of the- Geometry, and- Falseotherwise.- intersections_plane([x, y, z])- Returns shapely geometry at plane specified by one non None value of x,y,z. - intersections_tilted_plane(normal, origin, to_2D)- Return a list of shapely geometries at the plane specified by normal and origin. - intersections_with(other)- Returns list of shapely geometries representing the intersections of the geometry with this 2D box. - surfaces(size, center, **kwargs)- Returns a list of 6 - Boxinstances corresponding to each surface of a 3D volume.- surfaces_with_exclusion(size, center, **kwargs)- Returns a list of 6 - Boxinstances corresponding to each surface of a 3D volume.- size#
 - classmethod from_bounds(rmin, rmax, **kwargs)[source]#
- Constructs a - Boxfrom minimum and maximum coordinate bounds- Parameters:
- rmin (Tuple[float, float, float]) – (x, y, z) coordinate of the minimum values. 
- rmax (Tuple[float, float, float]) – (x, y, z) coordinate of the maximum values. 
 
 - Example - >>> b = Box.from_bounds(rmin=(-1, -2, -3), rmax=(3, 2, 1)) 
 - classmethod surfaces(size, center, **kwargs)[source]#
- Returns a list of 6 - Boxinstances corresponding to each surface of a 3D volume. The output surfaces are stored in the order [x-, x+, y-, y+, z-, z+], where x, y, and z denote which axis is perpendicular to that surface, while “-” and “+” denote the direction of the normal vector of that surface. If a name is provided, each output surface’s name will be that of the provided name appended with the above symbols. E.g., if the provided name is “box”, the x+ surfaces’s name will be “box_x+”.- Parameters:
- size (Tuple[float, float, float]) – Size of object in x, y, and z directions. 
- center (Tuple[float, float, float]) – Center of object in x, y, and z. 
 
 - Example - >>> b = Box.surfaces(size=(1, 2, 3), center=(3, 2, 1)) 
 - classmethod surfaces_with_exclusion(size, center, **kwargs)[source]#
- Returns a list of 6 - Boxinstances corresponding to each surface of a 3D volume. The output surfaces are stored in the order [x-, x+, y-, y+, z-, z+], where x, y, and z denote which axis is perpendicular to that surface, while “-” and “+” denote the direction of the normal vector of that surface. If a name is provided, each output surface’s name will be that of the provided name appended with the above symbols. E.g., if the provided name is “box”, the x+ surfaces’s name will be “box_x+”. If- kwargscontains an- exclude_surfacesparameter, the returned list of surfaces will not include the excluded surfaces. Otherwise, the behavior is identical to that of- surfaces().- Parameters:
- size (Tuple[float, float, float]) – Size of object in x, y, and z directions. 
- center (Tuple[float, float, float]) – Center of object in x, y, and z. 
 
 - Example - >>> b = Box.surfaces_with_exclusion( ... size=(1, 2, 3), center=(3, 2, 1), exclude_surfaces=["x-"] ... ) 
 - intersections_tilted_plane(normal, origin, to_2D)[source]#
- Return a list of shapely geometries at the plane specified by normal and origin. - Parameters:
- normal (Coordinate) – Vector defining the normal direction to the plane. 
- origin (Coordinate) – Vector defining the plane origin. 
- to_2D (MatrixReal4x4) – Transformation matrix to apply to resulting shapes. 
 
- Returns:
- List of 2D shapes that intersect plane. For more details refer to Shapely’s Documentation. 
- Return type:
- List[shapely.geometry.base.BaseGeometry] 
 
 - intersections_plane(x=None, y=None, z=None)[source]#
- Returns shapely geometry 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 Documentation. 
- Return type:
- List[shapely.geometry.base.BaseGeometry] 
 
 - inside(x, y, z)[source]#
- For input arrays - x,- y,- zof arbitrary but identical shape, return an array with the same shape which is- Truefor every point in zip(x, y, z) that is inside the volume of the- Geometry, and- Falseotherwise.- Parameters:
- x (np.ndarray[float]) – Array of point positions in x direction. 
- y (np.ndarray[float]) – Array of point positions in y direction. 
- z (np.ndarray[float]) – Array of point positions in z direction. 
 
- Returns:
- Truefor every point that is inside the geometry.
- Return type:
- np.ndarray[bool] 
 
 - intersections_with(other)[source]#
- Returns list of shapely geometries representing the intersections of the geometry with this 2D box. - Returns:
- List of 2D shapes that intersect this 2D box. For more details refer to Shapely’s Documentation. 
- Return type:
- List[shapely.geometry.base.BaseGeometry] 
 
 - property bounds#
- 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] 
 
 - __hash__()#
- Hash method.