|
| 1 | +Quartet |
| 2 | +******* |
| 3 | + |
| 4 | +A tetrahedral mesh generator based on Jonathon Shewchuk's isosurface stuffing |
| 5 | +algorithm in combination with the A15 acute tetrahedral tile. |
| 6 | + |
| 7 | +written by: |
| 8 | +Robert Bridson (www.cs.ubc.ca/~rbridson) |
| 9 | +Crawford Doran (www.crawforddoran.com) |
| 10 | +-------------------------------------- |
| 11 | + |
| 12 | + |
| 13 | +Overview |
| 14 | +========== |
| 15 | + |
| 16 | +Quartet converts a watertight triangle mesh into a high-quality uniform |
| 17 | +tetrahedral mesh that closely approximates the geometry, up to the curvature |
| 18 | +implied by the specified grid sampling (dx). Optionally, the tetrahedral mesh |
| 19 | +can be warped to match sharp features on the input, and also improved by a |
| 20 | +quality optimization pass. |
| 21 | + |
| 22 | + |
| 23 | +Building Quartet |
| 24 | +================= |
| 25 | + |
| 26 | +1) It may be necessary to edit Makefile.defs in order to ensure that |
| 27 | + platform-specific variables are set correctly. These include the compiler, |
| 28 | + linker, and all flags associated with them, including libraries. |
| 29 | +2) Run 'make depend' |
| 30 | +3) Run 'make' and/or 'make release' ('make' is equivalent to 'make debug') |
| 31 | + |
| 32 | + |
| 33 | +Running Quartet |
| 34 | +================== |
| 35 | + |
| 36 | +Quartet is run from the command line with the following syntax: |
| 37 | + |
| 38 | +quartet <input.obj> <dx> <output.tet> [-f <feature.feat>] [-a <angle_threshold>] |
| 39 | +[-s <surface.obj>] [-i] [-o] |
| 40 | + |
| 41 | +- <input.obj> is the OBJ file containing the surface to be converted to a |
| 42 | + tetrahedral mesh. |
| 43 | +- <dx> is the grid spacing used in the isosurface stuffing algorithm. The |
| 44 | + generated tetrahedra will be approximately this size. |
| 45 | +- <output.tet> is a path to the file where the resulting tetrahedral mesh will |
| 46 | + be saved. |
| 47 | + |
| 48 | +The optional flags have the following effects: |
| 49 | +-f <features.feat> -- The given file <features.feat> contains lists of |
| 50 | + points and edges indicating sharp corners and ridges |
| 51 | + in the input. The output mesh will resolve these |
| 52 | + features as well as possible. |
| 53 | +-a <angle_threshold> -- Auto-detects sharp features in the input. Edges with |
| 54 | + a dihedral angle smaller than <angle_threshold> degrees |
| 55 | + will be resolved in the output as well as possible. |
| 56 | + In addition, these features will be written to a file |
| 57 | + called 'auto.feat' (which can then be fed to the -f |
| 58 | + option in future executions). |
| 59 | +-s <surface.obj> -- The boundary of the resulting tetrahedral mesh is |
| 60 | + written to <surface.obj>. This is largely for |
| 61 | + convenience of visualizing the result. |
| 62 | +-i -- Intermediate stages of the mesh generation process are |
| 63 | + saved to disk in files named 'N_*_.tet' where N is the |
| 64 | + numbering of the steps. |
| 65 | +-o -- Perform quality optimization on the resulting |
| 66 | + tetrahedral mesh. |
| 67 | + |
| 68 | +Example inputs can be found in the 'meshes' directory. For the inputs with |
| 69 | +sharp features, corresponding .feat files are provided. |
| 70 | + |
| 71 | +Example usages: |
| 72 | +quartet dragon.obj 0.01 dragon_01.tet -o -s dragon.obj |
| 73 | +quartet fandisk.obj 0.1 fandisk_1.tet -f fandisk.feat |
| 74 | +quartet block.obj 0.5 block_5.tet -a 110.0 -o |
| 75 | + |
| 76 | + |
| 77 | +Running view_tet |
| 78 | +================== |
| 79 | + |
| 80 | +We have included an OpenGL viewer application for visualizing resulting tet |
| 81 | +meshes. The viewer is called view_tet, and can be called with the following |
| 82 | +syntax: |
| 83 | + |
| 84 | +view_tet <input.tet> [-s] [-f <features.feat>] [-p (x|y|z)<cutting-plane-pos>]* |
| 85 | +[-w <num_tets>] |
| 86 | + |
| 87 | +Here, <input.tet> is the TET file produced by quartet containing the tet mesh. |
| 88 | + |
| 89 | +The optional flags have the following effects: |
| 90 | +-s -- Assume that <input.tet> is actually |
| 91 | + <input.obj> and read it in as a surface |
| 92 | + mesh from an OBJ file. |
| 93 | +-f <features.feat> -- Displays the sharp features in the file |
| 94 | + <features.feat> alongside the mesh. |
| 95 | +-p (x|y|z)<cutting-plane-pos> -- Specifies a plane to cut the mesh so the |
| 96 | + viewer can see "inside" of it. The plane is |
| 97 | + specified by which coordinate axis is its |
| 98 | + normal and its position along that axis. |
| 99 | + Multiple planes can be specified with multiple |
| 100 | + occurrences of this flag. |
| 101 | +-w num_tets -- Draw the mesh so that the <num_tets> |
| 102 | + worst-quality tetrahedra are highlighted. |
| 103 | + |
| 104 | +Example usages: |
| 105 | +view_tet block.tet -p x0.0 |
| 106 | +view_tet dragon.obj -s |
| 107 | +view_tet fandisk.tet -f fandisk.feat -w 10 |
| 108 | + |
| 109 | +Once view_tet is running, the viewer can be controlled with the following |
| 110 | +inputs: |
| 111 | + |
| 112 | +Shift+LeftMouseButton -- Rotate camera |
| 113 | +Shift+RightMouseButton -- Zoom camera |
| 114 | +Shift+MiddleMouseButton -- Pan camera |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +Source Code overview |
| 119 | +====================== |
| 120 | + |
| 121 | +The following files make up the quartet source: |
| 122 | + |
| 123 | +Utilities / Data Structures: |
| 124 | + |
| 125 | +util.h |
| 126 | + - a bunch of small useful functions |
| 127 | + |
| 128 | +vec.h |
| 129 | + - a convenience wrapper around fixed-length arrays (for vectors in 3D etc.) |
| 130 | + |
| 131 | +array3.h |
| 132 | + - a convenience wrapper around STL vectors to get 3D arrays |
| 133 | + |
| 134 | +sdf.h/cpp |
| 135 | + - a signed-distance-field data structure for working with level sets |
| 136 | + |
| 137 | +read_obj.h/cpp |
| 138 | + - code to read in a Wavefront .OBJ file |
| 139 | + |
| 140 | +trimesh.h/cpp |
| 141 | + - a simple half-edge triangle mesh data structure |
| 142 | + |
| 143 | +tet_mesh.h/cpp |
| 144 | + - an index-based tetrahedral mesh data structure. Maintains incidence |
| 145 | + relationships as necessary for fast adjacency queries. |
| 146 | + |
| 147 | +features.h/cpp |
| 148 | + - Data structures representing sharp features of a triangle mesh and |
| 149 | + aggregations of those features (called FeatureSets) |
| 150 | + |
| 151 | + |
| 152 | +Meshing Functions: |
| 153 | + |
| 154 | +geometry_queries.h/cpp |
| 155 | + - some simple and not-so-simple geometric operations needed for creating |
| 156 | + signed distance functions from triangle meshes. |
| 157 | + Uses Jonathan Shewchuk's robust geometric predicates code, found in |
| 158 | + predicates.cpp (http://www.cs.cmu.edu/~quake/robust.html). |
| 159 | + |
| 160 | +make_signed_distance.h/cpp |
| 161 | + - code for robustly creating a fairly accurate signed distance function |
| 162 | + of a watertight triangle mesh, sampled on a regular 3D grid. |
| 163 | + |
| 164 | +make_tet_mesh.h/cpp |
| 165 | + - code to create a quality tetrahedral mesh of the interior of a level set |
| 166 | + |
| 167 | +tet_quality.h/cpp |
| 168 | + - functions for measuring quality of tetrahedra based on various metrics |
| 169 | + |
| 170 | +match_features.h/cpp |
| 171 | + - code to restore desired sharp features onto a tetrahedral mesh |
| 172 | + |
| 173 | +optimize_tet_mesh.h/cpp |
| 174 | + - code to improve the overall quality of a given tetrahedral mesh. Uses as |
| 175 | + much data from the meshing step (ie: sdf, sharp features, etc.) as possible. |
| 176 | + |
| 177 | +main.cpp |
| 178 | + - quartet command-line program |
| 179 | + |
| 180 | + |
| 181 | +Viewer Application: |
| 182 | + |
| 183 | +gluvi.h/cpp |
| 184 | + - code for creating a simple generic OpenGL viewer application |
| 185 | + |
| 186 | +view_tet.cpp |
| 187 | + - view_tet main code file for viewing tet meshes |
| 188 | + |
0 commit comments