Subdividing barycentric coordinates Ver. 1.0.0
This set of C++ classes provides you with an implementation of barycentric coordinates based on Loop and Catmull-Clark subdivision schemes as discussed in the paper: D. Anisimov, C. Deng, and K. Hormann. Subdividing barycentric coordinates. Computer Aided Geometric Design, 43:172-185, 2016. The paper itself can be found here.
NOTE: This code has been tested only on Mac OS!
Run the code
In order to run the code, do the following:
- Install macports
- Open terminal and type the following:
sudo port install cmake
cmake -DCMAKE_BUILD_TYPE=Debug ..
For the release version use instead:
cmake -DCMAKE_BUILD_TYPE=Release ..
// Create polygon. std::vector<VertexR2> poly(8); poly = VertexR2(0.0, 0.0); poly = VertexR2(1.0, 0.0); poly = VertexR2(2.0, 0.0); poly = VertexR2(2.0, 1.0); poly = VertexR2(1.0, 1.0); poly = VertexR2(1.0, 2.0); poly = VertexR2(0.0, 2.0); poly = VertexR2(0.0, 1.0); const size_t numSubSteps = 3; // number of subdivision steps // Initialize mesh with a polygon and compute // Loop coordinates based on the triangulation of the polygon // involving no interior vertices. We also perform one ternary // subdivision step as a preprocessing. bool makeTernary = true; TriangleSubdivisionR2 tsub; tsub.setFromPolygon(poly); tsub.preprocess(makeTernary); tsub.subdivide(numSubSteps);
NOTE: For more examples see main.cpp!
If you find any bugs, please report them to me, and I will try to fix them as soon as possible! Please also note that this code does not contain all the features described in the paper but rather gives a default set of functions to subdivide some given barycentric coordinates.