diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index a105f3e4b..317816084 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -557,23 +557,21 @@ Vec3d model_coord(const ModelInstance& object, const Vec3f& mesh_coord) { return object.transform_vector(mesh_coord.cast()); } -double ray_mesh_intersect(const Vec3d& s, - const Vec3d& dir, - const EigenMesh3D& m); - -double pinhead_mesh_intersect(const Vec3d& jp, - const Vec3d& dir, - double r1, - double r2, - const EigenMesh3D& m); +inline double ray_mesh_intersect(const Vec3d& s, + const Vec3d& dir, + const EigenMesh3D& m) +{ + return m.query_ray_hit(s, dir); +} // Wrapper only inline double pinhead_mesh_intersect(const Head& head, const EigenMesh3D& m) { - return pinhead_mesh_intersect(head.junction_point(), - head.dir, - head.r_pin_mm, - head.r_back_mm, - m); +// return pinhead_mesh_intersect(head.junction_point(), +// head.dir, +// head.r_pin_mm, +// head.r_back_mm, +// m); + return 0; } PointSet normals(const PointSet& points, const EigenMesh3D& mesh, diff --git a/src/libslic3r/SLA/SLASupportTreeIGL.cpp b/src/libslic3r/SLA/SLASupportTreeIGL.cpp index cacd1ceaa..22dfeb393 100644 --- a/src/libslic3r/SLA/SLASupportTreeIGL.cpp +++ b/src/libslic3r/SLA/SLASupportTreeIGL.cpp @@ -146,9 +146,17 @@ EigenMesh3D &EigenMesh3D::operator=(const EigenMesh3D &other) double EigenMesh3D::query_ray_hit(const Vec3d &s, const Vec3d &dir) const { - return 0; + igl::Hit hit; + hit.t = std::numeric_limits::infinity(); + m_aabb->intersect_ray(m_V, m_F, s, dir, hit); + + return double(hit.t); } +/* **************************************************************************** + * Misc functions + * ****************************************************************************/ + bool point_on_edge(const Vec3d& p, const Vec3d& e1, const Vec3d& e2, double eps = 0.05) { @@ -294,30 +302,6 @@ PointSet normals(const PointSet& points, const EigenMesh3D& mesh, return ret; } -double ray_mesh_intersect(const Vec3d& s, - const Vec3d& dir, - const EigenMesh3D& m) -{ - igl::Hit hit; - hit.t = std::numeric_limits::infinity(); - - // Fck: this does not use any kind of spatial index acceleration... - igl::ray_mesh_intersect(s, dir, m.V(), m.F(), hit); - return double(hit.t); -} - -// An enhanced version of ray_mesh_intersect for the pinheads. This will shoot -// multiple rays to detect collisions more accurately. -double pinhead_mesh_intersect(const Vec3d& jp, - const Vec3d& dir, - double r1, - double r2, - const EigenMesh3D& m) -{ - - return 0; -} - // Clustering a set of points by the given criteria ClusteredPoints cluster( const sla::PointSet& points,