Blended barycentric coordinates Ver. 1.0.0
This set of C++ classes provides you with an implementation of blended barycentric coordinates from the paper: D. Anisimov, D. Panozzo, and K. Hormann. Blended barycentric coordinates. Computer Aided Geometric Design, to appear, 2017. The implementation is based on the pseudocodes from Appendix A of the paper that 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 ..
// Polygon. std::vector<VertexR2> poly(7); poly = VertexR2(-0.542, -0.740); poly = VertexR2(-0.066, -0.740); poly = VertexR2( 0.0, -0.086); poly = VertexR2( 0.066, -0.740); poly = VertexR2( 0.542, -0.740); poly = VertexR2( 0.406, 0.444); poly = VertexR2(-0.406, 0.444); // Evaluation point. VertexR2 query(0.0, 0.2); // Storage for the computed blended coordinates. std::vector<double> b; // Compute blended coordinates. BlendedR2 blc(poly); blc.setContinuity(2); blc.compute(query, b); // Output the resulting coordinates. std::cout << "\nResult: "; for (size_t i = 0; i < b.size(); ++i) std::cout << b[i] << " "; std::cout << "\n\n";
NOTE: For the complete example 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 provide the same timings as in the paper for the two reasons. First, the triangle search here is implemented brute-force and second, the O(n) linear boundary behaviour is a part of the computation, where n is the number of the polygon's vertices (see comments in the code for more details).