Lagrange
Loading...
Searching...
No Matches
select_facets_by_normal_similarity.h
1/*
2 * Copyright 2019 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#ifdef LAGRANGE_ENABLE_LEGACY_HEADERS
15 #include <lagrange/legacy/select_facets_by_normal_similarity.h>
16#endif
17
18#include <lagrange/AttributeFwd.h>
19#include <lagrange/SurfaceMesh.h>
20
21#include <limits> // needed in options
22#include <optional> // needed in options
23#include <string_view> // needed in options
24
25namespace lagrange {
26
27
35
40{
42 double flood_error_limit = std::numeric_limits<double>::max();
43
54
56 std::string_view facet_normal_attribute_name = "@facet_normal";
57
60 std::optional<std::string_view> is_facet_selectable_attribute_name;
61
63 std::string_view output_attribute_name = "@is_selected";
64
66 enum class SearchType {
67 BFS = 0,
68 DFS = 1
69 };
70
73
76
77
78}; // SelectFaceByNormalSimilarityOptions
79
102
103template <typename Scalar, typename Index>
106 const Index seed_facet_id,
107 const SelectFacetsByNormalSimilarityOptions& options = {});
108
110
111} // namespace lagrange
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:73
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
AttributeId select_facets_by_normal_similarity(SurfaceMesh< Scalar, Index > &mesh, const Index seed_facet_id, const SelectFacetsByNormalSimilarityOptions &options={})
Given a seed facet, selects facets around it based on the change in triangle normals.
Definition select_facets_by_normal_similarity.cpp:30
Main namespace for Lagrange.
Option struct for selecting facets based on normal similarity.
Definition select_facets_by_normal_similarity.h:40
SearchType
select_facets_by_normal_similarity uses either BFS or DFS in its flooding search
Definition select_facets_by_normal_similarity.h:66
@ BFS
Breadth-First Search.
Definition select_facets_by_normal_similarity.h:67
@ DFS
Depth-First Search.
Definition select_facets_by_normal_similarity.h:68
std::string_view facet_normal_attribute_name
The attribute name for the facet normal.
Definition select_facets_by_normal_similarity.h:56
SearchType search_type
The search type (BFS or DFS)
Definition select_facets_by_normal_similarity.h:72
double flood_second_to_first_order_limit_ratio
There are two types of error limits when flood-search goes from one facet to its neighboring facet:
Definition select_facets_by_normal_similarity.h:53
double flood_error_limit
Increasing this would select a larger region.
Definition select_facets_by_normal_similarity.h:42
std::optional< std::string_view > is_facet_selectable_attribute_name
Users can specify whether a facet is selectable by an uint8 attribute.
Definition select_facets_by_normal_similarity.h:60
int num_smooth_iterations
Smoothing boundary of selected region (reduce ears)
Definition select_facets_by_normal_similarity.h:75
std::string_view output_attribute_name
The attribute name for the selection output.
Definition select_facets_by_normal_similarity.h:63