Internals

Internals

The internals of Meshing have been optimized for performance and to be generic. This is some brief documentation on the basic internal functions.

Common

_DEFAULT_SAMPLES = (24,24,24)

Global default sampling count for functions.

source
_get_cubeindex(iso_vals, iso)

given iso_vals and iso, return an 8 bit value corresponding to each corner of a cube. In each bit position, 0 indicates in the isosurface and 1 indicates outside the surface, where the sign convention indicates negative inside the surface

source
_get_cubeindex_pos(iso_vals, iso)

given iso_vals and iso, return an 8 bit value corresponding to each corner of a cube. In each bit position, 0 indicates in the isosurface and 1 indicates outside the surface, where the sign convention indicates positive inside the surface

source

determinetypes(meshtype, fieldtype=Float64, facelen=3)

Given a subtype of AbstractMesh, determine the type of vertex/point and face to use for internal computations.

Preference is given to the types specified by the Mesh call, and will default to the FieldType for SignedDistanceField, and Point{3,Float64}/Face{3,Int} for direct function sampling.

source

Marching Cubes

_mc_create_triangles!(vts, fcs, vertlist, cubeindex, FaceType)

Create triangles by adding every point within a triangle to the vertex vector.

source
_mc_unique_triangles!(vts, fcs, vertlist, cubeindex, FaceType)

Create triangles by only adding unique vertices within the voxel. Each face may share a reference to a vertex with another face.

source
find_vertices_interp(points, iso_vals, cubeindex, iso, eps)

Find the vertices where the surface intersects the cube

source
Meshing.vertex_interpFunction.
vertex_interp(iso, p1, p2, valp1, valp2, eps = 0.00001)

Linearly interpolate the position where an isosurface cuts an edge between two vertices, each with their own scalar value

source
mc_vert_points(xi,yi,zi, scale, origin, ::Type{VertType})

Returns a tuple of 8 points corresponding to each corner of a cube

source

Marching Tetrahedra

Voxel corner and edge indexing conventions

        Z
        |

        5------5------6              Extra edges not drawn
       /|            /|              -----------
      8 |           6 |              - face diagonals
     /  9          /  10                - 13: 1 to 3
    8------7------7   |                 - 14: 1 to 8
    |   |         |   |                 - 15: 1 to 6
    |   1------1--|---2  -- Y           - 16: 5 to 7
    12 /          11 /                  - 17: 2 to 7
    | 4           | 2                   - 18: 4 to 7
    |/            |/                 - body diagonal
    4------3------3                     - 19: 1 to 7

  /
 X
Missing docstring.

Missing docstring for Meshing._correct_vertices!. Check Documenter's build log for details.

Meshing.procVoxFunction.
procVox(vals, iso::Real, x, y, z, nx, ny,
                vts::Dict, vtsAry::Vector, fcs::Vector,
                eps::Real)

Processes a voxel, adding any new vertices and faces to the given containers as necessary.

source
Meshing.voxEdgeIdFunction.
voxEdgeId(subTetIx, tetEdgeIx)

Given a sub-tetrahedron case and a tetrahedron edge ID, determines the corresponding voxel edge ID.

source
Meshing.getVertIdFunction.
getVertId(e, x, y, z, nx, ny,
            vals, iso::Real,
            vts::Dict,
            vtsAry::Vector,
            eps::Real)

Gets the vertex ID, adding it to the vertex dictionary if not already present.

source
Meshing.vertPosFunction.
vertPos(e, x, y, z, vals::NTuple{8,T}, iso::Real, eps::Real, ::Type{VertType}) where {T<:Real, VertType}

Assuming an edge crossing, determines the point in space at which it occurs. eps represents the "bump" factor to keep vertices away from voxel corners (thereby preventing degeneracies).

source
Meshing.vertIdFunction.
vertId(e, x, y, z, nx, ny)

Determines a unique integer ID associated with the edge. This is used as a key in the vertex dictionary. It needs to be both unambiguous (no two edges get the same index) and unique (every edge gets the same ID regardless of which of its neighboring voxels is asking for it) in order for vertex sharing to be implemented properly.

source
Meshing.tetIxFunction.
tetIx(tIx, cubeindex)

Determines which case in the triangle table we are dealing with

source

Surface Nets