MRPTree Quick Start & FAQ
Copyright © 2025 Mitch Richling. All rights reserved. |
Table of Contents
1. MRPtree
Quick Start
The best place to start with MRPtree
is the example programs.
1.1. Building MRPtree
Examples With CMake
The MRPtree
code is broken into two repositories (MRPtree
& MRMathCPP
), and both must be downloaded and configured before you can use
MRPtree
. In addition, some of the example programs use MRaster
. If you want to build those examples, then you will also need to download and
configure MRaster
.
A typical shell session to download, configure everything, and build the examples might look like this:
git clone 'https://github.com/richmit/MRMathCPP.git' # Download MRMathCPP cd MRMathCPP/build # Change directory to 'build' cmake .. # Configure the build system with cmake cd ../.. # Change directory back to where we started git clone 'https://github.com/richmit/mraster.git' # Download MRaster cd mraster/build # Change directory to 'build' cmake .. # Configure the build system with cmake cd ../.. # Change directory back to where we started git clone 'https://github.com/richmit/MRPTree.git' # Download MRPTree cd MRPTree/build # Change directory into the repo's build directory cmake .. # Configure build cmake --build . -t examples-all # Build all the examples
1.2. Building MRPtree
Examples Without CMake
MRPtree
and all of it's dependencies are single-header C++ libraries. So using them really just amounts to making sure your compiler
an find the headers.
Our first step is to get the code. A typical shell session to download everything might look like this:
git clone 'https://github.com/richmit/MRMathCPP.git' # Download MRMathCPP git clone 'https://github.com/richmit/mraster.git' # Download MRaster git clone 'https://github.com/richmit/MRPTree.git' # Download MRPTree
Here is a brief outline of what we have downloaded:
MRMathCPP/lib/
- Headers for
MRMathCPP
mraster/lib
- Headers for
MRaster
MRPTree/lib/
- Headers for
MRPTree
MRPTree/examples-lib3d/
- Headers for
MRPTree
examples MRPTree/examples-func-viz
- The most interesting
MRPTree
example programs
What you do next will depend upon your development environment. For example, if we are using GCC on a UNIX-like environment, then we might do something like this:
cd MRPTree/examples-func-viz
g++ -std=c++23 -I../lib/ -I../../MRMathCPP/lib/ -I../examples-lib3d/ -I../../mraster/lib/ -o complex_magnitude_surface complex_magnitude_surface.cpp
This will build complex_magnitude_surface
on UNIX'ish platforms and complex_magnitude_surface.exe
on windows (under MSYS2 for example). Of the several
examples, I selected complex_magnitude_surface.cpp
as it uses all of the dependencies, including MRaster
– so it's a good test if we got everything
right.
If using an IDE, then the standard procedure is to create a project and simply add the source file for the example in question along with all the headers to the project.
2. MRPtree
FAQ
2.1. Do I need MRaster
to use MRPTree
.
No. I use MRaster
in some of the example programs to generate color schemes or bitmaps. MRPTree
has no direct dependency on this library at all.
2.2. Do I need MRMathCPP
to use MRPTree
.
Yes. MRPTree
directly uses several of the functions in MRMathCPP
.
2.3. Do you recommend using the MR_cell_cplx
or MR_rt_to_cc
outside of the provided examples?
No.
These libraries are quite minimal – they really are just barely enough to support useful examples. Any real application using MRPTree
would be much better
served using something like VTK for 3D geometry.
These libraries are housed in a directory called "examples-lib3d
" to emphasize the point they are NOT part of the primary library.