flex_rf.tidy3d.GeometryArray
Type: class │ Base(s): Geometry
Description
Section titled “Description”A geometry representing an array of copies of a base geometry, with optional offsets and/or linear transformations applied to each copy.
This class provides an efficient way to represent arrays of repeated geometries, avoiding the need to create many individual geometry objects.
The instance pose for each copy is defined as: T(offsets[i]) @ L(transforms[i]),
where T is a translation matrix and L is the linear transform. In other words,
the transform is applied first, then the translation.
offsetsrepresent all per-instance translation.transformsrepresent linear transforms only (rotation/reflection/scale/shear) and must not contain translation. Useoffsetsfor translations.- If both
offsetsandtransformsareNone, the array contains a single instance of the base geometry at the origin. - If both are provided, they must have the same length.
- Adjoint/autodiff is not currently supported for
GeometryArray.
Example(s)
Section titled “Example(s)”import tidy3d as tdimport numpy as npbox = td.Box(size=(1, 1, 1))# Using offsets only:offsets = [[0, 0, 0], [2, 0, 0], [0, 2, 0], [2, 2, 0]]array = td.GeometryArray(geometry=box, offsets=offsets)# Or use the convenience method:array = box.array(offsets=offsets)# Using linear transforms only (rotation around z-axis):rot_0 = td.Transformed.rotation(0, 2) # no rotationrot_90 = td.Transformed.rotation(np.pi/2, 2) # 90 degree rotationarray = td.GeometryArray(geometry=box, transforms=[rot_0, rot_90])# Both None gives single instance of base geometry:array = td.GeometryArray(geometry=box)Parameters
Section titled “Parameters”geometry [discriminated_union(GeometryType)] = ... |
|
Base geometry to be repeated in the array. |
offsets [tuple[Coordinate, ...] | None] = None |
|
A tuple of 3D coordinate offsets. Each offset translates the base geometry (after any transform is applied) to create a copy. If not provided, no additional translation is applied beyond any transforms. |
transforms [tuple[MatrixReal4x4, ...] | None] = None |
|
A tuple of 4x4 linear-only transformation matrices (rotation/reflection/scale/shear, no translation). Typical transforms can be created using |
Methods
Section titled “Methods”bounds() |
|
Returns bounding box min and max coordinates. |
inside(x: NDArray[float], y: NDArray[float], z: NDArray[float]) |
|
For input arrays |
intersections_plane(x: float | None = None, y: float | None = None, z: float | None = None, cleanup: bool = True, quad_segs: int | None = None, section_tolerance_2d: bool = False) |
|
Returns list of shapely geometries at plane specified by one non-None value of x,y,z. |
intersections_tilted_plane(normal: Coordinate, origin: Coordinate, to_2D: MatrixReal4x4, cleanup: bool = True, quad_segs: int | None = None, section_tolerance_2d: bool = False) |
|
Return a list of shapely geometries at the plane specified by normal and origin. |
intersects_axis_position(axis: int, position: float, section_tolerance_2d: bool = False) |
|
Whether self intersects plane specified by a given position along a normal axis. |
num_geometries() |
|
Number of geometries in the array. |