Lagrange
Loading...
Searching...
No Matches
compute_uv_overlap.h
1/*
2 * Copyright 2026 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/AttributeFwd.h>
15#include <lagrange/SurfaceMesh.h>
16#include <lagrange/bvh/api.h>
17
18#include <optional>
19#include <string>
20#include <utility>
21#include <vector>
22
23namespace lagrange::bvh {
24
27
61
66{
69 std::string uv_attribute_name;
70
74
83
86 std::string overlap_coloring_attribute_name = "@uv_overlap_color";
87
93
96};
97
104template <typename Scalar, typename Index>
106{
109 bool has_overlap = false;
110
116 std::optional<Scalar> overlap_area;
117
123 std::vector<std::pair<Index, Index>> overlapping_pairs;
124
131};
132
154template <typename Scalar, typename Index>
157 const UVOverlapOptions& options = {});
158
160
161} // namespace lagrange::bvh
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:73
Definition BVH.h:27
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
constexpr AttributeId invalid_attribute_id()
Invalid attribute id.
Definition AttributeFwd.h:76
LA_BVH_API UVOverlapResult< Scalar, Index > compute_uv_overlap(SurfaceMesh< Scalar, Index > &mesh, const UVOverlapOptions &options={})
Compute pairwise UV triangle overlap.
Definition compute_uv_overlap.cpp:840
UVOverlapMethod
Algorithm used to find candidate bounding-box pairs in compute_uv_overlap.
Definition compute_uv_overlap.h:31
@ SweepAndPrune
Zomorodian-Edelsbrunner sweep-and-prune.
Definition compute_uv_overlap.h:38
@ Hybrid
Zomorodian-Edelsbrunner HYBRID algorithm (recursive divide-and-conquer).
Definition compute_uv_overlap.h:59
Options for compute_uv_overlap.
Definition compute_uv_overlap.h:66
std::string uv_attribute_name
UV attribute name.
Definition compute_uv_overlap.h:69
bool compute_overlap_coloring
If true, compute a per-facet integer attribute that assigns each triangle a color (greedy graph color...
Definition compute_uv_overlap.h:82
bool compute_overlap_area
If true (default), compute the total overlap area via Sutherland-Hodgman clipping.
Definition compute_uv_overlap.h:73
UVOverlapMethod method
Candidate pair detection algorithm.
Definition compute_uv_overlap.h:95
bool compute_overlapping_pairs
If true, populate UVOverlapResult::overlapping_pairs with the sorted list of (i, j) facet-index pairs...
Definition compute_uv_overlap.h:92
std::string overlap_coloring_attribute_name
Name of the per-facet output integer attribute written when compute_overlap_coloring is true.
Definition compute_uv_overlap.h:86
Result of compute_uv_overlap.
Definition compute_uv_overlap.h:106
bool has_overlap
True when at least one pair of UV triangles has a positive-area interior intersection.
Definition compute_uv_overlap.h:109
std::optional< Scalar > overlap_area
Sum of intersection areas over all overlapping triangle pairs.
Definition compute_uv_overlap.h:116
std::vector< std::pair< Index, Index > > overlapping_pairs
Sorted list of (i, j) facet-index pairs (i < j) that have a positive-area interior intersection.
Definition compute_uv_overlap.h:123
AttributeId overlap_coloring_id
AttributeId of the per-facet integer coloring attribute written to the mesh.
Definition compute_uv_overlap.h:130