class geode::TetrahedralSolidModifier

Overview

#include <tetrahedral_solid_modifier.h>

class TetrahedralSolidModifier: public geode::VertexSetModifier
{
public:
    // construction

    TetrahedralSolidModifier(
        const SolidMesh3D& solid,
        TetrahedralSolidBuilder3D& builder
        );

    TetrahedralSolidModifier(TetrahedralSolidModifier&& other);

    // methods

    bool is_tetrahedron_active(index_t tetrahedron_id) const;
    bool is_facet_active(index_t facet_id) const;
    void set_tetrahedron_inactive(index_t tetrahedron_id);
    void set_facet_inactive(index_t facet_id);
    bool is_split_tetrahedron_valid(index_t tetrahedron_id, const Point3D& point) const;
    SolidSplitInfo split_tetrahedron(index_t tetrahedron_id, const Point3D& point);
    bool is_split_facet_valid(const PolyhedronFacet& facet, const Point3D& point) const;
    bool is_split_facet_valid(index_t facet_id, const Point3D& point) const;

    absl::optional<PolyhedronFacet> invalid_element_on_split_facet(
        const PolyhedronFacet& facet,
        const Point3D& point
        ) const;

    absl::optional<PolyhedronFacet> invalid_element_on_split_facet(
        index_t facet_id,
        const Point3D& point
        ) const;

    SolidSplitInfo split_facet(index_t facet_id, const Point3D& point);
    SolidSplitInfo split_facet(const PolyhedronFacet& facet, const Point3D& point);
    bool is_split_edge_valid(const PolyhedronFacetEdge& edge, const Point3D& point) const;
    bool is_split_edge_valid(index_t edge_id, const Point3D& point) const;

    absl::optional<index_t> invalid_element_on_split_edge(
        const PolyhedronFacetEdge& edge,
        const Point3D& point
        ) const;

    absl::optional<index_t> invalid_element_on_split_edge(
        index_t edge_id,
        const Point3D& point
        ) const;

    SolidSplitEdgeInfo split_edge(index_t edge_id, const Point3D& point);

    SolidSplitEdgeInfo split_edge(
        const PolyhedronFacetEdge& edge,
        const Point3D& point
        );

    bool is_collapse_edge_valid(
        const PolyhedronFacetEdge& edge,
        const Point3D& point
        ) const;

    bool is_collapse_edge_valid(index_t _id, const Point3D& point) const;

    SolidCollapseEdgeInfo collapse_edge(
        const PolyhedronFacetEdge& edge,
        const Point3D& point
        );

    SolidCollapseEdgeInfo collapse_edge(index_t edge_id, const Point3D& point);
    SolidSwapFacetInfo swap_facet(const PolyhedronFacet& facet);
    std::vector<index_t> clean_tetrahedra();
    std::vector<index_t> clean_vertices();
    std::vector<index_t> clean_edges();
    std::vector<index_t> clean_facets();
    std::tuple<std::vector<index_t>, std::vector<index_t>, std::vector<index_t>, std::vector<index_t>> clean();
};

// direct descendants

class TetrahedralSolidEpsilonModifier;

Inherited Members

public:
    // methods

    index_t updated_vertex(index_t vertex_id) const;

Detailed Documentation

Methods

bool is_split_tetrahedron_valid(index_t tetrahedron_id, const Point3D& point) const

Check if a tetrahedron split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

tetrahedron_id

Index of the tetrahedron to split.

point

Coordinates of the split point.

Returns:

true if split will keep mesh valid.

SolidSplitInfo split_tetrahedron(index_t tetrahedron_id, const Point3D& point)

Split a tetrahedron into four new tetrahedra.

Parameters:

tetrahedron_id

Index of the tetrahedron to split.

point

Coordinates of the split point. @warn Given tetrahedron is set as inactive but not deleted.

Returns:

new vertex index and mappings between old and new mesh.

bool is_split_facet_valid(const PolyhedronFacet& facet, const Point3D& point) const

Check if a facet split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

facet

Index of the PolyhedronFacet to split.

point

Coordinates of the split point.

Returns:

true if split will keep mesh valid.

bool is_split_facet_valid(index_t facet_id, const Point3D& point) const

Check if a facet split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

facet_id

Unique index of the facet to split.

point

Coordinates of the split point.

Returns:

true if split will keep mesh valid.

absl::optional<PolyhedronFacet> invalid_element_on_split_facet(
    const PolyhedronFacet& facet,
    const Point3D& point
    ) const

Check if a facet split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

facet

Index of the PolyhedronFacet to split.

point

Coordinates of the split point.

Returns:

the split PolyhedronFacet of the first flipped Polyhedron, empty if the mesh is valid after split

absl::optional<PolyhedronFacet> invalid_element_on_split_facet(
    index_t facet_id,
    const Point3D& point
    ) const

Check if a facet split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

facet_id

Unique index of the facet to split.

point

Coordinates of the split point.

Returns:

the split PolyhedronFacet of the first flipped Polyhedron, empty if the mesh is valid after split

SolidSplitInfo split_facet(index_t facet_id, const Point3D& point)

Split a facet into three new ones. The tetrahedra incident to this facet are also split into three new tetrahedra.

Parameters:

facet_id

Unique index of the facet to split.

point

Coordinates of the split point. @warn Split tetrahedra are set as inactive but not deleted.

Returns:

new vertex index and mappings between old and new mesh.

SolidSplitInfo split_facet(const PolyhedronFacet& facet, const Point3D& point)

Split a facet into three new ones. The tetrahedra incident to this facet are also split into three new tetrahedra. Edge unique index is found and then the above function is called.

Parameters:

facet

Index of the PolyhedronFacet to split.

point

Coordinates of the split point. @warn Split tetrahedra are set as inactive but not deleted.

Returns:

new vertex index and mappings between old and new mesh.

bool is_split_edge_valid(const PolyhedronFacetEdge& edge, const Point3D& point) const

Check if an edge split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

edge

Index of the PolyhedronFacetEdge to split.

point

Coordinates of the split point.

Returns:

true if split will keep mesh valid.

bool is_split_edge_valid(index_t edge_id, const Point3D& point) const

Check if an edge split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

edge_id

Unique index of the edge to split.

point

Coordinates of the split point.

Returns:

true if split will keep mesh valid.

absl::optional<index_t> invalid_element_on_split_edge(
    const PolyhedronFacetEdge& edge,
    const Point3D& point
    ) const

Check if an edge split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

edge

Index of the PolyhedronFacetEdge to split.

point

Coordinates of the split point.

Returns:

the first flipped Polyhedron, empty if the mesh is valid after split

absl::optional<index_t> invalid_element_on_split_edge(
    index_t edge_id,
    const Point3D& point
    ) const

Check if an edge split will keep the mesh valid, meaning no tetrahedra volume flip its sign. The split is not applied.

Parameters:

edge_id

Unique index of the edge to split.

point

Coordinates of the split point.

Returns:

the first flipped Polyhedron, empty if the mesh is valid after split

SolidSplitEdgeInfo split_edge(index_t edge_id, const Point3D& point)

Split an edge into two new ones. Each tetrahedron incident to this edge is also split into two new tetrahedra.

Parameters:

edge_id

Unique index of the edge to split.

point

Coordinates of the split point. @warn Split tetrahedra are set as inactive but not deleted.

Returns:

new vertex index and mappings between old and new mesh.

SolidSplitEdgeInfo split_edge(
    const PolyhedronFacetEdge& edge,
    const Point3D& point
    )

Split an edge into two new ones. Each tetrahedron incident to this edge is also split into two new tetrahedra.

Parameters:

edge

Index of the PolyhedronFacetEdge to split.

point

Coordinates of the split point. @warn Split tetrahedra are set as inactive but not deleted.

Returns:

new vertex index and mappings between old and new mesh.

bool is_collapse_edge_valid(
    const PolyhedronFacetEdge& edge,
    const Point3D& point
    ) const

Check if an edge collapse will keep the mesh valid, meaning no tetrahedra volume flip its sign. The collapse is not applied.

Parameters:

edge

Index of the PolyhedronFacetEdge to collapse.

point

Coordinates of the collapse point.

Returns:

true if collapse will keep mesh valid.

bool is_collapse_edge_valid(index_t _id, const Point3D& point) const

Check if an edge collapse will keep the mesh valid, meaning no tetrahedra volume flip its sign. The collapse is not applied.

Parameters:

edge_id

Unique index of the edge to collapse.

point

Coordinates of the collapse point.

Returns:

true if collapse will keep mesh valid.

SolidCollapseEdgeInfo collapse_edge(
    const PolyhedronFacetEdge& edge,
    const Point3D& point
    )

Collapse an edge. The tetrahedra incident to this edge are set as inactive but not deleted.

Parameters:

edge

Index of the PolyhedronFacetEdge to collapse.

point

Coordinates of the collapse point.

Returns:

new vertex index and mappings between old and new mesh.

SolidCollapseEdgeInfo collapse_edge(index_t edge_id, const Point3D& point)

Collapse an edge. The tetrahedra incident to this edge are set as inactive but not deleted.

Parameters:

edge_id

Unique index of the edge to collapse.

point

Coordinates of the collapse point.

Returns:

new vertex index and mappings between old and new mesh.

SolidSwapFacetInfo swap_facet(const PolyhedronFacet& facet)

Swap a facet. Two tetrahedra should be incident to this facet. These two tetrahdera are set as inactive and three new tetrahedra are created.

Parameters:

facet

Index of the PolyhedronFacet to swap. @warn Old tetrahedra are set as inactive but not deleted.

Returns:

new vertex index and mappings between old and new mesh.

std::vector<index_t> clean_tetrahedra()

Clean up the mesh removing inactive tetrahedra

Returns:

old2new mappings for tetrahedra

std::vector<index_t> clean_vertices()

Clean up the mesh removing isolated vertices This method should be called after clean_tetrahedra()

Returns:

old2new mappings for vertices

std::vector<index_t> clean_edges()

Clean up the mesh removing edges This method should be called after clean_tetrahedra()

Returns:

old2new mappings for edges

std::vector<index_t> clean_facets()

Clean up the mesh removing facets This method should be called after clean_tetrahedra()

Returns:

old2new mappings for facets

std::tuple<std::vector<index_t>, std::vector<index_t>, std::vector<index_t>, std::vector<index_t>> clean()

Clean up the mesh removing inactive tetrahedra, isolated vertices, edges and facets.

Returns:

old2new mappings for tetrahedra, vertices, edges and facets.