Skip to content

Label grid nodes, warn about degeneracies and detect complex cells

Aleksei KALINOV requested to merge complex_cell_visualization into master

This change introduces 4 main updates: Sparse Grid Labeler, Intersection computation and Degeneracy Warning system, Grid Lattice to sparse operations and Complex Cell Detector.

Sparse Grid Labeler

The grid labeling system shoots rays along the grid edges in given direction. It then uses GridMeshIntersector to find the intersections with mesh and uses the sparse intersection representation to keep counters for each label. It assumes that an outside material is always 0-th in the material vector and extensively uses it to assign labels to the vertices outside mesh.

Renderer:

  • l turns on visualization of labels on the grid nodes. The existence The black part indicates that some

Intersections and Degeneracies

GridMeshIntersector declares an interface for a object capable of computing the intersections between grid edges and mesh triangles. The interface allows to obtain intersections themselves or to find the near degenerate cases for intersections, such as grid edge intersecting a triangle edge.

Two implementations are available currently: the naive one and the tetrahedral one.

Naive version computes projection of a segment (grid edge) onto a plane containing triangle and evaluates the barycentric coordinates of the projection point to determine the intersection predicate. Tetrahedral version instead builds a tetrahedron on triangle vertices and one edge of a segment. The tetrahedron barycentric coordinates of another end of segment are then used to get the intersection.

In my small experiments I found that the tetrahedral version works better for computation of intersections, while naive version is easier to tweak for degeneracy detection due to an aggressive early returns in in the tetrahedral version.

Renderer:

  • I (capital i) to shuffle through the detected intersections along one orientation or along all of them.
  • W (capital w) to initiate the degeneracy warning computation. It can take some time on a large mesh during which the visualization will be frozen. Once finished the results are cached, so subsequent invocations will not recompute the warning from scratch.

Grid lattice

Grid lattice is a collection of arbitrary values stored on rays of the grid in a sparse manner. Each ray can contain several values of the same type. Internally those will be sorted according to their position as determined by the provided coordinate extractor. Grid lattice stores the direction of rays for decide which sorting coordinate to use. As it is a sparse datastructure, only rays with values are allocated. This allows for efficient traversal of rays. The internal sorting property allows to efficiently obtain interpolation points for the points not stored in the lattice.

Complex cell detector

Currently the rules for complex vertex and complex edge are implemented. The complex objects are stored on grid in a non-sparse manner. Since we assume that the number of complex cells won't be too big, it makes it easier to compute the complex neighbours and other characteristics.

Renderer:

  • X (capital x) highlights all complex cells.

Merge request reports