tidy3d.Cylinder#
- class Cylinder[source]#
Bases:
Centered
,Circular
,Planar
Cylindrical geometry with optional sidewall angle along axis direction. When
sidewall_angle
is nonzero, the shape is a conical frustum or a cone.- 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()
.axis (Literal[0, 1, 2] = 2) β Specifies dimension of the planar axis (0,1,2) -> (x,y,z).
sidewall_angle (ConstrainedFloatValue = 0.0) β [units = rad]. Angle of the sidewall.
sidewall_angle=0
(default) specifies a vertical wall;0<sidewall_angle<np.pi/2
specifies a shrinking cross section along theaxis
direction; and-np.pi/2<sidewall_angle<0
specifies an expanding cross section along theaxis
direction.reference_plane (Literal['bottom', 'middle', 'top'] = middle) β The position of the plane where the supplied cross section are defined. The plane is perpendicular to the
axis
. The plane is located at thebottom
,middle
, ortop
of the geometry with respect to the axis. E.g. ifaxis=1
,bottom
refers to the negative side of the y-axis, andtop
refers to the positive side of the y-axis.radius (Union[NonNegativeFloat, Box]) β [units = um]. Radius of geometry at the
reference_plane
.center (Union[tuple[Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box]], Box] = (0.0, 0.0, 0.0)) β [units = um]. Center of object in x, y, and z.
length (NonNegativeFloat) β [units = um]. Defines thickness of cylinder along axis dimension.
Example
>>> c = Cylinder(center=(1,2,3), radius=2, length=5, axis=2)
See also
Notebooks
Attributes
Returns bounding box min and max coordinates.
Gets the position of the center of the geometry in the out of plane dimension.
Gets the length of the geometry along the out of plane dimension.
radius of bottom
max(radius of top, radius of bottom)
min(radius of top, radius of bottom).
radius of bottom
Methods
compute_derivatives
(derivative_info)Compute the adjoint derivatives for this object.
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.to_polyslab
([num_pts_circumference])Convert instance of
Cylinder
into a discretized version usingPolySlab
.Inherited Common Usage
- radius#
- length#
- to_polyslab(num_pts_circumference=51, **kwargs)[source]#
Convert instance of
Cylinder
into a discretized version usingPolySlab
.- Parameters:
num_pts_circumference (int = 51) β Number of points in the circumference of the discretized polyslab.
**kwargs β Extra keyword arguments passed to
PolySlab()
, such asdilation
.
- Returns:
Extruded polygon representing a discretized version of the cylinder.
- Return type:
- property center_axis#
Gets the position of the center of the geometry in the out of plane dimension.
- property length_axis#
Gets the length of the geometry along the out of plane dimension.
- 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]
- 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]
- property radius_bottom#
radius of bottom
- property radius_top#
radius of bottom
- property radius_max#
max(radius of top, radius of bottom)
- property radius_min#
min(radius of top, radius of bottom). It can be negative for a large sidewall angle.
- __hash__()#
Hash method.