Skip to content

LIHPC-Computational-Geometry/hexex2geogram

Repository files navigation

hexex2geogram : .hexex to .geogram mesh file conversion

A .hexex file stores a tetrahedral mesh with an $u,v,w$ parametrization. The syntax is explained in the additional material of HexEx1 and also below.

.geogram is a file format used by the Geogram library, which supports embedded attributes.

This simple program converts a .hexex file to a .geogram one, using per-cell-corner attributes to store the parametrization.

Requirements

Build

mkdir build
cd build
cmake ..
make

Tutorial

The sphere.hexex file comes from the additional material of HexEx1.

./hexex2geogram ../data/sphere.hexex ../data/sphere.geogram

Then:

  • open sphere.geogram with Graphite
  • in the Properties panel, choose "ATTRIBUTE" for "painting"
  • choose "cell_corners.u", "cell_corners.v" or "cell_corners.w" for "attribute"
  • click on "autorange"
  • use a perceptually correct colormap

The output files of MC3D2 also use the .hexex format, with additional information at the end (the walls of the block decomposition). These walls could be saved in the output .geogram file with cell facets attributes, but as of today (October 2023), Graphite/Vorpaview cannot display them. Instead, tetrahedra are grouped by block, and a cell attribute "cells.block_id" is exported. The computation is quite slow.

.hexex format

It is an ASCII-based format.

The fist line is $n$, the number of vertices. It is followed by $n$ lines defining the $n$ vertices. A vertex definition has 3 floating-point numbers for the $x$, $y$ and $z$ coordinates, separated by spaces.

Then there is $m$, the number of cells, followed by $m$ lines for the tetrahedra definitions. A tetrahedron defintion has 4 integers $i0,i1,i2,i3$ (vertex index for each corner) then $4 \times 3$ floating-point numbers ( $u,v,w$ for corner 0, then for corner 1, corner 2 and corner 3), separated by spaces.

The vertices indices $i0,i1,i2,i3$ must be ordered such that $$\det(i1-i0,i2-i0,i3-i0)>0$$ This condition is not checked in hexex2geogram.

In case of an output of MC3D2, the file ends with the number of wall triangles $w$, followed by $w$ lines for wall triangle definitions. A wall triangle definition has 3 integers and a floating-point number (separated by spaces): the 3 vertex indices and the distance from the brush fire's origin.

License

AGPL-3.0

Cite this repository

See CITATION.cff or the dedicated button on GitHub

Footnotes

  1. Max Lyon, David Bommes, Leif Kobbelt, HexEx: Robust Hexahedral Mesh Extraction, SIGGRAPH 2016, url 2

  2. Hendrik Brückler, Ojaswi Gupta, Manish Mandad, Marcel Campen, The 3D Motorcycle Complex for Structured Volume Decomposition, Eurographics 2022, url 2