Cast rays from camera to scene Used for find hit point on model volume under mouse cursor. More...
#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/RaycastManager.hpp>
Classes | |
| class | ISkip |
| Interface for identify allowed volumes to cast rays. More... | |
| struct | SurfacePoint |
| struct | Hit |
| struct | ClosePoint |
| class | SkipVolume |
| class | AllowVolumes |
Public Types | |
| using | Mesh = std::pair<size_t, std::unique_ptr<AABBMesh> > |
| using | Meshes = std::vector<Mesh> |
| using | TrKey = std::pair<size_t, size_t> |
| using | TrItem = std::pair<TrKey, Transform3d> |
| using | TrItems = std::vector<TrItem> |
Public Member Functions | |
| void | actualize (const ModelObject &object, const ISkip *skip=nullptr, Meshes *meshes=nullptr) |
| Actualize raycasters + transformation Detection of removed object Detection of removed instance Detection of removed volume. | |
| void | actualize (const ModelInstance &instance, const ISkip *skip=nullptr, Meshes *meshes=nullptr) |
| std::optional< Hit > | first_hit (const Vec3d &point, const Vec3d &direction, const ISkip *skip=nullptr) const |
| Unproject on mesh and return closest hit to point in given direction. | |
| std::optional< Hit > | closest_hit (const Vec3d &point, const Vec3d &direction, const ISkip *skip=nullptr) const |
| Unproject Ray(point direction) on mesh to find closest hit of surface in given direction NOTE: It inspect also oposit direction of ray !! | |
| std::optional< ClosePoint > | closest (const Vec3d &point, const ISkip *skip=nullptr) const |
| Search of closest point. | |
| Transform3d | get_transformation (const TrKey &tr_key) const |
| Getter on transformation from hitted volume to world. | |
Private Attributes | |
| Meshes | m_meshes |
| TrItems | m_transformations |
Cast rays from camera to scene Used for find hit point on model volume under mouse cursor.
| struct Slic3r::GUI::RaycastManager::SurfacePoint |
| Class Members | ||
|---|---|---|
| typedef Matrix< T, 3, 1, DontAlign > | Vec3 Eigen::Matrix<T, 3, 1, Eigen::DontAlign> | |
| Class Members | ||
|---|---|---|
| Vec3 | normal = Vec3::UnitZ() | |
| Vec3 | position = Vec3::Zero() | |
| struct Slic3r::GUI::RaycastManager::ClosePoint |
| using Slic3r::GUI::RaycastManager::Mesh = std::pair<size_t, std::unique_ptr<AABBMesh> > |
| using Slic3r::GUI::RaycastManager::Meshes = std::vector<Mesh> |
| using Slic3r::GUI::RaycastManager::TrItem = std::pair<TrKey, Transform3d> |
| using Slic3r::GUI::RaycastManager::TrItems = std::vector<TrItem> |
| using Slic3r::GUI::RaycastManager::TrKey = std::pair<size_t, size_t> |
| void RaycastManager::actualize | ( | const ModelInstance & | instance, |
| const ISkip * | skip = nullptr, | ||
| Meshes * | meshes = nullptr ) |
References actualize(), Slic3r::ModelInstance::get_matrix(), Slic3r::ModelInstance::get_object(), m_meshes, m_transformations, Slic3r::GUI::RaycastManager::ISkip::skip(), and Slic3r::ModelObject::volumes.
| void RaycastManager::actualize | ( | const ModelObject & | object, |
| const ISkip * | skip = nullptr, | ||
| Meshes * | meshes = nullptr ) |
Actualize raycasters + transformation Detection of removed object Detection of removed instance Detection of removed volume.
| object | Model representation |
| skip | Condifiton for skip actualization |
| meshes | Speed up for already created AABBtrees |
References actualize(), m_meshes, m_transformations, and Slic3r::GUI::RaycastManager::ISkip::skip().
Referenced by actualize(), actualize(), Slic3r::GUI::calc_distance(), Slic3r::GUI::calc_surface_offset(), anonymous_namespace{EmbossJob.cpp}::start_create_volume_on_surface_job(), and anonymous_namespace{SurfaceDrag.cpp}::start_dragging().
| std::optional< RaycastManager::ClosePoint > RaycastManager::closest | ( | const Vec3d & | point, |
| const ISkip * | skip = nullptr ) const |
Search of closest point.
| point | Point |
| skip | Define which caster will be skipped, null mean no skip |
References closest(), m_meshes, m_transformations, Slic3r::GUI::RaycastManager::ISkip::skip(), and Slic3r::AABBMesh::squared_distance().
Referenced by Slic3r::GUI::calc_surface_offset(), closest(), and closest_hit().
| std::optional< RaycastManager::Hit > RaycastManager::closest_hit | ( | const Vec3d & | point, |
| const Vec3d & | direction, | ||
| const ISkip * | skip = nullptr ) const |
Unproject Ray(point direction) on mesh to find closest hit of surface in given direction NOTE: It inspect also oposit direction of ray !!
| point | Start point for ray |
| direction | Direction of ray, orientation doesn't matter, both are used |
| skip | Define which caster will be skipped, null mean no skip |
References closest(), Slic3r::diff(), m_meshes, m_transformations, Slic3r::AABBMesh::query_ray_hits(), and Slic3r::GUI::RaycastManager::ISkip::skip().
Referenced by Slic3r::GUI::calc_distance(), and Slic3r::GUI::calc_surface_offset().
| std::optional< RaycastManager::Hit > RaycastManager::first_hit | ( | const Vec3d & | point, |
| const Vec3d & | direction, | ||
| const ISkip * | skip = nullptr ) const |
Unproject on mesh and return closest hit to point in given direction.
| point | Position in space |
| direction | Casted ray direction |
| skip | Define which caster will be skipped, null mean no skip |
References Slic3r::cross(), Slic3r::AABBMesh::hit_result::face(), Slic3r::has_reflection(), Slic3r::AABBMesh::indices(), m_meshes, m_transformations, Slic3r::AABBMesh::hit_result::position(), Slic3r::AABBMesh::query_ray_hits(), Slic3r::GUI::RaycastManager::ISkip::skip(), and Slic3r::AABBMesh::vertices().
Referenced by Slic3r::GUI::ray_from_camera().
| Slic3r::Transform3d RaycastManager::get_transformation | ( | const TrKey & | tr_key | ) | const |
Getter on transformation from hitted volume to world.
| tr_key | Define transformation |
References m_transformations.
Referenced by Slic3r::GUI::calc_distance(), and Slic3r::GUI::calc_surface_offset().
|
private |
Referenced by actualize(), actualize(), closest(), closest_hit(), and first_hit().
|
private |
Referenced by actualize(), actualize(), closest(), closest_hit(), first_hit(), and get_transformation().