tidy3d.GeometryGroup#
- class GeometryGroup[source]#
Bases:
Geometry
A collection of Geometry objects that can be called as a single geometry object.
- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrs
are mutable. For example, the following is allowed for setting anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.geometries (ForwardRef('Tuple[annotate_type(GeometryType), ...]')) – Tuple of geometries in a single grouping. Can provide significant performance enhancement in
Structure
when all geometries are assigned the same medium.
Attributes
Methods
compute_derivatives
(derivative_info)Compute the adjoint derivatives for this object.
inside
(x, y, z)For input arrays
x
,y
,z
of arbitrary but identical shape, return an array with the same shape which isTrue
for every point in zip(x, y, z) that is inside the volume of theGeometry
, andFalse
otherwise.inside_meshgrid
(x, y, z)Faster way to check
self.inside
on a meshgrid.intersections_plane
([x, y, z])Returns list of shapely geometries 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.
intersects_axis_position
(axis, position)Whether self intersects plane specified by a given position along a normal axis.
Inherited Common Usage
- geometries#
- 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]
- 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 list of shapely geometries 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]
- intersects_axis_position(axis, position)[source]#
Whether self intersects plane specified by a given position along a normal axis.
- Parameters:
axis (int = None) – Axis normal to the plane.
position (float = None) – Position of plane along the normal axis.
- Returns:
Whether this geometry intersects the plane.
- Return type:
bool
- inside(x, y, z)[source]#
For input arrays
x
,y
,z
of arbitrary but identical shape, return an array with the same shape which isTrue
for every point in zip(x, y, z) that is inside the volume of theGeometry
, andFalse
otherwise.- 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:
True
for every point that is inside the geometry.- Return type:
np.ndarray[bool]
- inside_meshgrid(x, y, z)[source]#
Faster way to check
self.inside
on a meshgrid. The input arrays are assumed sorted.- Parameters:
x (np.ndarray[float]) – 1D array of point positions in x direction.
y (np.ndarray[float]) – 1D array of point positions in y direction.
z (np.ndarray[float]) – 1D array of point positions in z direction.
- Returns:
Array with shape
(x.size, y.size, z.size)
, which isTrue
for every point that is inside the geometry.- Return type:
np.ndarray[bool]
- __hash__()#
Hash method.