Add mbmesh: generate 3D point clouds (projected XYZ + ECEF XYZ + GLB + optional HTML viewer) directly from swath datalists#1584
Add mbmesh: generate 3D point clouds (projected XYZ + ECEF XYZ + GLB + optional HTML viewer) directly from swath datalists#1584Lyn-Solarn wants to merge 32 commits into
mbmesh: generate 3D point clouds (projected XYZ + ECEF XYZ + GLB + optional HTML viewer) directly from swath datalists#1584Conversation
…ile(). Added <algorithm> include and mb_datalist_read3 forward declaration. Completed full mb_mallocd() + mb_register_array() implementation for beamflag, bath, bathlon, bathlat, and amp arrays with proper MBIO memory types and error handling via goto cleanup.
…ing functionality. Cleaned up comments and removed obsolete code related to array allocation.
…line cleanup comments in read_swath_file().
…ating through the swath sonar datalist.
…e adjusting the longitude and latitude to local meters to be more easily read by a 3D viewer
- Implemented ECEF (Earth-Centered, Earth-Fixed) coordinate output in mbmesh. - Added function geodetic_to_ecef() for WGS84 geodetic to ECEF conversion. - Added write_ecef_xyz_file() to output all soundings as ecefPointcloud.xyz in true 3D (no flattening). - Updated main() to generate ecefPointcloud.xyz alongside existing point cloud outputs. - Added user-facing messages for ECEF output, matching the style of other point cloud writers (file name, number of points, and file location). - Added comments to clarify new output and reporting. - Ensured ECEF output is suitable for downstream 3D mesh and 3D Tiles generation.
…tml X3DOM viewer file referencing adjustedPointcloud.glb.
Add geo origin calculation for ECEF output
…h tiles that allow hierarchical LOD loading
Completed mbmesh
Removed obsolete test files and added manpage & README
|
On first scan this appears to be a significant contribution. Thanks! |
Removed unnecessary data files from mbmesh
py3dtiles convert (used by mbm_tmap) rejects # lines, so removing them lets mbm_tmap consume mbmesh output directly.
Removed # comment headers from mbmesh .xyz outputs
|
Testing this PR in my working directory... Here's how I did it:
No errors, and can display the mbmesh help message: |
|
I'm seeing a few nits, mostly my preferences on how things should work, but Now, to try out |
|
One final nit... After doing a |
Remove unnecessary files and connected mbmesh manpage to Makefiles
|
Did you move I get this error when doing a This is a small nit, but the entries in |
Moved mbmesh.1 back to the correct folder (src/man/man1/)
|
I'm getting a clean build and |
|
@dwcaress This PR is ready for merging into the master branch. |


Addresses: #1559
Summary
This pull request introduces a new MB-System program,
mbmesh, that reads swath sonar datalists (MB-System datalist framework) and extracts valid multibeam bathymetry soundings to generate 3D point cloud outputs. The current implementation focuses on producing point clouds and lightweight visualization artifacts that can be used immediately in browser-based and desktop 3D tooling, and serves as the foundation for future mesh generation and OGC 3D Tiles output.What’s included
mbmesh(src/mbmesh/mbmesh.cpp)src/mbmesh/pointcloud_glb_writer.cppsrc/mbmesh/pointcloud_glb_writer.hsrc/mbmesh/README.md(usage, outputs, build notes)src/mbmesh/mbmesh.1(man page)src/mbmesh/CMakeLists.txtsrc/mbmesh/Makefile.amHow to use
mbmeshSynopsis
Inputs
-I<datalist>: MB-System datalist file that references one or more swath files (and optionally processed versions).Internally,
mbmeshiterates entries usingmb_datalist_open()/mb_datalist_read3(), then reads each swath file usingmb_read_init()andmb_read().Options
-I<datalist>: Input datalist file (default:datalist.mb-1)-O<outputdir>: Output directory (default:./tileset). Created if it does not exist.-Rwest/east/south/north: Geographic bounds filter (degrees).-html: Also generateadjustedPointcloud.htmland attempt to launch a local web server + open the viewer.-V/-V -V: Increase verbosity (progress reporting, stats, sample soundings).-H/-h: Print help and exit.Examples
Basic run (writes to
./tileset):Custom output directory:
Geographic filtering:
Generate an HTML viewer and attempt to launch it:
Output files
mbmeshwrites outputs into the directory specified by-O(default:./tileset):adjustedPointcloud.xyzLocal projected XYZ (meters) designed for numerical stability in 3D viewers:
X,Y: meters relative to the data centroid (derived from mean lon/lat)Z: depth centered around mean depthThe header records the reference lon/lat/depth used for centering.
ecefPointcloud.xyzWGS84 ECEF point cloud (meters) written with a GeoOrigin (centroid) offset applied:
(x0,y0,z0)(x-x0, y-y0, z-z0)adjustedPointcloud.glbBinary glTF (GLB) point cloud generated from
adjustedPointcloud.xyz:TINYGLTF_MODE_POINTSadjustedPointcloud.html(only when-htmlis provided)Minimal X3DOM-based viewer that inlines
adjustedPointcloud.glb.When
-htmlis enabled,mbmeshattempts to:python3 -m http.server 8000 --bind 127.0.0.1 --directory <outputdir>http://127.0.0.1:8000/adjustedPointcloud.htmlNotes / known limitations (current implementation)
mbmeshstores all extracted soundings in memory prior to writing outputs; very large datalists may require substantial RAM.-Roption is documented as a geographic (degrees) bounding box. Reviewers should confirm that the coordinates being stored/filtered correspond to lon/lat as intended in the current extraction path.Future work (not part of this PR)
tileset.json+ tile payloads) and LOD streaming.py3dtilesand alternatives for 3D Tiles generation.