← All projects

Systems

C mesh library

OBJ/PLY reading and writing, CLI, compiled to WebAssembly for an in-browser demo.

Done Sprint S2-S6+S42 · 10 points
In short, no jargon for non-developersRead the summaryClose
What it is
A building block that reads the most common 3D files, those of modelling software and 3D printers, and computes their characteristics.
What it is for
Several other projects of the portfolio rely on it: it has to be fast and never crash, even on a damaged file.
What it shows
Rigour on code close to the machine, in the C language: millions of damaged files tried, no memory leak, the same result on Windows, macOS and Linux.

Taught in L3 (advanced C programming)

Source code

How the pieces fit together

Diagram: Files → Readers (read line by line) ; libFuzzer → Readers (random inputs) ; Readers → Mesh (build) ; Mesh → meshinfo ; Readers → WebAssembly (built by Emscripten). read line by line random inputs build built by Emscripten Files OBJ, PLY, STL Readers C11, no dependency Mesh vertices, triangles, edges libFuzzer ASan, UBSan meshinfo command line WebAssembly the page's demo

Try lib-c in your browser

The file is read by the C library compiled to WebAssembly: it never leaves your browser.

or drop it here
Samples:

Tech stack

  • C
  • CMake
  • Emscripten
  • Unity
  • Valgrind
  • libFuzzer

Who does what

C
The OBJ, PLY and STL readers and the basic topology (edges, boundaries, χ), in C11, with typed errors and their line number.
CMake
Building and testing with GCC, Clang and MSVC; the same reader is reused by the topology, parallel, Qt and ray tracer projects.
Emscripten
Compiles the library to WebAssembly for the project page demo: the file never leaves the browser.
Unity
The C unit tests: each format, each error and its line.
Valgrind
Checks for leaks and invalid memory accesses on the tests and the meshinfo command.
libFuzzer
Feeds millions of random inputs to the readers, with ASan and UBSan, on every push in CI.

Definition of Done

  • Code reviewed, diff by diff
  • Unit and integration tests green
  • Green CI on Linux, Windows and macOS when compiled
  • README, REVIEW.md and DECISIONS.md up to date
  • Texts in French and English
  • Demo deployed and tested on mobile