tidy3d.Geometry.array

Contents

tidy3d.Geometry.array#

class array#

Bases:

Return an array of copies of this geometry with optional offsets and/or linear transforms.

This method creates a GeometryArray containing multiple copies of this geometry. When both offsets and transforms are provided, transforms are applied to each copy before the translation given by offsets is applied.

Parameters:
  • offsets (Optional[ArrayLike] = None) – Optional array of offset vectors with shape (N, 3) where N is the number of geometries. Each row specifies the (x, y, z) translation for one geometry (after any transform is applied). If not provided, no additional translation is applied beyond any transforms.

  • transforms (Optional[ArrayLike] = None) – Optional array of 4x4 linear-only transform matrices with shape (N, 4, 4). Each transform must be a valid homogeneous linear transform (rotation/reflection/scale/shear) with no translation component. Typical transforms can be created using Transformed.rotation, Transformed.reflection, or Transformed.scaling.

Returns:

Array containing N copies of this geometry.

Return type:

GeometryArray

Notes

  • offsets represent all per-instance translation.

  • transforms represent linear transforms only and must not contain translation.

  • If both offsets and transforms are None, the array contains a single instance of the base geometry.

  • If both are provided, they must have the same length and transforms are applied before the translation given by offsets.

  • Adjoint/autodiff is not currently supported for GeometryArray.

Example

>>> import tidy3d as td
>>> import numpy as np
>>> box = td.Box(size=(1, 1, 1))
>>> # Create a 2x2 grid of boxes using offsets
>>> offsets = [[0, 0, 0], [2, 0, 0], [0, 2, 0], [2, 2, 0]]
>>> array = box.array(offsets=offsets)
>>> # Create array using linear transforms only (rotation around z-axis)
>>> transforms = [np.eye(4), td.Transformed.rotation(np.pi/4, 2)]
>>> array = box.array(transforms=transforms)
>>> # Both None gives single instance of base geometry
>>> array = box.array()