|
Wildmeshing Toolkit
|
#include <EmbedSurface.hpp>
Public Member Functions | |
| EmbedSurface (const std::vector< std::string > &img_filenames, const std::vector< Matrix4d > &img_transform={}, const double tol_rel=-1, const double tol_abs=-1) | |
| Input from meshes. | |
| void | simplify_surface (const double eps, const int num_threads=0) |
| Simplify the input surface while staying within the eps envelope. | |
| void | remove_duplicates (const double eps) |
| Merge vertices that are closer than eps. | |
| bool | embed_surface (const bool flood_fill=false, const bool tag_from_winding_number=true) |
| Run the arrangement and tag the resulting cells. | |
| void | consolidate () |
| Remove unreferenced vertices. | |
| const MatrixXd & | V_emb () const |
| const MatrixXr & | V_emb_r () const |
| const MatrixXd & | V_surface () const |
| const MatrixXi & | T_emb () const |
| const MatrixSi & | T_tags () const |
| const MatrixXi & | F_on_surface () const |
| const MatrixXi & | F_surface () const |
| void | write_surf_off (const std::string &filename) const |
| Write surface as read from image. | |
| void | write_emb_surf_off (const std::string &filename) const |
| Write embedded surface. | |
| void | write_emb_msh (const std::string &filename) const |
| void | write_emb_vtu (const std::string &filename) const |
| std::pair< Vector3d, Vector3d > | bbox_minmax () const |
| std::pair< Vector3d, Vector3d > | bbox_surf_minmax () const |
| std::vector< Eigen::Vector3d > | V_surf_to_vector () const |
| std::vector< std::array< size_t, 3 > > | F_surf_to_vector () const |
Public Attributes | |
| bool | m_smooth_surface = false |
| bool | m_perform_sanity_checks = false |
| int | m_num_threads = 0 |
Private Member Functions | |
| void | V_surf_from_vector (const std::vector< Eigen::Vector3d > &verts) |
| void | F_surf_from_vector (const std::vector< std::array< size_t, 3 > > &tris) |
| void | tag_from_winding_number () |
| void | tag_from_provenance () |
| Decide the cell tags from the arrangement's surface provenance. | |
| void | check_tag_surface_invariant (const std::string &how) const |
| Count where the tagging and the arrangement's surface disagree. | |
A class for reading an image and converting it into a tet mesh.
|
private |
Count where the tagging and the arrangement's surface disagree.
Everything downstream reads the surface off the tags – SimWildMesh marks a face as surface exactly when its two tets' tags differ – so a tagging is only right if it reproduces the surface the arrangement computed. Diagnostic, under DEBUG_sanity_checks.
| bool wmtk::components::simwild::EmbedSurface::embed_surface | ( | const bool | flood_fill = false, |
| const bool | tag_from_winding_number = true |
||
| ) |
Run the arrangement and tag the resulting cells.
| flood_fill | Unify the tags of each region bounded by the surface. |
| tag_from_winding_number | Decide each cell's tags by evaluating the winding number of every input at its centroid (the default), rather than by propagating them across the arrangement's own surface provenance. See tag_from_provenance. |
Only do a trivial rounding here. The more complex rounding is performed later on.
Cluster tags by flood-filling regions that are bounded by the surface. All tags within one region are unified by taking the tag with most occurances.
This is for several reasons not the best way to do this.
| void wmtk::components::simwild::EmbedSurface::simplify_surface | ( | const double | eps, |
| const int | num_threads = 0 |
||
| ) |
Simplify the input surface while staying within the eps envelope.
| eps | The absolute envelope thickness. |
|
private |
Decide the cell tags from the arrangement's surface provenance.
The exact alternative to tag_from_winding_number. m_F_tags_surface says which inputs each surface face belongs to, so tags propagate combinatorially: start from a cell of the padded box, which is outside everything, and walk the tet adjacency graph toggling membership of input i whenever a face belonging to input i is crossed. Every input surface is closed, so the parity along any two paths to the same cell agrees; if it does not, the input was not closed and this throws rather than returning a tagging that depends on the traversal order.
| void wmtk::components::simwild::EmbedSurface::write_emb_surf_off | ( | const std::string & | filename | ) | const |
Write embedded surface.
This writes all the vertices that exist in the volume and all triangles that are representing the embedded surface.
| void wmtk::components::simwild::EmbedSurface::write_surf_off | ( | const std::string & | filename | ) | const |
Write surface as read from image.
The surface is all the contours in the image, i.e., the surface in between voxels with different value.