flex_rf.tidy3d.TriangleMesh
Type: class │ Base(s): Geometry, ABC
Description
Section titled “Description”Custom surface geometry given by a triangle mesh, as in the STL file format.
Example(s)
Section titled “Example(s)”vertices = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]])faces = np.array([[1, 2, 3], [0, 3, 2], [0, 1, 3], [0, 2, 1]])stl_geom = TriangleMesh.from_vertices_faces(vertices, faces)Parameters
Section titled “Parameters”mesh_dataset [TriangleMeshDataset | None] = None |
|
Surface mesh data. |
Methods
Section titled “Methods”bounds() |
|
Returns bounding box min and max coordinates. |
fill_holes() |
|
Try to fill holes in the mesh. Can be used to repair non-watertight meshes. |
fix_normals() |
|
Try to fix normals to be consistent and outward-facing. |
fix_winding() |
|
Try to fix winding in the mesh. |
from_height_function(axis: Ax, direction: Literal['-', '+'], base: float, center: tuple[float, float], size: tuple[float, float], grid_size: tuple[int, int], height_func: Callable[[np.ndarray, np.ndarray], np.ndarray]) |
|
Construct a TriangleMesh object from analytical expression of height function. The height function should be vectorized to accept 2D meshgrid arrays. |
from_height_grid(axis: Ax, direction: Literal['-', '+'], base: float, grid: tuple[np.ndarray, np.ndarray], height: NDArray) |
|
Construct a TriangleMesh object from grid based height information. |
from_stl(filename: str, scale: float = 1.0, origin: tuple[float, float, float] = (0, 0, 0), solid_index: int | None = None, **kwargs: Any) |
|
Load a |
from_triangles(triangles: NDArray) |
|
Create a |
from_trimesh(mesh: Trimesh) |
|
Create a |
from_vertices_faces(vertices: NDArray, faces: NDArray) |
|
Create a |
inside(x: NDArray, y: NDArray, z: NDArray) |
|
For input arrays |
intersections_plane(x: float | None = None, y: float | None = None, z: float | None = None, cleanup: bool = True, quad_segs: int | None = None, section_tolerance_2d: bool = False) |
|
Returns list of shapely geometries at plane specified by one non-None value of x,y,z. |
intersections_tilted_plane(normal: Coordinate, origin: Coordinate, to_2D: MatrixReal4x4, cleanup: bool = True, quad_segs: int | None = None, section_tolerance_2d: bool = False) |
|
Return a list of shapely geometries at the plane specified by normal and origin. |
plot(x: float | None = None, y: float | None = None, z: float | None = None, ax: Ax = None, **patch_kwargs: Any) |
|
Plot geometry cross section at single (x,y,z) coordinate. |
subdivide_faces(vertices: NDArray, faces: NDArray) |
|
Uniformly subdivide each triangular face by inserting edge midpoints. |
to_stl(filename: PathLike, *, binary: bool = True) |
|
Export this TriangleMesh to an STL file. |
triangles() |
|
The triangles of the surface mesh as an |
trimesh() |
|
A |