tidy3d.Transformed#
- class Transformed[source]#
Bases:
Geometry
Class representing a transformed geometry.
- Parameters:
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
Returns bounding box min and max coordinates.
Inverse of this transform.
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.
- 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.