{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tetrahedralize" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "from project_heart.lv import LV\n", "from project_heart.utils import set_jupyter_backend\n", "from project_heart.enums import *\n", "\n", "set_jupyter_backend(\"pythreejs\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sample_file = Path(\"../sample_files/lvsample.stl\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Tetrahedralize with WILDMESHING backend" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lv = LV.from_file(sample_file) \n", "lv.mesh" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%capture\n", "lv.tetrahedralize(backend=TETRA_BACKEND.WILDMESHING, stop_quality=500);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lv.plot(show_edges=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lv.mesh" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Tetrahedralize with TETGEN backend" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lv = LV.from_file(sample_file) \n", "lv.mesh" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%capture\n", "lv.tetrahedralize(backend=TETRA_BACKEND.TETGEN, order=1, mindihedral=10.0, minratio=3.0)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lv.plot(show_edges=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lv.mesh" ] } ], "metadata": { "interpreter": { "hash": "a4b270fe5129ef310552b5197d637a230d47119f1e46f0b92ff32b1c5f5c5425" }, "kernelspec": { "display_name": "Python 3.9.7 ('project_heart')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }