Wildmeshing Toolkit
primitive_range.cpp
Go to the documentation of this file.
1 #include "primitive_range.hpp"
2 namespace wmtk::utils {
3 std::vector<PrimitiveType> primitive_range(PrimitiveType pt0, PrimitiveType pt1)
4 {
5  std::vector<PrimitiveType> r;
6  int64_t start = get_primitive_type_id(pt0);
7  int64_t end = get_primitive_type_id(pt1);
8  if (start < end) {
9  r.reserve(end - start);
10  for (int64_t j = start; j <= end; ++j) {
11  r.emplace_back(get_primitive_type_from_id(j));
12  }
13  } else {
14  r.reserve(start - end);
15  for (int64_t j = start; j >= end; --j) {
16  r.emplace_back(get_primitive_type_from_id(j));
17  }
18  }
19  return r;
20 }
21 std::vector<PrimitiveType> primitive_above(PrimitiveType pt, bool lower_to_upper)
22 {
23  if (lower_to_upper) {
25  } else {
27  }
28 }
29 std::vector<PrimitiveType> primitive_below(PrimitiveType pt, bool lower_to_upper)
30 {
31  if (lower_to_upper) {
33  } else {
35  }
36 }
37 } // namespace wmtk::utils
std::vector< PrimitiveType > primitive_above(PrimitiveType pt, bool lower_to_upper)
std::vector< PrimitiveType > primitive_range(PrimitiveType pt0, PrimitiveType pt1)
std::vector< PrimitiveType > primitive_below(PrimitiveType pt, bool lower_to_upper)
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.