14#include <lagrange/bvh/project_attributes_closest_vertex.h>
15#include <lagrange/raycasting/project_attributes_closest_point.h>
16#include <lagrange/raycasting/project_attributes_directional.h>
17#include <lagrange/raycasting/project_options.h>
51 typename SourceMeshType,
52 typename TargetMeshType,
53 typename DerivedVector = Eigen::Matrix<ScalarOf<SourceMeshType>, 3, 1>,
54 typename DefaultScalar =
typename SourceMeshType::Scalar>
56 const SourceMeshType& source,
57 TargetMeshType& target,
58 const std::vector<std::string>& names,
60 const Eigen::MatrixBase<DerivedVector>& direction = DerivedVector(0, 0, 1),
63 DefaultScalar default_value = DefaultScalar(0),
64 std::function<
void(
typename TargetMeshType::Index,
bool)> user_callback =
nullptr,
66 std::function<
bool(IndexOf<TargetMeshType>)> skip_vertex =
nullptr)
68 static_assert(MeshTrait<SourceMeshType>::is_mesh(),
"Input type is not Mesh");
69 static_assert(MeshTrait<TargetMeshType>::is_mesh(),
"Output type is not Mesh");
72 switch (project_mode) {
74 ::lagrange::bvh::project_attributes_closest_vertex(source, target, names, skip_vertex);
92 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:47
#define la_runtime_assert(...)
Runtime assertion check.
Definition assert.h:174
Raycasting operations.
Definition ClosestPointResult.h:21
ProjectMode
Main projection mode.
Definition project_options.h:21
@ CLOSEST_POINT
Interpolate attribute from the closest point on the source mesh.
Definition project_options.h:23
@ RAY_CASTING
Copy attribute by projecting along a prescribed direction on the source mesh.
Definition project_options.h:24
@ CLOSEST_VERTEX
Copy attribute from the closest vertex on the source mesh.
Definition project_options.h:22
CastMode
Ray-casting mode.
Definition project_options.h:28
@ BOTH_WAYS
Cast a ray both forward and backward in the prescribed direction.
Definition project_options.h:30
WrapMode
Wraping mode for vertices without a hit.
Definition project_options.h:34
@ CONSTANT
Fill with a constant value (defaults to 0).
Definition project_options.h:35
void project_attributes_directional(const SourceMeshType &source, TargetMeshType &target, const std::vector< std::string > &names, const Eigen::MatrixBase< DerivedVector > &direction, CastMode cast_mode=CastMode::BOTH_WAYS, WrapMode wrap_mode=WrapMode::CONSTANT, DefaultScalar default_value=DefaultScalar(0), std::function< void(typename TargetMeshType::Index, bool)> user_callback=nullptr, EmbreeRayCaster< ScalarOf< SourceMeshType > > *ray_caster=nullptr, std::function< bool(IndexOf< TargetMeshType >)> skip_vertex=nullptr)
Project vertex attributes from one mesh to another, by projecting target vertices along a prescribed ...
Definition project_attributes_directional.h:74
void project_attributes_closest_point(const SourceMeshType &source, TargetMeshType &target, const std::vector< std::string > &names, EmbreeRayCaster< ScalarOf< SourceMeshType > > *ray_caster=nullptr, std::function< bool(IndexOf< TargetMeshType >)> skip_vertex=nullptr)
Project vertex attributes from one mesh to another, by copying attributes from the closest point on t...
Definition project_attributes_closest_point.h:49
void project_attributes(const SourceMeshType &source, TargetMeshType &target, const std::vector< std::string > &names, ProjectMode project_mode, const Eigen::MatrixBase< DerivedVector > &direction=DerivedVector(0, 0, 1), CastMode cast_mode=CastMode::BOTH_WAYS, WrapMode wrap_mode=WrapMode::CONSTANT, DefaultScalar default_value=DefaultScalar(0), std::function< void(typename TargetMeshType::Index, bool)> user_callback=nullptr, EmbreeRayCaster< ScalarOf< SourceMeshType > > *ray_caster=nullptr, std::function< bool(IndexOf< TargetMeshType >)> skip_vertex=nullptr)
Project vertex attributes from one mesh to another.
Definition project_attributes.h:55
Main namespace for Lagrange.