Create a tetrahedral mesh from input triangle mesh. Arguments: mesh (:class:`Mesh`): Input triangular mesh. cell_size (``float``): Max radius of the circumscribed sphere of the output tet. radius_edge_ratio (``float``): Max radius of the circumscribed sphere to the
(mesh,
cell_size,
radius_edge_ratio=2.0,
facet_distance=-1.0,
feature_angle=120,
engine="auto",
with_timing=False)
| 13 | from time import time |
| 14 | |
| 15 | def tetrahedralize(mesh, |
| 16 | cell_size, |
| 17 | radius_edge_ratio=2.0, |
| 18 | facet_distance=-1.0, |
| 19 | feature_angle=120, |
| 20 | engine="auto", |
| 21 | with_timing=False): |
| 22 | """ Create a tetrahedral mesh from input triangle mesh. |
| 23 | |
| 24 | Arguments: |
| 25 | mesh (:class:`Mesh`): Input triangular mesh. |
| 26 | cell_size (``float``): Max radius of the circumscribed sphere of the output tet. |
| 27 | radius_edge_ratio (``float``): Max radius of the circumscribed sphere to the |
| 28 | shortest edge length of each tet. |
| 29 | facet_distance (``float``): Upper bound on the distance from the |
| 30 | circumcenter of a facet to the center of its "Delaunay ball", where |
| 31 | a Delaunay ball is defined as the smallest circumscribed sphere |
| 32 | with center on the surface of the domain. |
| 33 | feature_angle (``float``): Angle threshold (in degrees) for feature extraction. |
| 34 | engine (``string``): The tetrahedralization engine to use. Valid options are: |
| 35 | |
| 36 | * ``auto``: default to tetgen |
| 37 | * ``cgal``: `CGAL 3D mesh generation`_, using Polyhedron domain with |
| 38 | auto feature extraction. |
| 39 | * ``cgal_no_features``: `CGAL 3D mesh generation`_, |
| 40 | using Polyhedron domain without feature extraction. |
| 41 | * ``cgal_implicit``: `CGAL 3D mesh generation`_, |
| 42 | using implicit domain with winding number as oracle. |
| 43 | * ``tetgen``: `TetGen`_ from Hang Si. |
| 44 | * ``quartet``: `Quartet`_ from Robert Bridson and Crawford Doran |
| 45 | * ``delpsc``: `DelPSC`_ from Tamal K Dey , Joshua A. Levine, Andrew |
| 46 | Slatton |
| 47 | * ``vegafem``: Tet mesher provided by `VegaFEM`_ library. |
| 48 | * ``mmg``: Implicit domain meshing from `MMG3D`_. |
| 49 | * ``tetwild``: `TetWild`_ engine based on our Siggraph paper. |
| 50 | with_timing (``boolean``): whether to output timing info. |
| 51 | |
| 52 | Returns: |
| 53 | Tetrahedral mesh (and running time if `with_timing` is True). |
| 54 | |
| 55 | .. _`CGAL 3D mesh generation`: https://doc.cgal.org/latest/Mesh_3/index.html |
| 56 | .. _`TetGen`: http://wias-berlin.de/software/tetgen/ |
| 57 | .. _`Quartet`: https://github.com/crawforddoran/quartet |
| 58 | .. _`DelPSC`: http://web.cse.ohio-state.edu/~dey.8/delpsc.html |
| 59 | .. _`VegaFEM`: http://run.usc.edu/vega/ |
| 60 | .. _`MMG3D`: https://www.mmgtools.org/ |
| 61 | .. _`TetWild`: https://github.com/Yixin-Hu/TetWild |
| 62 | """ |
| 63 | logger = logging.getLogger(__name__) |
| 64 | bbox_min, bbox_max = mesh.bbox |
| 65 | bbox_diagonal = numpy.linalg.norm(bbox_max - bbox_min) |
| 66 | if cell_size <= 0.0: |
| 67 | cell_size = bbox_diagonal / 20.0 * math.sqrt(6) / 4.0 |
| 68 | logger.info("Cell size: {}".format(cell_size)) |
| 69 | if facet_distance <= 0.0: |
| 70 | facet_distance = bbox_diagonal / 1000.0 |
| 71 | logger.info("Facet distance: {}".format(facet_distance)) |
| 72 | if radius_edge_ratio <= 0.0: |
no test coverage detected