Commit 0d076c9f by Jordan P. Lefebvre

### WIP. starting on marchingsquares algorithm.

parent 6cf7b9e9
Pipeline #11521 passed with stages
in 4 minutes and 31 seconds
 ... ... @@ -5,6 +5,8 @@ ordering.cc ) SET(HEADERS ordering.hh marchingsquares.hh marchingsquares.i.hh ) TRIBITS_ADD_LIBRARY(radixalgorithmlib ... ...
 #ifndef RADIX_RADIXALGORITHM_MARCHINGSQUARES_HH_ #define RADIX_RADIXALGORITHM_MARCHINGSQUARES_HH_ #include namespace radix { template void marching_squares(const std::vector& points, std::vector& out, size_t rows, size_t cols, data_type isovalue, sign_type negative = 0, sign_type positive = 1); } // namespace /** Include implementation file */ #include "radixalgorithm/marchingsquares.i.hh" #endif /** RADIX_RADIXALGORITHM_MARCHINGSQUARES_HH_ */
 #include #include "radixbug/bug.hh" namespace radix { template void marching_squares(const std::vector& points, std::vector& out, size_t rows, size_t cols, data_type isovalue, sign_type negative, sign_type positive) { radix_check(points.size() == (rows * cols)); out.clear(); out.resize(points.size()); // // Create a 2d view of the points auto view = [&points, cols](size_t row, size_t column) { return points[cols * row + column]; }; for (size_t p_i = 0; p_i < points.size(); ++p_i) { // select data as 0 below value or 1 greater than if (points[p_i] < isovalue) { out[p_i] = negative; } else { out[p_i] = positive; } } } } // namespace
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment