Lagrange
chain_edges.h
1/*
2 * Copyright 2023 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/utils/span.h>
15
16#include <vector>
17
18namespace lagrange {
19
44
49{
51 bool output_edge_index = false;
52
55};
56
62template <typename Index>
64{
66 std::vector<std::vector<Index>> loops;
67
69 std::vector<std::vector<Index>> chains;
70};
71
93template <typename Index>
95 const span<const Index> edges,
96 const ChainEdgesOptions& options = {});
97
119template <typename Index>
120ChainEdgesResult<Index> chain_undirected_edges(
121 const span<const Index> edges,
122 const ChainEdgesOptions& options = {});
123
125
126} // namespace lagrange
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition: span.h:27
ChainEdgesResult< Index > chain_undirected_edges(const span< const Index > edges, const ChainEdgesOptions &options={})
Chain a set of undirected edges into loops and chains.
Definition: chain_edges.cpp:248
ChainEdgesResult< Index > chain_directed_edges(const span< const Index > edges, const ChainEdgesOptions &options={})
Chain a set of directed edges into loops and chains.
Definition: chain_edges.cpp:51
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Options for chain_directed_edges and chain_undirected_edges.
Definition: chain_edges.h:49
bool close_loop_with_identical_vertices
If true, the first and last vertices of a loop will be identical.
Definition: chain_edges.h:54
bool output_edge_index
If true, the output will be a list of edges, otherwise a list of vertices.
Definition: chain_edges.h:51
Result struct holding the loops and chains extracted from a set of edges.
Definition: chain_edges.h:64
std::vector< std::vector< Index > > chains
The extracted chains.
Definition: chain_edges.h:69
std::vector< std::vector< Index > > loops
The extracted loops.
Definition: chain_edges.h:66