|
||||
File indexing completed on 2025-01-30 10:26:17
0001 /// \file volumes/MarchingCubes.h 0002 /// \author Guilherme Amadio 0003 0004 // This file is part of VecGeom and is distributed under the 0005 // conditions in the file LICENSE.txt in the top directory. 0006 // For the full list of authors see CONTRIBUTORS.txt and `git log`. 0007 0008 /** 0009 * @brief Solid mesh generation via the marching cubes algorithm. 0010 * 0011 * @details The marching cubes algorithm allows the creation of triangle 0012 * models from an implicit signed distance function or using 3D mesh data. 0013 * In VecGeom, the methods <tt>Contains</tt>, <tt>DistanceToIn</tt> and 0014 * <tt>DistanceToOut</tt> of a <tt>VUnplacedVolume</tt> are used to compute 0015 * the mesh for any unplaced volume type in VecGeom, including booleans. 0016 * 0017 * More details about the marching cubes can be found in the original paper[1] 0018 * and on Wikipedia[2]. This implementation uses tables adapted from a 0019 * popular page[3] that also discusses the marching cubes algorithm. 0020 * 0021 * 1. https://doi.org/10.1145/37402.37422 0022 * 2. https://en.wikipedia.org/wiki/Marching_cubes 0023 * 3. http://paulbourke.net/geometry/polygonise/ 0024 * 0025 */ 0026 0027 #ifndef VECGEOM_VOLUMES_MARCHING_CUBES_H_ 0028 #define VECGEOM_VOLUMES_MARCHING_CUBES_H_ 0029 0030 #include "VecGeom/volumes/SolidMesh.h" 0031 #include "VecGeom/volumes/UnplacedVolume.h" 0032 0033 namespace vecgeom { 0034 inline namespace cxx { 0035 0036 /** 0037 * Build a triangle mesh of @p v using the marching cubes algorithm. 0038 * @param[in] v Unplaced volume for which to create the mesh. 0039 * @param[in] layers Minimum number of layers in each direction. 0040 * @returns A pointer to a SolidMesh instance (owned by the caller). 0041 * @remark The meshing grid is always composed of square voxels, so the 0042 * number of layers is proportional to the size of the shape in other 0043 * directions. For example, if a box with size 10, 20, 30 is meshed with 0044 * 20 @p layers, then it will have 20 layers on the x-axis, 40 in the 0045 * y-axis and 60 in the z-axis. 0046 */ 0047 SolidMesh *MarchingCubes(VUnplacedVolume const * const v, int layers); 0048 0049 /** 0050 * Build a triangle mesh of @p v using the marching cubes algorithm. 0051 * @param[in] v Unplaced volume for which to create the mesh. 0052 * @param[in] h Voxel size of the meshing grid (uniform in all directions). 0053 * @returns A pointer to a SolidMesh instance (owned by the caller). 0054 */ 0055 SolidMesh *MarchingCubes(VUnplacedVolume const * const v, Precision h); 0056 0057 } // namespace cxx 0058 } // namespace vecgeom 0059 0060 #endif // VECGEOM_VOLUMES_MARCHING_CUBES_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |