14#include <lagrange/bvh/project_attributes_closest_vertex.h>
15#include <lagrange/legacy/inline.h>
16#include <lagrange/raycasting/Options.h>
17#include <lagrange/raycasting/legacy/project_attributes_closest_point.h>
18#include <lagrange/raycasting/legacy/project_attributes_directional.h>
54 typename SourceMeshType,
55 typename TargetMeshType,
56 typename DerivedVector = Eigen::Matrix<ScalarOf<SourceMeshType>, 3, 1>,
57 typename DefaultScalar =
typename SourceMeshType::Scalar>
58void project_attributes(
59 const SourceMeshType& source,
60 TargetMeshType& target,
61 const std::vector<std::string>& names,
63 const Eigen::MatrixBase<DerivedVector>& direction = DerivedVector(0, 0, 1),
66 DefaultScalar default_value = DefaultScalar(0),
67 std::function<
void(
typename TargetMeshType::Index,
bool)> user_callback =
nullptr,
69 std::function<
bool(IndexOf<TargetMeshType>)> skip_vertex =
nullptr)
71 static_assert(MeshTrait<SourceMeshType>::is_mesh(),
"Input type is not Mesh");
72 static_assert(MeshTrait<TargetMeshType>::is_mesh(),
"Output type is not Mesh");
75 switch (project_mode) {
77 ::lagrange::bvh::project_attributes_closest_vertex(source, target, names, skip_vertex);
80 project_attributes_closest_point(source, target, names, ray_caster, skip_vertex);
83 project_attributes_directional(
95 default:
throw std::runtime_error(
"Not implemented");
A wrapper for Embree's raycasting API to compute ray intersections with (instances of) meshes.
Definition EmbreeRayCaster.h:59
#define la_runtime_assert(...)
Runtime assertion check.
Definition assert.h:174
Raycasting operations.
Definition ClosestPointResult.h:22
ProjectMode
Main projection mode.
Definition Options.h:30
@ RayCasting
Copy attribute by projecting along a prescribed direction on the source mesh.
Definition Options.h:36
@ ClosestPoint
Interpolate attribute from the closest point on the source mesh.
Definition Options.h:35
@ ClosestVertex
Copy attribute from the closest vertex on the source mesh.
Definition Options.h:34
FallbackMode
Fallback mode for vertices without a hit.
Definition Options.h:49
@ Constant
Fill with a constant value (defaults to 0).
Definition Options.h:53
CastMode
Ray-casting mode.
Definition Options.h:41
@ BothWays
Cast a ray both forward and backward in the prescribed direction.
Definition Options.h:45
Main namespace for Lagrange.