Lagrange
Loading...
Searching...
No Matches
prepare_attribute_ids.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
13#include <lagrange/raycasting/Options.h>
14
15namespace lagrange::raycasting {
16
17template <typename Scalar, typename Index>
18std::vector<AttributeId> prepare_attribute_ids(
19 const SurfaceMesh<Scalar, Index>& source,
20 const ProjectCommonOptions& options)
21{
22 // Build the full list of attribute ids to project.
23 std::vector<AttributeId> attribute_ids = options.attribute_ids;
24 if (options.project_vertices) {
25 attribute_ids.push_back(source.attr_id_vertex_to_position());
26 }
27 // Remove duplicates, if any
28 std::sort(attribute_ids.begin(), attribute_ids.end());
29 attribute_ids.erase(
30 std::unique(attribute_ids.begin(), attribute_ids.end()),
31 attribute_ids.end());
32 return attribute_ids;
33}
34
35} // namespace lagrange::raycasting
AttributeId attr_id_vertex_to_position() const
Attribute id for vertex -> positions.
Definition SurfaceMesh.h:2052
Raycasting operations.
Definition ClosestPointResult.h:22
Common options for projection functions.
Definition Options.h:117