# quangnguyenlong/pcprep architecture

> Architecture diagram of the GitHub repository quangnguyenlong/pcprep, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quangnguyenlong/pcprep
- Repository: https://github.com/quangnguyenlong/pcprep

## Overview

##### Project Type and Purpose
- This project is a specialized tool for processing point clouds. Its core purpose is twofold:
– Providing a command-line executable (pcp) that processes point cloud data (e.g., tiling, subsampling, converting camera parameters to matrices)
– Offering a supporting library (pcprep) with lower-level functionalities for geometric operations, point cloud processing, and file handling (e.g., PLY, JSON via cJSON and miniply).
- In addition, there are example programs (in the “examples” directory) that demonstrate how to use the library for various functions, along with an auxiliary tool (trajectory-tool) for camera path generation with Unity.

##### File Structure
- Top-Level Components:
– Build configuration and scripts: Files like CMakeLists.txt, test.sh, and build scripts.
– Library/Fundamental components:
- “include” folder contains header files for cJSON, miniply, and the pcprep library (with modules such as aabb, canvas, mesh, pointcloud, vector types, etc).
- “src” folder mirrors the “include” components with source files providing the actual implementation.
– Executables:
- “pcp” folder contains the main command-line tool that likely leverages functions provided by the pcprep library.
– Examples:
- “examples” folder holds various sample applications (tiling, subsampling, cam2mat, screen_area, etc) that act as both demonstrations and utilities.
– Additional utilities:
- “trajectory-tool” folder, used with Unity for camera trajectory editing, and a build script (pcprep.sh) for VPCC integration.
- From the filenames (e.g., cam2mat.c, tiling.c, subsampling.c), each example tends to be a standalone executable built on the underlying library.
- External integration: The README mentions dependencies (e.g., libpng, OpenGL/GLFW/GLEW for desktop mode, etc.) which connects to how the build can optionally support GPU-enabled desktop operations.

- Main Components to Represent:
a. Build System & Dependencies:
– CMake and Make tools working as the underlying build and configuration system.
– External dependencies: libpng, optional libraries for desktop mode (libglfw3-dev, libglew-dev, libgl-dev), and libglm-dev for examples.
b. Core Library (pcprep):
– Represent individual modules: aabb, canvas, core, mesh, pointcloud, vector utility (vec3f, vec3u, vec3uc), and wrapper.
– Show that these modules are used for data processing and geometric operations.
c. JSON and File Format Handling:
– cJSON library module, both in “include” and “src”.
– miniply library and its respective modules for handling PLY files.
d. Command-line Tool (pcp):
– Stands as the front-facing executable that provides point cloud processing operations.
e. Examples (Tiling, Subsampling, Cam2mat, Screen_area, etc):
– Grouped together or shown as separate executables that illustrate the usage of the underlying functionality.
f. Additional Tools:
– “trajectory-tool”, which interacts with an external system (Unity) for synthetic trajectory generation.
- Relationships & Data Flow:
- Data input (e.g., a PLY file such as longdress0000.ply or JSON files for camera parameters) flowing into the pcp tool and examples.
- pcp and example executables calling the pcprep library internally to process the point clouds.
- The pcprep library using cJSON and miniply components for file parsing and point cloud data handling.
– Illustrate that build scripts and configuration files (like CMakeLists.txt) govern how the source, library, and executable components are compiled into deliverables.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global Entities
    BS("Build System & Dependencies"):::build
    IF("Input Files (PLY/JSON)"):::input

    %% Core Library (pcprep)
    subgraph "Core Library (pcprep)"
        PH("Headers (aabb,canvas,core,mesh,pointcloud,vec3f,vec3u,vec3uc,wrapper)"):::lib
        PS("Sources (Implementation)"):::lib
        PH --> PS
    end

    %% File Handling Libraries
    JSON("cJSON"):::file
    MIN("miniply"):::file

    %% Executables
    subgraph "Executables"
        PCP("Command-line Tool (pcp)"):::exec
        EX("Examples"):::exec
        TT("Trajectory Tool"):::exec
    end

    %% Connections
    BS -->|"builds"| PCP
    BS -->|"builds"| EX
    BS -->|"configures"| PH
    BS -->|"builds"| TT

    IF -->|"feeds"| PCP
    IF -->|"feeds"| EX

    PCP -->|"calls"| PH
    EX -->|"calls"| PH

    PH -->|"uses"| JSON
    PH -->|"uses"| MIN

    %% Click Events
    click BS "https://github.com/quangnguyenlong/pcprep/blob/main/CMakeLists.txt"
    click PH "https://github.com/quangnguyenlong/pcprep/tree/main/include/pcprep/"
    click PS "https://github.com/quangnguyenlong/pcprep/tree/main/src/pcprep/"
    click JSON "https://github.com/quangnguyenlong/pcprep/blob/main/include/cJSON.h"
    click MIN "https://github.com/quangnguyenlong/pcprep/tree/main/include/miniply/"
    click PCP "https://github.com/quangnguyenlong/pcprep/blob/main/pcp/pcp.c"
    click EX "https://github.com/quangnguyenlong/pcprep/tree/main/examples/"
    click TT "https://github.com/quangnguyenlong/pcprep/tree/main/trajectory-tool"

    %% Styles
    classDef build fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef lib fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef file fill:#ffff99,stroke:#000,stroke-width:2px;
    classDef exec fill:#f4a460,stroke:#000,stroke-width:2px;
    classDef input fill:#ffa07a,stroke:#000,stroke-width:2px;
```
