Lagrange
Loading...
Searching...
No Matches
prepare_ray_caster.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/RayCaster.h>
14
15namespace lagrange::raycasting {
16
17template <typename Scalar, typename Index>
18std::unique_ptr<RayCaster> prepare_ray_caster(
19 const SurfaceMesh<Scalar, Index>& source,
20 const RayCaster* ray_caster)
21{
22 std::unique_ptr<RayCaster> engine;
23 if (!ray_caster) {
24 engine = std::make_unique<RayCaster>(SceneFlags::Robust, BuildQuality::High);
25 SurfaceMesh<Scalar, Index> source_copy = source;
26 engine->add_mesh(std::move(source_copy));
27 engine->commit_updates();
28 ray_caster = engine.get();
29 }
30 return engine;
31}
32
33} // namespace lagrange::raycasting
A ray caster built on top of Embree that operates directly on SurfaceMesh and SimpleScene objects.
Definition RayCaster.h:190
Raycasting operations.
Definition ClosestPointResult.h:22
@ Robust
Use a more robust BVH traversal algorithm that is slower but less likely to miss hits due to numerica...
Definition RayCaster.h:151
@ High
Slowest build time, highest BVH quality.
Definition RayCaster.h:169