> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ntop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C++ Examples

This directory holds self-contained examples of common operations you may want to perform using nTop Core library.
This is setup as a [CMake](https://cmake.org/) project which will generate separate executables for each of the example application.

## Setup

The examples have been tested against [CMake](https://github.com/Kitware/CMake/releases/tag/v3.25.2).

[gnuplot](http://www.gnuplot.info/) is required to draw the images generated by the slicer example, being sure to add it to the PATH environment variable.

Now compile the project:

```shell theme={null}
mkdir build
cd build

# In windows (suggested)
cmake .. -DNTOP_CORE_LIB_DIR="C:/path/to/ntop_core_folder"
msbuild cppexamples.sln

# In *nix
cmake .. -DNTOP_CORE_LIB_DIR="/path/to/ntop_core_folder"
cmake --build .
```

## Running the examples

You are now ready to run any of the examples using pattern similar to the following:

```shell theme={null}
# Windows
.\bin\slice.exe

# *nix
# Note: Depending on your distro some programs may print extraneous warning messages
# in the slice demonstration due to a Qt implementation which may not be yet included
# by your package manager. It will not impact the behavior and is limited to visualization
# using matplotplusplus.

.\bin\slice
```

## Example Applications

* [Bounding Box](/Product-Documentation/ntop-core/examples/cpp/boundingbox-app) — computes the bounding box of an implicit body.
* [Closest Point](/Product-Documentation/ntop-core/examples/cpp/closestpoint-app) — finds the closest point on an implicit body's surface to a set of query points.
* [Slice](/Product-Documentation/ntop-core/examples/cpp/slice-app) — transforms an implicit body into a build orientation and slices it with a plane using dual contouring.
* [Slice (Legacy)](/Product-Documentation/ntop-core/examples/cpp/slice-legacy-app) — slices an implicit body with a plane using the legacy marching-squares algorithm.
* [Volume](/Product-Documentation/ntop-core/examples/cpp/volume-app) — computes the volume of an implicit body using a voxel-counting method.
