How crrel/points2grid works
Project type and purpose
• points2grid is a command-line tool and C++ library for generating Digital Elevation Models (DEMs) from point clouds using a local gridding algorithm.
• It reads LAS or text point‐cloud files, computes elevation statistics per grid cell (bin), and writes out a raster grid, with optional null‐value filling.
File structure
• Top-level:
• apps/points2grid.cpp – the CLI entry point
• /points2grid/ – public headers for the core library
• src/ – implementation of core modules
• scripts/ – build and test helper scripts
• test/ – unit and integration tests
• CMakeLists.txt, INSTALL.md, .travis.yml – build & CI
• Core library modules in include/points2grid:
• Global.hpp – global configuration & constants
• GridPoint, GridMap, GridFile – in-memory grid structures & I/O
• Interpolation, CoreInterp, InCoreInterp, OutCoreInterp – algorithm implementations
• lasfile.hpp – LAS reader (self-contained)
• config.h.in, export.hpp – build/config exports
• Build & deployment: CMake-based, CI via Travis, bash wrapper in scripts.
README for additional insights
• Describes algorithm (bin radius, IDW, null filling)
• Mentions optional PDAL writer integration (extension point)
• Usage is purely CLI driven; no external services required.
a. Main components
• User & CLI layer (points2grid executable)
• Configuration loader (Global)
• Input module (LAS/Text reader)
• Core algorithm modules (Interpolation, CoreInterp, InCoreInterp, OutCoreInterp)
• Data models (GridPoint, GridMap)
• Output module (GridFile writer)
• Optional extension adapter (PDAL writer)
• Build/Test harness (CMake, scripts, test suite)
b. Relationships & interactions
• CLI → reads user parameters → calls Configuration loader
• CLI → invokes Input module → streams point data into memory
• CLI → passes data + config → Core algorithm modules → populate GridMap
• Core modules → optionally hand off to null‐fill routine → update GridMap
• GridMap → passed to Output module → writes DEM to disk
• Tests & scripts → call CLI and library APIs → verify correctness
c. Architectural patterns & design principles
• Modular layering: separation of CLI, config, I/O, algorithm, and data structures
• Single‐responsibility for each module (e.g., lasfile only reads, GridFile only writes)
• Clear public API surface in include/points2grid
• Build‐time configuration via CMake, header templating (config.h.in)
d. Key technologies & frameworks
• C++ (core language)
• CMake (build, configuration)
• Bash scripts (automation)
• Travis CI (.travis.yml)
• Self-contained LAS reader (no external LAS dependency)
• Optional PDAL integration point
Detail without overcomplicating
• How build scripts and CMake generate the config headers used at compile time
• A small inset illustrating the null‐filling window sizes (3×3,5×5,7×7) as part of the algorithm block