Skip to content

flex_rf.tidy3d.GeometryArray

Type: class Base(s): Geometry

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.

  • offsets represent all per-instance translation.
  • transforms represent linear transforms only (rotation/reflection/scale/shear) and must not contain translation. Use offsets for translations.
  • If both offsets and transforms are None, 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.
import tidy3d as td
import numpy as np
box = 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 rotation
rot_90 = td.Transformed.rotation(np.pi/2, 2) # 90 degree rotation
array = td.GeometryArray(geometry=box, transforms=[rot_0, rot_90])
# Both None gives single instance of base geometry:
array = td.GeometryArray(geometry=box)
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 Transformed.rotation, Transformed.reflection, or Transformed.scaling. Each transform is applied to the base geometry before the corresponding offset translation. If not provided, only translations from offsets are applied.

bounds()

Returns bounding box min and max coordinates.

inside(x: NDArray[float], y: NDArray[float], z: NDArray[float])

For input arrays x, y, z of arbitrary but identical shape, return an array with the same shape which is True for every point in zip(x, y, z) that is inside the volume of the Geometry, and False otherwise.

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.