tidy3d.Transformed#
- class Transformed[source]#
Bases:
Geometry
Class representing a transformed geometry.
- 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()
.geometry (ForwardRef('annotate_type(GeometryType)')) – Base geometry to be transformed.
transform (ArrayLike[dtype=float, ndim=2, shape=(4, 4)] = [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]) – Transform matrix applied to the base geometry.
Attributes
Methods
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.intersections_tilted_plane
(normal, origin, to_2D)Return a list of shapely geometries at the plane specified by normal and origin.
preserves_axis
(transform, axis)Indicate if the transform preserves the orientation of a given axis.
rotation
(angle, axis)Return a rotation matrix.
scaling
([x, y, z])Return a scaling matrix.
translation
(x, y, z)Return a translation matrix.
Inherited Common Usage
- geometry#
- transform#
- property inverse#
Inverse of this transform.
- 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]
- 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]
- static translation(x, y, z)[source]#
Return a translation matrix.
- Parameters:
x (float) – Translation along x.
y (float) – Translation along y.
z (float) – Translation along z.
- Returns:
Transform matrix with shape (4, 4).
- Return type:
numpy.ndarray
- static scaling(x=1.0, y=1.0, z=1.0)[source]#
Return a scaling matrix.
- Parameters:
x (float = 1.0) – Scaling factor along x.
y (float = 1.0) – Scaling factor along y.
z (float = 1.0) – Scaling factor along z.
- Returns:
Transform matrix with shape (4, 4).
- Return type:
numpy.ndarray
- static rotation(angle, axis)[source]#
Return a rotation matrix.
- Parameters:
angle (float) – Rotation angle (in radians).
axis (Union[int, Tuple[float, float, float]]) – Axis of rotation: 0, 1, or 2 for x, y, and z, respectively, or a 3D vector.
- Returns:
Transform matrix with shape (4, 4).
- Return type:
numpy.ndarray
- static preserves_axis(transform, axis)[source]#
Indicate if the transform preserves the orientation of a given axis.
Parameters: transform: MatrixReal4x4
Transform matrix to check.
- axisint
Axis to check. Values 0, 1, or 2, to check x, y, or z, respectively.
- Returns:
True
if the transformation preserves the axis orientation,False
otherwise.- Return type:
bool
- __hash__()#
Hash method.