tidy3d.Transformed#
- class Transformed[source]#
Bases:
GeometryClass 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,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D` will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare 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,zof arbitrary but identical shape, return an array with the same shape which isTruefor every point in zip(x, y, z) that is inside the volume of theGeometry, andFalseotherwise.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.
reflection(normal)Return a reflection matrix.
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,zof arbitrary but identical shape, return an array with the same shape which isTruefor every point in zip(x, y, z) that is inside the volume of theGeometry, andFalseotherwise.- 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:
Truefor 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 reflection(normal)[source]#
Return a reflection matrix.
- Parameters:
normal (Tuple[float, float, float]) – Normal of the plane of reflection.
- 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:
Trueif the transformation preserves the axis orientation,Falseotherwise.- Return type:
bool
- __hash__()#
Hash method.