Lagrange
Loading...
Searching...
No Matches
stitch_mesh.h
1/*
2 * Copyright 2024 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
13#pragma once
14
15#include <lagrange/find_matching_attributes.h>
16#include <lagrange/map_attribute.h>
17#include <lagrange/mesh_cleanup/remove_duplicate_vertices.h>
18
19namespace lagrange::io {
20
21template <typename Scalar, typename Index>
22void stitch_mesh(SurfaceMesh<Scalar, Index>& mesh)
23{
24 // Convert vertex attributes to indexed before stitching anything
27 }
28
29 // Now we can stitch vertices
30 RemoveDuplicateVerticesOptions rm_opts;
31 rm_opts.boundary_only = true;
32 remove_duplicate_vertices(mesh, rm_opts);
33}
34
35} // namespace lagrange::io
AttributeId map_attribute_in_place(SurfaceMesh< Scalar, Index > &mesh, AttributeId id, AttributeElement new_element)
Map attribute values to a different element type.
Definition map_attribute.cpp:270
@ Indexed
Indexed mesh attributes.
Definition AttributeFwd.h:45
@ Vertex
Per-vertex mesh attributes.
Definition AttributeFwd.h:28
std::vector< AttributeId > find_matching_attributes(const SurfaceMesh< Scalar, Index > &mesh, const AttributeMatcher &options)
Finds all attributes with the specified usage/element type/number of channels.
Definition find_matching_attributes.cpp:80
Mesh input/output.
Definition detect_file_format.h:18
void remove_duplicate_vertices(SurfaceMesh< Scalar, Index > &mesh, const RemoveDuplicateVerticesOptions &options={})
Removes duplicate vertices from a mesh.
Definition remove_duplicate_vertices.cpp:33