This commit is contained in:
tamasmeszaros 2019-01-15 11:09:00 +01:00
parent 7fa430c56d
commit 8391e73416
2 changed files with 21 additions and 39 deletions

View File

@ -557,23 +557,21 @@ Vec3d model_coord(const ModelInstance& object, const Vec3f& mesh_coord) {
return object.transform_vector(mesh_coord.cast<double>()); return object.transform_vector(mesh_coord.cast<double>());
} }
double ray_mesh_intersect(const Vec3d& s, inline double ray_mesh_intersect(const Vec3d& s,
const Vec3d& dir, const Vec3d& dir,
const EigenMesh3D& m); const EigenMesh3D& m)
{
double pinhead_mesh_intersect(const Vec3d& jp, return m.query_ray_hit(s, dir);
const Vec3d& dir, }
double r1,
double r2,
const EigenMesh3D& m);
// Wrapper only // Wrapper only
inline double pinhead_mesh_intersect(const Head& head, const EigenMesh3D& m) { inline double pinhead_mesh_intersect(const Head& head, const EigenMesh3D& m) {
return pinhead_mesh_intersect(head.junction_point(), // return pinhead_mesh_intersect(head.junction_point(),
head.dir, // head.dir,
head.r_pin_mm, // head.r_pin_mm,
head.r_back_mm, // head.r_back_mm,
m); // m);
return 0;
} }
PointSet normals(const PointSet& points, const EigenMesh3D& mesh, PointSet normals(const PointSet& points, const EigenMesh3D& mesh,

View File

@ -146,9 +146,17 @@ EigenMesh3D &EigenMesh3D::operator=(const EigenMesh3D &other)
double EigenMesh3D::query_ray_hit(const Vec3d &s, const Vec3d &dir) const double EigenMesh3D::query_ray_hit(const Vec3d &s, const Vec3d &dir) const
{ {
return 0; igl::Hit hit;
hit.t = std::numeric_limits<float>::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, bool point_on_edge(const Vec3d& p, const Vec3d& e1, const Vec3d& e2,
double eps = 0.05) double eps = 0.05)
{ {
@ -294,30 +302,6 @@ PointSet normals(const PointSet& points, const EigenMesh3D& mesh,
return ret; return ret;
} }
double ray_mesh_intersect(const Vec3d& s,
const Vec3d& dir,
const EigenMesh3D& m)
{
igl::Hit hit;
hit.t = std::numeric_limits<float>::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 // Clustering a set of points by the given criteria
ClusteredPoints cluster( ClusteredPoints cluster(
const sla::PointSet& points, const sla::PointSet& points,