39 for (
const int uv_vert_i : island.
uv_edges[uv_edge_i].verts) {
40 island.
uv_verts[uv_vert_i].uv_edges.append_non_duplicates(uv_edge_i);
46 for (
const int uv_edge_i : uv_primitive.
edges) {
47 island.
uv_edges[uv_edge_i].uv_primitive_indices.append_non_duplicates(
54 for (
const int uv_edge_i : uv_primitive.
edges) {
69 BLI_assert(
ELEM(v1, corner_verts[tri[0]], corner_verts[tri[1]], corner_verts[tri[2]]));
70 BLI_assert(
ELEM(
v2, corner_verts[tri[0]], corner_verts[tri[1]], corner_verts[tri[2]]));
71 for (
const int corner : {tri[0], tri[1], tri[2]}) {
72 const int vert = corner_verts[corner];
82 for (
const int corner : {tri[0], tri[1], tri[2]}) {
106 for (
int k = 0; k < 3; k++) {
111 return has_0 && has_1;
117 for (
const int corner : mesh_data.
faces[face]) {
132 if (c0 == -1 || c1 == -1) {
140 return uv_map[c0] == uv_map[c1] && uv_map[c0_next] == uv_map[c1_next];
142 return uv_map[c0] == uv_map[c1_next] && uv_map[c0_next] == uv_map[c1];
165 for (const int face : range) {
166 const IndexRange tris = mesh::face_triangles_range(mesh_data.faces, int(face));
167 for (const int tri : tris.drop_front(1)) {
168 disjoint_set.join(tris.first(), tri);
176 for (const int edge_i : range) {
177 const Span<int> edge_faces = mesh_data.edge_to_face_map[edge_i];
178 if (edge_faces.size() == 2 &&
179 faces_have_shared_uv_edge(mesh_data, edge_faces[0], edge_faces[1], edge_i))
181 disjoint_set.join(mesh::face_triangles_range(mesh_data.faces, edge_faces[0]).first(),
182 mesh::face_triangles_range(mesh_data.faces, edge_faces[1]).first());
185 const bool is_loose_edge = edge_faces.is_empty();
186 mesh_data.uv_edge_is_border[edge_i] = !is_loose_edge;
191 return disjoint_set.calc_reduced_ids(mesh_data.uv_island_ids);
229 uv_vert.
flags.is_border =
false;
230 uv_vert.
flags.is_extended =
false;
239 :
vert(mesh_data.corner_verts[corner]),
uv(mesh_data.uv_map[corner])
276 const int vert_index = vert.vert;
278 for (
const int uv_vert_i : verts) {
279 if (
uv_verts[uv_vert_i].uv == vert.uv) {
288 const int found_vert =
lookup(vert);
289 if (found_vert != -1) {
304 const int found_vert_i =
lookup(edge_vert_0);
305 if (found_vert_i == -1) {
309 for (
const int uv_edge_i : found_vert.
uv_edges) {
311 const int other_vert_i =
e->get_other_uv_vert(*
this, found_vert.
vert);
313 if (other_vert.
vert == edge_vert_1.
vert && other_vert.
uv == edge_vert_1.
uv) {
322 int found_edge =
lookup(edge);
323 if (found_edge != -1) {
329 result->uv_primitive_indices.clear();
335 const int primitive_i,
343 const int corner_1 = tri[i];
344 const int corner_2 = tri[(i + 1) % 3];
346 uv_edge_template.
is_border = tri_corner_near_border[
int64_t(primitive_i) * 3 + i];
350 uv_primitive_ptr->
edges[i] = uv_edge_i;
354 return uv_primitive_ptr;
368 for (
const int uv_edge_i : prim.
edges) {
379 if (!border.has_value()) {
382 if (!border->is_ccw(*
this)) {
383 border->flip_order();
385 borders.append(std::move(*border));
416 BLI_assert(mesh_data.corner_verts[tri[0]] == vert);
425 std::stringstream ss;
433 std::cout << ss.str();
456 for (
int k = 0; k < 3; k++) {
469 const int other_vert,
473 for (
const int t : tris) {
486 flags.is_manifold =
true;
503 flags.is_manifold =
false;
508 const int start_tri = tris.
first();
509 int current_tri = start_tri;
515 const int outgoing_vert = incoming_vert == verts[0] ? verts[1] : verts[0];
516 const int next_tri =
adjacent_tri(mesh_data, tris, vert, outgoing_vert, current_tri);
517 if (next_tri == -1) {
519 flags.is_manifold =
false;
522 if (next_tri == start_tri) {
526 incoming_vert = outgoing_vert;
527 current_tri = next_tri;
535 if (!fan_edge.flags.found) {
546 fan_edge.flags.found =
false;
547 for (
const int uv_edge_i : uv_vert.
uv_edges) {
550 fan_edge.flags.found =
true;
565 int v2 = mesh_data.
corner_verts[segment.tri[segment.vert_order[1]]];
580 int current_vert = from_vert;
582 int v1 = mesh_data.
corner_verts[segment->tri[segment->vert_order[1]]];
583 int v2 = mesh_data.
corner_verts[segment->tri[segment->vert_order[2]]];
584 if (!
ELEM(current_vert, v1,
v2)) {
587 current_vert = v1 == current_vert ?
v2 : v1;
589 return current_vert == to_vert;
604 const int from_vert_order = 1;
605 const int to_vert_order = 2;
606 const int index_increment = reversed ? -1 : 1;
613 int v2 = mesh_data.
corner_verts[segment->tri[segment->vert_order[from_vert_order]]];
614 if (
v2 == from_vert) {
624 int v3 = mesh_data.
corner_verts[segment->tri[segment->vert_order[to_vert_order]]];
645 if (!segment->flags.found) {
649 return solution.
size() - not_visited_steps;
657 "Inconsistency detected, `from_vert` isn't part of the outside of the fan.");
659 "Inconsistency detected, `to_vert` isn't part of the outside of the fan.");
660 if (to_vert == from_vert) {
672 bool winding_1_valid =
is_path_valid(winding_1, mesh_data, from_vert, to_vert);
673 bool winding_2_valid =
is_path_valid(winding_2, mesh_data, from_vert, to_vert);
675 if (winding_1_valid && !winding_2_valid) {
678 if (!winding_1_valid && winding_2_valid) {
681 if (!winding_1_valid && !winding_2_valid) {
694 segment.print_debug(mesh_data);
702 const UVVert &connected_vert_1,
703 const UVVert &connected_vert_2,
705 const int mesh_primitive_i)
710 const int mesh_vert_1 = connected_vert_1.
vert;
711 const int mesh_vert_2 = connected_vert_2.
vert;
712 const float2 uv_1 = connected_vert_1.
uv;
713 const float2 uv_2 = connected_vert_2.
uv;
717 vert_template.
uv = uv_unconnected;
718 vert_template.
vert = other_vert_i;
721 const int corner_1 =
get_uv_corner(mesh_data, tri, mesh_vert_1);
722 vert_template.
uv = uv_1;
726 const int corner_2 =
get_uv_corner(mesh_data, tri, mesh_vert_2);
727 vert_template.
uv = uv_2;
732 edge_template.
verts[0] = uv_vert_1_i;
733 edge_template.
verts[1] = uv_vert_2_i;
735 edge_template.
verts[0] = uv_vert_2_i;
736 edge_template.
verts[1] = uv_vert_i;
738 edge_template.
verts[0] = uv_vert_i;
739 edge_template.
verts[1] = uv_vert_1_i;
774 if (other_vert == target_vert) {
783 const int uv_vert1_i,
784 const int uv_vert2_i,
785 const int uv_vert3_i,
786 const int fill_primitive_i)
790 edge_template.
verts[0] = uv_vert1_i;
791 edge_template.
verts[1] = uv_vert2_i;
793 edge_template.
verts[0] = uv_vert2_i;
794 edge_template.
verts[1] = uv_vert3_i;
796 edge_template.
verts[0] = uv_vert3_i;
797 edge_template.
verts[1] = uv_vert1_i;
807 float min_uv_distance,
822 Fan fan(mesh_data, uv_vert.
vert);
823 if (!fan.
flags.is_manifold) {
845 if (winding_solution.
size() < 2 && (num_to_add == 0 || corner.
angle > 2.0f)) {
849 const int fill_primitive_i = winding_solution.
size() == 1 ?
850 winding_solution[0]->primitive_index :
853 if (fill_primitive_i != -1) {
854 fill_primitive_1_i = fill_primitive_i;
855 fill_primitive_2_i = fill_primitive_i;
858 float2 center_uv = corner.
uv(island, 0.5f, min_uv_distance);
893 r_modified.
append(after_edge);
899 num_to_add = winding_solution.
size();
905 int shared_edge_vert =
909 float factor = (segment_index + 1.0f) / num_to_add;
910 float2 new_uv = corner.
uv(island, factor, min_uv_distance);
912 FanSegment &segment = *winding_solution[segment_index];
914 const int fill_primitive_i = segment.primitive_index;
917 mesh_data, tri_fill, uv_vert.
vert, shared_edge_vert);
920 uv_vert_template.
vert = uv_vert.
vert;
921 uv_vert_template.
uv = uv_vert.
uv;
923 uv_vert_template.
vert = shared_edge_vert;
924 uv_vert_template.
uv = old_uv;
926 uv_vert_template.
vert = other_prim_vert;
927 uv_vert_template.
uv = new_uv;
934 island, uv_vert.
vert, other_prim_vert);
936 island.
uv_primitives[new_prim_i].get_uv_edge(island, shared_edge_vert, other_prim_vert),
938 new_border_edges.
append(new_border);
949 new_edge->
order = order_counter++;
951 new_edge->
prev = prev_edge;
952 prev_edge->
next = new_edge;
953 prev_edge = new_edge;
954 r_modified.
append(new_edge);
956 prev_edge->
next = after_edge;
957 after_edge->
prev = prev_edge;
958 r_modified.
append(after_edge);
966 uv_vert.
flags.is_border =
false;
967 uv_vert.
flags.is_extended =
false;
980 const short island_index)
988 borders[border_index].setup_links(border_index);
990 border_edge.order = order_counter++;
1000 bool operator<(
const HeapEntry &other)
const
1002 if (
angle != other.angle) {
1003 return angle > other.angle;
1005 return edge->
order > other.edge->order;
1008 std::priority_queue<HeapEntry> queue;
1012 if (std::isfinite(
angle)) {
1013 queue.push({
angle, &border_edge});
1020 const float angle = border.outside_angle(*
this, border_edge);
1021 queue_edge(
angle, border_edge);
1027 while (!queue.empty()) {
1028 const HeapEntry entry = queue.top();
1035 const int uv_vert_i = border_edge->
get_uv_vert(*
this, 0);
1041 if (
angle != entry.angle) {
1042 queue_edge(
angle, *border_edge);
1050 if (
tile &&
tile->is_masked(island_index, uv_vert_uv)) {
1051 modified_edges.
clear();
1055 tile->get_pixel_size_in_uv_space() * 2.0f,
1061 if (modified_edge->is_extendable(*
this)) {
1064 queue_edge(
angle, *modified_edge);
1069 this->
uv_verts[uv_vert_i].flags.is_extended =
true;
1075 std::stringstream ss;
1076 ss <<
"#### Start UVIsland ####\n";
1077 ss <<
"import bpy\n";
1078 ss <<
"import bpy_extras.object_utils\n";
1079 ss <<
"import mathutils\n";
1081 ss <<
"uvisland_vertices = [\n";
1083 ss <<
" mathutils.Vector((" << vert_position.x <<
", " << vert_position.y <<
", "
1084 << vert_position.z <<
")),\n";
1088 ss <<
"uvisland_edges = []\n";
1090 ss <<
"uvisland_faces = [\n";
1092 ss <<
" [" << this->
uv_verts[this->
uv_edges[uvprimitive.edges[0]].verts[0]].vert <<
", "
1093 << this->
uv_verts[this->
uv_edges[uvprimitive.edges[0]].verts[1]].vert <<
", "
1094 << this->
uv_verts[uvprimitive.get_other_uv_vert(
1096 this->
uv_edges[uvprimitive.edges[0]].verts[0],
1097 this->uv_edges[uvprimitive.edges[0]].verts[1])]
1103 ss <<
"uvisland_uvs = [\n";
1106 ss <<
" " << uv.x <<
", " << uv.y <<
",\n";
1108 ss <<
" " << uv.x <<
", " << uv.y <<
",\n";
1109 uv = this->
uv_verts[uvprimitive.get_other_uv_vert(
1111 this->
uv_edges[uvprimitive.edges[0]].verts[0],
1112 this->uv_edges[uvprimitive.edges[0]].verts[1])]
1114 ss <<
" " << uv.x <<
", " << uv.y <<
",\n";
1118 ss <<
"uvisland_mesh = bpy.data.meshes.new(name='UVIsland')\n";
1119 ss <<
"uvisland_mesh.from_pydata(uvisland_vertices, uvisland_edges, uvisland_faces)\n";
1120 ss <<
"uv_map = uvisland_mesh.attributes.new('UVMap', 'FLOAT2', 'CORNER')\n";
1121 ss <<
"uv_map.data.foreach_set('vector', uvisland_uvs)\n";
1122 ss <<
"bpy_extras.object_utils.object_data_add(bpy.context, uvisland_mesh)\n";
1123 ss <<
"#### End UVIsland ####\n\n\n";
1125 std::cout << ss.str();
1141 return std::nullopt;
1145 border.
edges.append(start_edge);
1146 borders_used[*start_index].set();
1150 while (current_uv != first_uv) {
1151 bool edge_added =
false;
1153 if (borders_used[edge_i].test()) {
1158 for (i = 0; i < 2; i++) {
1161 borders_used[edge_i].set();
1163 border.
edges.append(border_edge);
1184 const int uv_vert1_i = edge.
get_uv_vert(island, 0);
1185 const int uv_vert2_i = edge.
get_uv_vert(island, 1);
1198 edge.reverse_order = !edge.reverse_order;
1207 island.
uv_verts[prev.get_uv_vert(island, 0)].uv,
1215 for (
int64_t i = 0; i < n; i++) {
1218 edges[i].border_index = border_index;
1219 edges[i].removed =
false;
1239 float desired_len =
max_ff(
1257 std::stringstream ss;
1270 std::cout << ss.str();
1283 const uint8_t mesh_vert_index)
const
1286 const int mesh_vert = mesh_data.
corner_verts[tri[mesh_vert_index]];
1287 for (
const int uv_edge_i :
edges) {
1288 for (
const int uv_vert_i : island.
uv_edges[uv_edge_i].verts) {
1290 if (uv_vert.
vert == mesh_vert) {
1301 for (
const int uv_edge_i :
edges) {
1304 if ((e1 == uv1 && e2 == uv2) || (e1 == uv2 && e2 == uv1)) {
1314 for (
int uv_edge_i :
edges) {
1317 if ((e1 == v1 && e2 ==
v2) || (e1 ==
v2 && e2 == v1)) {
1327 for (
int uv_edge_i :
edges) {
1329 if (std::find(edge.
verts.begin(), edge.
verts.end(), uv_vert_i) != edge.
verts.end()) {
1341 for (
int uv_edge_i :
edges) {
1343 for (
const int uv_vert_i : edge.
verts) {
1344 if (!
ELEM(uv_vert_i, v1,
v2)) {
1367 return edge.
verts[actual_index];
1384 return uv_vert.
flags.is_border && !uv_vert.
flags.is_extended;
1416 for (
const int64_t tri_index : range) {
1420 corner_tris[tri_index]);
1421 for (
int j = 0; j < 3; j++) {
1422 const int edge_i = real_edges[j];
1423 if (edge_i != -1 && edge_is_border[edge_i]) {
1425 vert_is_border[edge[0]] =
true;
1426 vert_is_border[edge[1]] =
true;
1427 r_tri_corner_near_border[tri_index * 3 + j] =
true;
1435 for (
const int64_t tri_index : range) {
1436 const int3 &tri = corner_tris[tri_index];
1437 r_tri_near_border[tri_index] = vert_is_border[mesh_data.
corner_verts[tri[0]]] ||
1451 Array<bool> tri_corner_near_border(tris_num * 3,
false);
1460 for (const int64_t uv_island_id : range) {
1461 UVIsland &uv_island = islands[uv_island_id];
1462 uv_island.id = uv_island_id;
1463 for (const int primitive_i : tris_by_island[uv_island_id]) {
1464 if (tri_near_border[primitive_i]) {
1465 add_primitive(mesh_data, uv_island, primitive_i, tri_corner_near_border);
1468 uv_island.num_original_primitives = uv_island.uv_primitives.size();
1469 uv_island.extract_borders();
1470 uv_island.extend_border(mesh_data, uv_masks, short(uv_island_id));
1514 for (
const int tri_i : tris) {
1543 for (const int tile_index : range) {
1544 for (const int i : tris_by_island.index_range()) {
1545 add_uv_island(mesh_data, tiles[tile_index], tris_by_island[i], i);
1553 tiles.append_as(
Tile(udim_offset, resolution));
1560 std::atomic<bool> changed =
false;
1562 bool local_changed = false;
1563 for (const int y : y_range) {
1564 const int row = y * resolution.x;
1565 for (int x = 0; x < resolution.x; x++) {
1566 const int offset = row + x;
1567 uint16_t value = prev_mask[offset];
1568 if (value == 0xffff) {
1569 if (x != 0 && prev_mask[offset - 1] != 0xffff) {
1570 value = prev_mask[offset - 1];
1571 local_changed = true;
1573 else if (x < resolution.x - 1 && prev_mask[offset + 1] != 0xffff) {
1574 value = prev_mask[offset + 1];
1575 local_changed = true;
1578 mask[offset] = value;
1581 if (local_changed) {
1592 std::atomic<bool> changed =
false;
1594 bool local_changed = false;
1595 for (const int y : y_range) {
1596 const int row = y * resolution.x;
1597 for (int x = 0; x < resolution.x; x++) {
1598 const int offset = row + x;
1599 uint16_t value = prev_mask[offset];
1600 if (value == 0xffff) {
1601 if (y != 0 && prev_mask[offset - resolution.x] != 0xffff) {
1602 value = prev_mask[offset - resolution.x];
1603 local_changed = true;
1605 else if (y < resolution.y - 1 && prev_mask[offset + resolution.x] != 0xffff) {
1606 value = prev_mask[offset + resolution.x];
1607 local_changed = true;
1610 mask[offset] = value;
1613 if (local_changed) {
1641 for (const int i : range) {
1642 dilate_tile(tiles[i], max_iterations);
1650 if (local_uv.x < 0.0f || local_uv.y < 0.0f || local_uv.x > 1.0f || local_uv.y > 1.0f) {
1657 return mask[offset] == island_index;
1663 if (
tile.contains(uv)) {
1673 if (
tile ==
nullptr) {
1676 return tile->is_masked(island_index, uv);
#define PRF_scope(category)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
#define IN_RANGE_INCL(a, b, c)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void fill(const T &value) const
void reinitialize(const int64_t new_size)
constexpr IndexRange()=default
constexpr IndexRange index_range() const
constexpr int64_t size() const
void append(const T &value)
IndexRange index_range() const
VecBase< float, D > normalize(VecOp< float, D >) RET
float2x2 from_rotation(AngleRadian rotation)
const ccl_global KernelWorkTile * tile
std::optional< int64_t > find_first_0_index(const BitSpanT &data)
GroupedSpan< int > build_edge_to_face_map(OffsetIndices< int > faces, Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices)
int3 corner_tri_get_real_edges(Span< int2 > edges, Span< int > corner_verts, Span< int > corner_edges, const int3 &corner_tri)
IndexRange face_triangles_range(OffsetIndices< int > faces, int face_i)
int face_corner_next(const IndexRange face, const int corner)
std::optional< UVBorder > extract_border_from_edges(const UVIsland &island, MutableSpan< UVBorderEdge > edges, MutableBoundedBitSpan borders_used)
static void find_triangles_near_border(const MeshData &mesh_data, MutableSpan< bool > r_tri_corner_near_border, MutableSpan< bool > r_tri_near_border)
static void add_uv_island(const MeshData &mesh_data, UVIslandsMask::Tile &tile, const Span< int > tris, int16_t island_index)
static void add_uv_primitive_fill(UVIsland &island, const int uv_vert1_i, const int uv_vert2_i, const int uv_vert3_i, const int fill_primitive_i)
static int face_corner_of_edge(const MeshData &mesh_data, const int face, const int edge_i)
static int find_fill_primitive(const MeshData &mesh_data, const UVIsland &island, UVBorderCorner &corner)
static void add_uv_primitive_shared_uv_edge(const MeshData &mesh_data, UVIsland &island, const UVVert &connected_vert_1, const UVVert &connected_vert_2, float2 uv_unconnected, const int mesh_primitive_i)
static void dilate_tile(UVIslandsMask::Tile &tile, int max_iterations)
static void mesh_data_init_topology(MeshData &mesh_data)
static bool tri_contains_verts(const MeshData &mesh_data, const int tri_i, const int v0, const int v1)
Array< UVIsland > build_uv_islands(const MeshData &mesh_data, const GroupedSpan< int > tris_by_island, const UVIslandsMask &uv_masks)
static void uv_primitive_append_to_uv_verts(UVIsland &island, UVPrimitive &uv_primitive)
static void uv_primitive_append_to_uv_edges(UVIsland &island, UVPrimitive &uv_primitive)
static void uv_vert_init_flags(UVVert &uv_vert)
static UVPrimitive * add_primitive(const MeshData &mesh_data, UVIsland &uv_island, const int primitive_i, const Span< bool > tri_corner_near_border)
static void reset_extendability_flags(UVIsland &island)
static bool dilate_x(const Span< uint16_t > prev_mask, MutableSpan< uint16_t > mask, const ushort2 resolution)
static bool faces_have_shared_uv_edge(const MeshData &mesh_data, const int face_0, const int face_1, const int edge_i)
static void extend_at_vert(const MeshData &mesh_data, UVIsland &island, UVBorderCorner &corner, float min_uv_distance, int64_t &order_counter, Vector< UVBorderEdge * > &r_modified)
static void uv_edge_append_to_uv_verts(UVIsland &island, const int uv_edge_i)
static int primitive_get_other_uv_vert(const MeshData &mesh_data, const int3 &tri, const int v1, const int v2)
static bool dilate_y(const Span< uint16_t > prev_mask, MutableSpan< uint16_t > mask, const ushort2 resolution)
static ushort2 mask_resolution_from_tile_resolution(ushort2 tile_resolution)
static int mesh_data_init_primitive_uv_island_ids(MeshData &mesh_data)
static int get_uv_corner(const MeshData &mesh_data, const int3 &tri, const int vert)
static void mesh_data_init(MeshData &mesh_data)
AngleRadianBase< T > angle_between(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
MINLINE float min_ff(float a, float b)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
MINLINE void copy_v2_v2(float r[2], const float a[2])
float cross_poly_v2(const float verts[][2], unsigned int nr)
MatBase< float, 2, 2 > float2x2
float angle_signed_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE int max_ii(int a, int b)
ATTR_WARN_UNUSED_RESULT const BMVert * v
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
VecBase< uint16_t, 2 > ushort2
constexpr bool operator<(StringRef a, StringRef b)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
MINLINE float max_ff(float a, float b)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
VecBase< float, 3 > float3
MINLINE int clamp_i(int value, int min, int max)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
bool inside(const int x, const int y) const
struct blender::bke::pbvh::uv_islands::FanSegment::@064320177100241246374204120011012026341104001376 flags
void print_debug(const MeshData &mesh_data) const
FanSegment(const MeshData &mesh_data, const int primitive_index, const int3 tri, int vert)
void print_debug(const MeshData &mesh_data) const
bool contains_vert_on_outside(const MeshData &mesh_data, const int vert) const
static bool is_path_valid(const Span< FanSegment * > path, const MeshData &mesh_data, const int from_vert, const int to_vert)
Vector< FanSegment * > best_path_between(const MeshData &mesh_data, const int from_vert, const int to_vert)
void mark_already_added_segments(const UVIsland &uv_island, const UVVert &uv_vert)
Vector< FanSegment > segments
struct blender::bke::pbvh::uv_islands::Fan::@234112160234372313155145205237032056146315266100 flags
static int2 other_fan_edge_verts(const MeshData &mesh_data, const int vert, const int tri_i)
int count_edges_not_added() const
static int adjacent_tri(const MeshData &mesh_data, const Span< int > tris, const int vert, const int other_vert, const int tri_i)
static Vector< FanSegment * > path_between(const Span< FanSegment * > edge_order, const MeshData &mesh_data, const int from_vert, const int to_vert, const bool reversed)
static int64_t score(const Span< FanSegment * > solution)
Fan(const MeshData &mesh_data, const int vert)
Array< int > edge_to_face_offsets
Array< int > edge_to_face_indices
MeshData(OffsetIndices< int > faces, Span< int3 > corner_tris, Span< int > corner_verts, Span< int > corner_edges, Span< int2 > mesh_edges, GroupedSpan< int > vert_to_face_map, Span< float2 > uv_map, Span< float3 > vert_positions)
OffsetIndices< int > faces
Array< bool > uv_edge_is_border
Span< float3 > vert_positions
GroupedSpan< int > edge_to_face_map
Array< int > uv_island_ids
GroupedSpan< int > vert_to_face_map
void print_debug(const UVIsland &island) const
bool connected_in_mesh(const UVIsland &island) const
float2 uv(const UVIsland &island, float factor, float min_uv_distance)
UVBorderCorner(UVBorderEdge *first, UVBorderEdge *second, float angle)
int get_other_uv_vert(const UVIsland &island) const
UVBorderEdge(int uv_edge_i, int uv_primitive)
int get_uv_vert(const UVIsland &island, int index) const
bool is_extendable(const UVIsland &island) const
float length(const UVIsland &island) const
VectorList< UVBorderEdge > edges_extend_border
void setup_links(int64_t border_index)
float outside_angle(const UVIsland &island, const UVBorderEdge &edge) const
bool is_ccw(const UVIsland &island) const
Vector< UVBorderEdge > edges
std::array< int, 2 > verts
bool has_same_verts(const UVIsland &island, const int2 &edge) const
int get_other_uv_vert(const UVIsland &island, int vert)
Vector< int, 2 > uv_primitive_indices
int lookup(const UVVert &vert)
Vector< UVBorder > borders
Vector< UVPrimitive > uv_primitives
Map< int, Vector< int > > uv_vert_lookup
void print_debug(const MeshData &mesh_data) const
Vector< UVEdge > uv_edges
Vector< UVVert > uv_verts
void extend_border(const MeshData &mesh_data, const UVIslandsMask &mask, short island_index)
int lookup_or_create(const UVVert &vert)
bool contains(float2 uv) const
bool is_masked(uint16_t island_index, float2 uv) const
Tile(float2 udim_offset, ushort2 tile_resolution)
float get_pixel_size_in_uv_space() const
void dilate(int max_iterations)
bool is_masked(uint16_t island_index, float2 uv) const
void add(const MeshData &mesh_data, GroupedSpan< int > tris_by_island)
const Tile * find_tile(float2 uv) const
void add_tile(float2 udim_offset, ushort2 resolution)
int get_uv_vert(const UVIsland &island, const MeshData &mesh_data, uint8_t mesh_vert_index) const
int get_other_uv_vert(const UVIsland &island, const int v1, const int v2) const
bool contains_uv_vert(const UVIsland &island, const int uv_vert) const
std::array< int, 3 > edges
int get_uv_edge(const UVIsland &island, float2 uv1, float2 uv2) const
UVPrimitive(int primitive_i)
struct blender::bke::pbvh::uv_islands::UVVert::@006002110014127050064304055317211247224121323337 flags