|
Lagrange
|
Raycasting operations. More...
Classes | |
| struct | ClosestPointResult |
| class | EmbreeRayCaster |
| A wrapper for Embree's raycasting API to compute ray intersections with (instances of) meshes. More... | |
| class | RaycasterMesh |
| class | RaycasterMeshDerived |
Enumerations | |
| enum | RayCasterType { EMBREE_DEFAULT = 1 , EMBREE_DYNAMIC = 2 , EMBREE_ROBUST = 4 , EMBREE_COMPACT = 8 } |
| enum | RayCasterQuality { BUILD_QUALITY_LOW , BUILD_QUALITY_MEDIUM , BUILD_QUALITY_HIGH } |
| enum class | ProjectMode { CLOSEST_VERTEX , CLOSEST_POINT , RAY_CASTING } |
| Main projection mode. More... | |
| enum class | CastMode { ONE_WAY , BOTH_WAYS } |
| Ray-casting mode. More... | |
| enum class | WrapMode { CONSTANT , CLOSEST_VERTEX , CLOSEST_POINT } |
| Wraping mode for vertices without a hit. More... | |
Functions | |
| template<typename Scalar > | |
| std::unique_ptr< EmbreeRayCaster< Scalar > > | create_ray_caster (RayCasterType engine, RayCasterQuality quality=BUILD_QUALITY_LOW) |
| template<typename Scalar > | |
| bool | embree_closest_point (RTCPointQueryFunctionArguments *args) |
| template<typename SourceMeshType , typename TargetMeshType , typename DerivedVector = Eigen::Matrix<ScalarOf<SourceMeshType>, 3, 1>, typename DefaultScalar = typename SourceMeshType::Scalar> | |
| 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. More... | |
| template<typename SourceMeshType , typename TargetMeshType > | |
| 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 the input mesh. More... | |
| template<typename SourceMeshType , typename TargetMeshType , typename DerivedVector , typename DefaultScalar = typename SourceMeshType::Scalar> | |
| 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 direction, and interpolating surface values from facet corners of the source mesh. More... | |
| const std::map< std::string, ProjectMode > & | project_modes () |
| const std::map< std::string, CastMode > & | cast_modes () |
| const std::map< std::string, WrapMode > & | wrap_modes () |
| template<typename ParticleDataType , typename MeshType , typename DefaultScalar = typename ParticleDataType::value_type::Scalar, typename MatrixType = typename Eigen::Matrix<DefaultScalar, 4, 4>, typename VectorType = typename Eigen::Matrix<DefaultScalar, 3, 1>> | |
| void | project_particles_directional (const ParticleDataType &origins, const MeshType &mesh_proj_on, const VectorType &direction, ParticleDataType &out_origins, ParticleDataType &out_normals, const MatrixType &parent_transforms=MatrixType::Identity(), EmbreeRayCaster< ScalarOf< MeshType > > *ray_caster=nullptr, bool has_normals=true) |
| Project particles (a particle contains origin and tangent info) to another mesh, by projecting their positions along a prescribed direction. More... | |
Raycasting operations.
| enum RayCasterType |
| enum RayCasterQuality |
|
strong |
|
strong |
|
strong |
| 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.
Different projection modes can be prescribed.
| [in] | source | Source mesh. |
| [in,out] | target | Target mesh to be modified. |
| [in] | names | Name of the vertex attributes to transfer. |
| [in] | project_mode | Projection mode to choose from. |
| [in] | direction | Raycasting direction to project attributes. |
| [in] | cast_mode | Whether to project forward along the ray, or to project along the whole ray (both forward and backward). |
| [in] | wrap_mode | Wrapping mode for values where there is no hit. |
| [in] | default_value | Scalar used to fill attributes in CONSTANT wrapping mode. |
| [in] | user_callback | Optional user callback that can be used to set attribute values depending on whether there is a hit or not. |
| [in,out] | ray_caster | If provided, the use ray_caster to perform the queries instead. The source mesh will assume to have been added to ray_caster in advance, and this function will not try to add it. This allows to use a different ray caster than the one computed by this function, and allows to nest function calls. |
| [in] | skip_vertex | If provided, whether to skip assignment for a target vertex or not. This can be used for partial assignment (e.g. to only set boundary vertices of a mesh). |
| SourceMeshType | Source mesh type. |
| TargetMeshType | Target mesh type. |
| DerivedVector | Vector type for the direction. |
| DefaultScalar | Scalar type used to fill attributes. |
| 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 the input mesh.
Values are linearly interpolated from the face corners.
| [in] | source | Source mesh. |
| [in,out] | target | Target mesh to be modified. |
| [in] | names | Name of the vertex attributes to transfer. |
| [in,out] | ray_caster | If provided, the use ray_caster to perform the queries instead. The source mesh will assume to have been added to ray_caster in advance, and this function will not try to add it. This allows to use a different ray caster than the one computed by this function, and allows to nest function calls. |
| [in] | skip_vertex | If provided, whether to skip assignment for a target vertex or not. This can be used for partial assignment (e.g. to only set boundary vertices of a mesh). |
| SourceMeshType | Source mesh type. |
| TargetMeshType | Target mesh type. |
| 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 direction, and interpolating surface values from facet corners of the source mesh.
| [in] | source | Source mesh. |
| [in,out] | target | Target mesh to be modified. |
| [in] | names | Name of the vertex attributes to transfer. |
| [in] | direction | Raycasting direction to project attributes. |
| [in] | cast_mode | Whether to project forward along the ray, or to project along the whole ray (both forward and backward). |
| [in] | wrap_mode | Wrapping mode for values where there is no hit. |
| [in] | default_value | Scalar used to fill attributes in CONSTANT wrapping mode. |
| [in] | user_callback | Optional user callback that can be used to set attribute values depending on whether there is a hit or not. |
| [in,out] | ray_caster | If provided, the use ray_caster to perform the queries instead. The source mesh will assume to have been added to ray_caster in advance, and this function will not try to add it. This allows to use a different ray caster than the one computed by this function, and allows to nest function calls. |
| [in] | skip_vertex | If provided, whether to skip assignment for a target vertex or not. This can be used for partial assignment (e.g. to only set boundary vertices of a mesh). |
| SourceMeshType | Source mesh type. |
| TargetMeshType | Target mesh type. |
| DerivedVector | Vector type for the direction. |
| DefaultScalar | Scalar type used to fill attributes. |
| void project_particles_directional | ( | const ParticleDataType & | origins, |
| const MeshType & | mesh_proj_on, | ||
| const VectorType & | direction, | ||
| ParticleDataType & | out_origins, | ||
| ParticleDataType & | out_normals, | ||
| const MatrixType & | parent_transforms = MatrixType::Identity(), |
||
| EmbreeRayCaster< ScalarOf< MeshType > > * | ray_caster = nullptr, |
||
| bool | has_normals = true |
||
| ) |
Project particles (a particle contains origin and tangent info) to another mesh, by projecting their positions along a prescribed direction.
The returned results are particles whose transform is recorded in the local coordinate.
Assuming the projection transformation is P and the cumulated parents transformation
is C, The matrix M that transforms local to world coordinates is given by:
M = P * C
= C * (C^-1 * P * C)
Where the matrix in parenthesis is the new axis system matrix after projection:
P' = C^-1 * P * C
We compute P * C, and then deduce P'
| [in] | origins | Origin of the particles. |
| [in] | mesh_proj_on | Mesh to be projected on. |
| [in] | direction | Raycasting direction to project attributes. |
| [out] | out_origins | Output origin of the particles. |
| [out] | out_normals | Output normal of the polygon at intersections. |
| [in] | parent_transforms | Cumulated parent transforms applied on the particles |
| [in,out] | ray_caster | If provided, the use ray_caster to perform the queries instead. The target mesh will assume to have been added to ray_caster in advance, and this function will not try to add it. This allows to use a different ray caster than the one computed by this function, and allows to nest function calls. |
| [in] | has_normals | Whether to compute and output normals |
| ParticleDataType | Particle data vector type. |
| MeshType | Mesh type. |
| DefaultScalar | Scalar type used in computation. |
| MatrixType | Matrix type for the transform. |
| VectorType | Vector type for the direction. |