OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
anonymous_namespace{texture_unwrap_dump.cpp} Namespace Reference

Functions

uint64_t edge_key (int a, int b)
void chart_topology (const indexed_triangle_set &mesh, const std::vector< int > &faces, int &loops, int &euler)
float signed_area_2d (const Vec2f &a, const Vec2f &b, const Vec2f &c)

Function Documentation

◆ chart_topology()

void anonymous_namespace{texture_unwrap_dump.cpp}::chart_topology ( const indexed_triangle_set & mesh,
const std::vector< int > & faces,
int & loops,
int & euler )
47{
48 std::unordered_map<uint64_t, int> edge_use;
49 std::unordered_map<int, int> local;
50 for (const int f : faces) {
51 const stl_triangle_vertex_indices &t = mesh.indices[size_t(f)];
52 for (int i = 0; i < 3; ++i) {
53 ++edge_use[edge_key(t[i], t[(i + 1) % 3])];
54 local.emplace(t[i], int(local.size()));
55 }
56 }
57 euler = int(local.size()) - int(edge_use.size()) + int(faces.size());
58
59 std::unordered_map<int, int> parent;
60 const std::function<int(int)> find = [&](int x) {
61 while (parent[x] != x)
62 x = parent[x] = parent[parent[x]];
63 return x;
64 };
65 for (const auto &[key, uses] : edge_use)
66 if (uses == 1)
67 for (const int v : { int(key >> 32), int(uint32_t(key)) })
68 parent.emplace(v, v);
69 for (const auto &[key, uses] : edge_use)
70 if (uses == 1) {
71 const int a = find(int(key >> 32)), b = find(int(uint32_t(key)));
72 if (a != b)
73 parent[b] = a;
74 }
75 std::unordered_map<int, int> roots;
76 for (const auto &[v, p] : parent)
77 roots[find(v)] = 1;
78 loops = int(roots.size());
79}
@ local
Definition Time.hpp:13
static double f(double x, double z_sin, double z_cos, bool vertical, bool flip)
Definition FillGyroid.cpp:124
RaycastManager::TrItems::iterator find(RaycastManager::TrItems &items, const RaycastManager::TrKey &key)
Definition RaycastManager.cpp:298
uint64_t edge_key(int a, int b)
Definition texture_unwrap_dump.cpp:37

References edge_key(), and Slic3r::f().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edge_key()

uint64_t anonymous_namespace{texture_unwrap_dump.cpp}::edge_key ( int a,
int b )
38{
39 if (a > b)
40 std::swap(a, b);
41 return (uint64_t(uint32_t(a)) << 32) | uint32_t(b);
42}

Referenced by chart_topology(), and main().

Here is the caller graph for this function:

◆ signed_area_2d()

float anonymous_namespace{texture_unwrap_dump.cpp}::signed_area_2d ( const Vec2f & a,
const Vec2f & b,
const Vec2f & c )
82{
83 return 0.5f * ((b.x() - a.x()) * (c.y() - a.y()) - (c.x() - a.x()) * (b.y() - a.y()));
84}

Referenced by main().

Here is the caller graph for this function: