Lagrange
map_attributes.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/AttributeFwd.h>
15#include <lagrange/SurfaceMesh.h>
16#include <lagrange/types/MappingPolicy.h>
17#include <lagrange/utils/span.h>
18
19namespace lagrange::internal {
20
23{
26
29
32};
33
34
57template <AttributeElement element, typename Scalar, typename Index>
59 const SurfaceMesh<Scalar, Index>& source_mesh,
60 SurfaceMesh<Scalar, Index>& target_mesh,
61 span<const Index> mapping_data,
62 span<const Index> mapping_offsets = {},
63 const MapAttributesOptions& options = {});
64
65} // namespace lagrange::internal
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition: span.h:27
nullptr_t, size_t, ptrdiff_t basic_ostream bad_weak_ptr extent, remove_extent, is_array,...
Definition: attribute_string_utils.h:21
void map_attributes(const SurfaceMesh< Scalar, Index > &source_mesh, SurfaceMesh< Scalar, Index > &target_mesh, span< const Index > mapping_data, span< const Index > mapping_offsets={}, const MapAttributesOptions &options={})
Map attributes from the source mesh to the target mesh.
Definition: map_attributes.cpp:26
MappingPolicy
Mapping policy control the behavior when two or more elements are mapped into the same output element...
Definition: MappingPolicy.h:21
@ KeepFirst
Keep the value of the first elements.
@ Average
Take the average of all involved elements.
Attribute mapping options.
Definition: map_attributes.h:23
MappingPolicy collision_policy_integral
Collision policy for integral valued attributes.
Definition: map_attributes.h:28
span< AttributeId > selected_attributes
Selected attribute ids. If empty, treat all attributes as selected.
Definition: map_attributes.h:31
MappingPolicy collision_policy_float
Collision policy for float or double valued attributes.
Definition: map_attributes.h:25