From f3079c75db9fd5d097adb1eb1f1c1b9c0d2b1e43 Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Thu, 8 Apr 2021 17:34:06 +0100 Subject: [PATCH 1/9] [sofaBaseTopology] add computeRestTriangleBarycoef method --- .../SofaBaseTopology/TriangleSetGeometryAlgorithms.h | 5 +++++ .../TriangleSetGeometryAlgorithms.inl | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h index 8e81d81fc95..522da2b0747 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h @@ -121,6 +121,11 @@ class TriangleSetGeometryAlgorithms : public EdgeSetGeometryAlgorithms computeTriangleBarycoefs(const TriangleID ind_t, const sofa::defaulttype::Vec<3,double> &p) const; + /** \brief Computes barycentric coefficients of point p in initial triangle (a,b,c) indexed by ind_t + * + */ + sofa::helper::vector< double > computeRestTriangleBarycoefs(const TriangleID ind_t, const sofa::defaulttype::Vec<3, double>& p) const; + /** \brief Computes barycentric coefficients of point p in triangle whose vertices are indexed by (ind_p1,ind_p2,ind_p3) * */ diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 3355bccdca5..9985a78a865 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -510,7 +510,17 @@ sofa::helper::vector< double > TriangleSetGeometryAlgorithms< DataTypes >::compu const sofa::defaulttype::Vec<3,double> &p) const { const Triangle &t=this->m_topology->getTriangle(ind_t); - return compute3PointsBarycoefs(p, t[0], t[1], t[2]); + return compute3PointsBarycoefs(p, t[0], t[1], t[2],false); +} + +// barycentric coefficients of point p in initial triangle (a,b,c) indexed by ind_t +template +sofa::helper::vector< double > TriangleSetGeometryAlgorithms< DataTypes >::computeRestTriangleBarycoefs( + const TriangleID ind_t, + const sofa::defaulttype::Vec<3, double>& p) const +{ + const Triangle& t = this->m_topology->getTriangle(ind_t); + return compute3PointsBarycoefs(p, t[0], t[1], t[2], true); } // barycentric coefficients of point p in triangle whose vertices are indexed by (ind_p1,ind_p2,ind_p3) From 510836393827eb39897184a02bf2b4c4eca3aea2 Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Tue, 13 Apr 2021 15:02:38 +0100 Subject: [PATCH 2/9] [TearingEngine] save --- .../EdgeSetGeometryAlgorithms.h | 5 ++ .../EdgeSetGeometryAlgorithms.inl | 63 +++++++++++++++++++ .../TriangleSetGeometryAlgorithms.inl | 3 + 3 files changed, 71 insertions(+) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h index 81d5d8ad57c..4f2b7c05680 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h @@ -157,6 +157,11 @@ class EdgeSetGeometryAlgorithms : public PointSetGeometryAlgorithms /** return a pointer to the container of cubature points */ NumericalIntegrationDescriptor &getEdgeNumericalIntegrationDescriptor(); + bool computeEdgeSegmentIntersection(EdgeID edgeID, + const sofa::defaulttype::Vec<3,double>& a, + const sofa::defaulttype::Vec<3, double>& b, + double &baryCoef); + protected: Data showEdgeIndices; ///< Debug : view Edge indices. Data d_drawEdges; ///< if true, draw the edges in the topology. diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl index c500324cb41..95935f71958 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl @@ -899,5 +899,68 @@ void EdgeSetGeometryAlgorithms::initPointAdded(PointID index, const c } } +template +bool EdgeSetGeometryAlgorithms::computeEdgeSegmentIntersection(EdgeID edgeID, + const sofa::defaulttype::Vec<3, double>& a, + const sofa::defaulttype::Vec<3, double>& b, + double &baryCoef) + //intersection=edge[0]+baryCoef*(edge[1]-edge[0]) +{ + double EPS = 1e-05; + bool is_intersect = false; + + const Edge& e = this->m_topology->getEdge(edgeID); + const VecCoord& p = (this->object->read(core::ConstVecCoordId::position())->getValue()); + const typename DataTypes::Coord& c0 = p[e[0]]; + const typename DataTypes::Coord& c1 = p[e[1]]; + //sofa::defaulttype::Vec<3, Real> p0 = defaulttype::Vector3(DataTypes::getCPos(p[e[0]])); + //sofa::defaulttype::Vec<3, Real> p1 = defaulttype::Vector3(DataTypes::getCPos(p[e[1]])); + + sofa::defaulttype::Vec<3, Real> p0; + p0[0] = (Real)(c0[0]); + p0[1] = (Real)(c0[1]); + p0[2] = (Real)(c0[2]); + sofa::defaulttype::Vec<3, Real> p1; + p1[0] = (Real)(c1[0]); + p1[1] = (Real)(c1[1]); + p1[2] = (Real)(c1[2]); + + sofa::defaulttype::Vec<3, Real> pa; + pa[0] = (Real)(a[0]); + pa[1] = (Real)(a[1]); + pa[2] = (Real)(a[2]); + sofa::defaulttype::Vec<3, Real> pb; + pb[0] = (Real)(b[0]); + pb[1] = (Real)(b[1]); + pb[2] = (Real)(b[2]); + + + + sofa::defaulttype::Vec<3, Real> v_0a = p0 - pa; + sofa::defaulttype::Vec<3, Real> v_ba = pb - pa; + sofa::defaulttype::Vec<3, Real> v_10 = p1 - p0; + + double d0aba, dba10, d0a10, dbaba, d1010; + + d0aba = v_0a * v_ba; + dba10 = v_ba * v_ba; + d0a10 = v_0a * v_10; + dbaba = v_ba * v_ba; + d1010 = v_10 * v_10; + + double deno, num; + deno = d1010 * dbaba - dba10 * dba10; + if (!abs(deno) <= EPS) + { + num = d0aba * dba10 - d0a10 * dbaba; + + //baryCoef= (d0aba + dba10 * (num / deno)) / dbaba; + baryCoef = num / deno; + //if (baryCoef >= 0.0 && baryCoef <= 1.0) + is_intersect = true; + } + return is_intersect; +} + } //namespace sofa::component::topology diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 9985a78a865..06b0247a029 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1481,6 +1481,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if((!is_initialized) || (coord_k > coord_kmin)) { + std::cout << "yo01" << std::endl; indices.clear(); indices.push_back(t[0]); indices.push_back(t[1]); @@ -1544,6 +1545,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if((!is_initialized) || (coord_k > coord_kmin)) { + std::cout << "yo12" << std::endl; indices.clear(); indices.push_back(t[1]); indices.push_back(t[2]); @@ -1606,6 +1608,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if((!is_initialized) || (coord_k > coord_kmin)) { + std::cout << "yo20" << std::endl; indices.clear(); indices.push_back(t[2]); indices.push_back(t[0]); From 8d913f65c3320bfe9a147c2995b67d2e51b74f53 Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Wed, 14 Apr 2021 09:45:50 +0100 Subject: [PATCH 3/9] [TearingEngine] begin setting up fracture path algo --- .../TriangleSetGeometryAlgorithms.h | 15 + .../TriangleSetGeometryAlgorithms.inl | 301 +++++++++++++++++- 2 files changed, 313 insertions(+), 3 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h index 522da2b0747..51c56b2a731 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h @@ -236,6 +236,21 @@ class TriangleSetGeometryAlgorithms : public EdgeSetGeometryAlgorithms &indices, double &baryCoef, double& coord_kmin) const; + /** \brief Computes the intersections of the vector from point a to point b and the triangle indexed by t + * + * @param a : first input point + * @param b : last input point + * @param ind_t : triangle indice + * @param indices : indices of edges (belonging to ind_t) crossed by the vecteur AB + * @param baryCoef : barycoef of intersections points on the edge + */ + bool computeSegmentTriangleIntersections(bool is_entered, + const sofa::defaulttype::Vec<3, double>& a, + const sofa::defaulttype::Vec<3, double>& b, + const TriangleID ind_t, + sofa::helper::vector& indices, + sofa::helper::vector& baryCoef) const; + /** \brief Computes the list of points (ind_edge,coord) intersected by the segment from point a to point b and the triangular mesh * */ diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 06b0247a029..3e8ade13a80 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1481,7 +1481,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if((!is_initialized) || (coord_k > coord_kmin)) { - std::cout << "yo01" << std::endl; indices.clear(); indices.push_back(t[0]); indices.push_back(t[1]); @@ -1545,7 +1544,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if((!is_initialized) || (coord_k > coord_kmin)) { - std::cout << "yo12" << std::endl; indices.clear(); indices.push_back(t[1]); indices.push_back(t[2]); @@ -1608,7 +1606,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if((!is_initialized) || (coord_k > coord_kmin)) { - std::cout << "yo20" << std::endl; indices.clear(); indices.push_back(t[2]); indices.push_back(t[0]); @@ -1636,7 +1633,305 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect return is_validated; } +// Computes the intersection of the segment from point a to point b and the triangle indexed by t +template +bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersections(bool is_entered, + const sofa::defaulttype::Vec<3, double>& a, + const sofa::defaulttype::Vec<3, double>& b, + const TriangleID ind_t, + sofa::helper::vector& indices, + sofa::helper::vector& vecBaryCoef) const +{ + double baryCoef; + double coord_kmin; + // HYP : point a is in triangle indexed by t + // is_entered == true => indices.size() == 2 + TriangleID ind_first = 0; + TriangleID ind_second = 0; + + if (indices.size() > 1) + { + ind_first = indices[0]; + ind_second = indices[1]; + } + + indices.clear(); + vecBaryCoef.clear(); + + bool is_validated = false; + bool is_intersected = false; + + const Triangle& t = this->m_topology->getTriangle(ind_t); + const typename DataTypes::VecCoord& vect_c = (this->object->read(core::ConstVecCoordId::position())->getValue()); + + bool is_full_01 = (is_entered && ((t[0] == ind_first && t[1] == ind_second) || (t[1] == ind_first && t[0] == ind_second))); + bool is_full_12 = (is_entered && ((t[1] == ind_first && t[2] == ind_second) || (t[2] == ind_first && t[1] == ind_second))); + bool is_full_20 = (is_entered && ((t[2] == ind_first && t[0] == ind_second) || (t[0] == ind_first && t[2] == ind_second))); + + const typename DataTypes::Coord& c0 = vect_c[t[0]]; + const typename DataTypes::Coord& c1 = vect_c[t[1]]; + const typename DataTypes::Coord& c2 = vect_c[t[2]]; + + sofa::defaulttype::Vec<3, Real> p0; + p0[0] = (Real)(c0[0]); + p0[1] = (Real)(c0[1]); + p0[2] = (Real)(c0[2]); + sofa::defaulttype::Vec<3, Real> p1; + p1[0] = (Real)(c1[0]); + p1[1] = (Real)(c1[1]); + p1[2] = (Real)(c1[2]); + sofa::defaulttype::Vec<3, Real> p2; + p2[0] = (Real)(c2[0]); + p2[1] = (Real)(c2[1]); + p2[2] = (Real)(c2[2]); + + sofa::defaulttype::Vec<3, Real> pa; + pa[0] = (Real)(a[0]); + pa[1] = (Real)(a[1]); + pa[2] = (Real)(a[2]); + sofa::defaulttype::Vec<3, Real> pb; + pb[0] = (Real)(b[0]); + pb[1] = (Real)(b[1]); + pb[2] = (Real)(b[2]); + + sofa::defaulttype::Vec<3, Real> v_normal = (p2 - p0).cross(p1 - p0); + Real norm_v_normal = v_normal.norm(); // WARN : square root COST + + if (norm_v_normal != 0.0) + { + + v_normal /= norm_v_normal; + + sofa::defaulttype::Vec<3, Real> v_ab = pb - pa; + sofa::defaulttype::Vec<3, Real> v_ab_proj = v_ab - v_normal * dot(v_ab, v_normal); // projection (same values if incision in the plan) + sofa::defaulttype::Vec<3, Real> pb_proj = v_ab_proj + pa; + + sofa::defaulttype::Vec<3, Real> v_01 = p1 - p0; + sofa::defaulttype::Vec<3, Real> v_12 = p2 - p1; + sofa::defaulttype::Vec<3, Real> v_20 = p0 - p2; + + sofa::defaulttype::Vec<3, Real> n_proj = v_ab_proj.cross(v_normal); + + sofa::defaulttype::Vec<3, Real> n_01 = v_01.cross(v_normal); + sofa::defaulttype::Vec<3, Real> n_12 = v_12.cross(v_normal); + sofa::defaulttype::Vec<3, Real> n_20 = v_20.cross(v_normal); + + Real norm2_v_ab_proj = v_ab_proj * (v_ab_proj); //dot product WARNING + + if (norm2_v_ab_proj != 0.0) // pb_proj != pa + { + double coord_t = 0.0; + double coord_k = 0.0; + + double is_initialized = false; + coord_kmin = 0.0; + + double coord_test1; + double coord_test2; + + double s_t; + double s_k; + + if (!is_full_01) + { + /// Test of edge (p0,p1) : + s_t = (p0 - p1) * n_proj; + s_k = (pa - pb_proj) * n_01; + if (s_t == 0.0) // (pa,pb_proj) and (p0,p1) are parallel + { + if ((p0 - pa) * (n_proj) == 0.0) // (pa,pb_proj) and (p0,p1) are on the same line + { + coord_test1 = (pa - p0) * (pa - pb_proj) / norm2_v_ab_proj; // HYP : pb_proj != pa + coord_test2 = (pa - p1) * (pa - pb_proj) / norm2_v_ab_proj; // HYP : pb_proj != pa + + if (coord_test1 >= 0) + { + coord_k = coord_test1; + coord_t = 0.0; + } + else + { + coord_k = coord_test2; + coord_t = 1.0; + } + + is_intersected = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); + + } + else // (pa,pb_proj) and (p0,p1) are parallel and disjoint + { + is_intersected = false; + } + } + else // s_t != 0.0 and s_k != 0.0 + { + coord_k = double((pa - p0) * (n_01)) * 1.0 / double(s_k); + coord_t = double((p0 - pa) * (n_proj)) * 1.0 / double(s_t); + + is_intersected = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); + } + + if (is_intersected) + { + if ((!is_initialized) || (coord_k > coord_kmin)) + { + std::cout << "yo01 "<= 0) + { + coord_k = coord_test1; + coord_t = 0.0; + } + else + { + coord_k = coord_test2; + coord_t = 1.0; + } + + is_intersected = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); + } + else // (pa,pb_proj) and (p1,p2) are parallel and disjoint + { + is_intersected = false; + } + + } + else // s_t != 0.0 and s_k != 0.0 + { + + coord_k = double((pa - p1) * (n_12)) * 1.0 / double(s_k); + coord_t = double((p1 - pa) * (n_proj)) * 1.0 / double(s_t); + + is_intersected = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); + } + + if (is_intersected) + { + if ((!is_initialized) || (coord_k > coord_kmin)) + { + std::cout << "yo12 " << coord_t << std::endl; + //indices.clear(); + indices.push_back(t[1]); + indices.push_back(t[2]); + baryCoef = coord_t; + coord_kmin = coord_k; + vecBaryCoef.push_back(baryCoef); + } + + is_initialized = true; + } + + is_validated = is_validated || is_initialized; + } + + + + if (!is_full_20) + { + /// Test of edge (p2,p0) : + + s_t = (p2 - p0) * (n_proj); + s_k = (pa - pb_proj) * (n_20); + + // s_t == 0.0 iff s_k == 0.0 + + if (s_t == 0.0) // (pa,pb_proj) and (p2,p0) are parallel + { + if ((p2 - pa) * (n_proj) == 0.0) // (pa,pb_proj) and (p2,p0) are on the same line + { + coord_test1 = (pa - p2) * (pa - pb_proj) / norm2_v_ab_proj; // HYP : pb_proj != pa + coord_test2 = (pa - p0) * (pa - pb_proj) / norm2_v_ab_proj; // HYP : pb_proj != pa + + if (coord_test1 >= 0) + { + coord_k = coord_test1; + coord_t = 0.0; + } + else + { + coord_k = coord_test2; + coord_t = 1.0; + } + + is_intersected = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); + + } + else // (pa,pb_proj) and (p2,p0) are parallel and disjoint + { + is_intersected = false; + } + } + else // s_t != 0.0 and s_k != 0.0 + { + coord_k = double((pa - p2) * (n_20)) * 1.0 / double(s_k); + coord_t = double((p2 - pa) * (n_proj)) * 1.0 / double(s_t); + + is_intersected = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); + } + + if (is_intersected) + { + if ((!is_initialized) || (coord_k > coord_kmin)) + { + std::cout << "yo20 " << coord_t << std::endl; + //indices.clear(); + indices.push_back(t[2]); + indices.push_back(t[0]); + baryCoef = coord_t; + coord_kmin = coord_k; + vecBaryCoef.push_back(baryCoef); + } + + is_initialized = true; + } + is_validated = is_validated || is_initialized; + } + + + } + else + { + is_validated = false; // points a and b are projected to the same point on triangle t + } + } + else + { + is_validated = false; // triangle t is flat + } + + return is_validated; +} From 421f93799cded7c232e3d1c7870087c16c4fdade Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Thu, 15 Apr 2021 11:09:14 +0100 Subject: [PATCH 4/9] [TriangleSetGeometryAlgorithms.inl] get intersectionS between a segment and a point --- .../TriangleSetGeometryAlgorithms.inl | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 3e8ade13a80..299074b5531 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1734,6 +1734,10 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect if (!is_full_01) { + coord_t = 0.0; + coord_k = 0.0; + bool is_intersected_01 = false; + double is_initialized_01 = false; /// Test of edge (p0,p1) : s_t = (p0 - p1) * n_proj; s_k = (pa - pb_proj) * n_01; @@ -1755,12 +1759,12 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect coord_t = 1.0; } - is_intersected = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); + is_intersected_01 = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); } else // (pa,pb_proj) and (p0,p1) are parallel and disjoint { - is_intersected = false; + is_intersected_01 = false; } } else // s_t != 0.0 and s_k != 0.0 @@ -1768,14 +1772,13 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect coord_k = double((pa - p0) * (n_01)) * 1.0 / double(s_k); coord_t = double((p0 - pa) * (n_proj)) * 1.0 / double(s_t); - is_intersected = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); + is_intersected_01 = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); } - if (is_intersected) + if (is_intersected_01) { - if ((!is_initialized) || (coord_k > coord_kmin)) + if ((!is_initialized_01) || (coord_k > coord_kmin)) { - std::cout << "yo01 "<::computeSegmentTriangleIntersect vecBaryCoef.push_back(baryCoef); } - is_initialized = true; + is_initialized_01 = true; } - is_validated = is_validated || is_initialized; + is_validated = is_validated || is_initialized_01; } if (!is_full_12) { + coord_t = 0.0; + coord_k = 0.0; + bool is_intersected_12 = false; + double is_initialized_12 = false; /// Test of edge (p1,p2) : s_t = (p1 - p2) * (n_proj); @@ -1819,11 +1826,11 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect coord_t = 1.0; } - is_intersected = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); + is_intersected_12 = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); } else // (pa,pb_proj) and (p1,p2) are parallel and disjoint { - is_intersected = false; + is_intersected_12 = false; } } @@ -1833,14 +1840,13 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect coord_k = double((pa - p1) * (n_12)) * 1.0 / double(s_k); coord_t = double((p1 - pa) * (n_proj)) * 1.0 / double(s_t); - is_intersected = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); + is_intersected_12 = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); } - if (is_intersected) + if (is_intersected_12) { - if ((!is_initialized) || (coord_k > coord_kmin)) + if ((!is_initialized_12) || (coord_k > coord_kmin)) { - std::cout << "yo12 " << coord_t << std::endl; //indices.clear(); indices.push_back(t[1]); indices.push_back(t[2]); @@ -1849,16 +1855,20 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect vecBaryCoef.push_back(baryCoef); } - is_initialized = true; + is_initialized_12 = true; } - is_validated = is_validated || is_initialized; + is_validated = is_validated || is_initialized_12; } if (!is_full_20) { + coord_t = 0.0; + coord_k = 0.0; + bool is_intersected_20 = false; + double is_initialized_20 = false; /// Test of edge (p2,p0) : s_t = (p2 - p0) * (n_proj); @@ -1884,12 +1894,12 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect coord_t = 1.0; } - is_intersected = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); + is_intersected_20 = (coord_k > 0.0 && (coord_t >= 0.0 && coord_t <= 1.0)); } else // (pa,pb_proj) and (p2,p0) are parallel and disjoint { - is_intersected = false; + is_intersected_20 = false; } } else // s_t != 0.0 and s_k != 0.0 @@ -1897,14 +1907,13 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect coord_k = double((pa - p2) * (n_20)) * 1.0 / double(s_k); coord_t = double((p2 - pa) * (n_proj)) * 1.0 / double(s_t); - is_intersected = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); + is_intersected_20 = ((coord_k > 0.0) && (coord_t >= 0.0 && coord_t <= 1.0)); } - if (is_intersected) + if (is_intersected_20) { - if ((!is_initialized) || (coord_k > coord_kmin)) + if ((!is_initialized_20) || (coord_k > coord_kmin)) { - std::cout << "yo20 " << coord_t << std::endl; //indices.clear(); indices.push_back(t[2]); indices.push_back(t[0]); @@ -1913,9 +1922,9 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect vecBaryCoef.push_back(baryCoef); } - is_initialized = true; + is_initialized_20 = true; } - is_validated = is_validated || is_initialized; + is_validated = is_validated || is_initialized_20; } From e7f2c3a301ecede02487c9f30910429dbfcd7701 Mon Sep 17 00:00:00 2001 From: epernod Date: Thu, 15 Apr 2021 14:27:49 +0200 Subject: [PATCH 5/9] Test commit --- .../src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 299074b5531..d0809a9693c 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1779,7 +1779,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if ((!is_initialized_01) || (coord_k > coord_kmin)) { - //indices.clear(); indices.push_back(t[0]); indices.push_back(t[1]); baryCoef = coord_t; @@ -1847,7 +1846,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if ((!is_initialized_12) || (coord_k > coord_kmin)) { - //indices.clear(); indices.push_back(t[1]); indices.push_back(t[2]); baryCoef = coord_t; @@ -1914,7 +1912,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect { if ((!is_initialized_20) || (coord_k > coord_kmin)) { - //indices.clear(); indices.push_back(t[2]); indices.push_back(t[0]); baryCoef = coord_t; @@ -1926,8 +1923,6 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect } is_validated = is_validated || is_initialized_20; } - - } else { From 2e85825bdd9fac697bec697ad6923e370b9bb15a Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Thu, 15 Apr 2021 14:30:27 +0100 Subject: [PATCH 6/9] [TriangleSetAlgorithms] add output vecCoordKmin in computeSegmentTriangleIntersections --- .../src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h | 3 ++- .../src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h index 51c56b2a731..fcbabf104c0 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h @@ -249,7 +249,8 @@ class TriangleSetGeometryAlgorithms : public EdgeSetGeometryAlgorithms& b, const TriangleID ind_t, sofa::helper::vector& indices, - sofa::helper::vector& baryCoef) const; + sofa::helper::vector& baryCoef, + sofa::helper::vector& vecCoordKmin) const; /** \brief Computes the list of points (ind_edge,coord) intersected by the segment from point a to point b and the triangular mesh * diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 299074b5531..61c62c557b8 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1640,7 +1640,8 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect const sofa::defaulttype::Vec<3, double>& b, const TriangleID ind_t, sofa::helper::vector& indices, - sofa::helper::vector& vecBaryCoef) const + sofa::helper::vector& vecBaryCoef, + sofa::helper::vector& vecCoordKmin) const { double baryCoef; double coord_kmin; @@ -1785,6 +1786,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect baryCoef = coord_t; coord_kmin = coord_k; vecBaryCoef.push_back(baryCoef); + vecCoordKmin.push_back(coord_kmin); } is_initialized_01 = true; @@ -1853,6 +1855,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect baryCoef = coord_t; coord_kmin = coord_k; vecBaryCoef.push_back(baryCoef); + vecCoordKmin.push_back(coord_kmin); } is_initialized_12 = true; @@ -1920,6 +1923,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect baryCoef = coord_t; coord_kmin = coord_k; vecBaryCoef.push_back(baryCoef); + vecCoordKmin.push_back(coord_kmin); } is_initialized_20 = true; From d4a3ae70bf9a4e0576b274ecb6892062bef459c4 Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Wed, 26 May 2021 10:58:04 +0100 Subject: [PATCH 7/9] [TriangleSetGeometryAlgorithms] add function to compute all intersections between a segment and a triangle --- .../src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h | 4 ++-- .../src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h index fcbabf104c0..bd644619c0f 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h @@ -244,12 +244,12 @@ class TriangleSetGeometryAlgorithms : public EdgeSetGeometryAlgorithms& a, const sofa::defaulttype::Vec<3, double>& b, const TriangleID ind_t, sofa::helper::vector& indices, - sofa::helper::vector& baryCoef, + sofa::helper::vector& vecBaryCoef, sofa::helper::vector& vecCoordKmin) const; /** \brief Computes the list of points (ind_edge,coord) intersected by the segment from point a to point b and the triangular mesh diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 5509e29e92a..74104e47521 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1635,7 +1635,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect // Computes the intersection of the segment from point a to point b and the triangle indexed by t template -bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersections(bool is_entered, +bool TriangleSetGeometryAlgorithms< DataTypes >::computeIntersectionsLineTriangle(bool is_entered, const sofa::defaulttype::Vec<3, double>& a, const sofa::defaulttype::Vec<3, double>& b, const TriangleID ind_t, From d5cb45472ed13cb8cae76caeda3f85ad5b9d1b66 Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Thu, 3 Jun 2021 10:29:15 +0100 Subject: [PATCH 8/9] [SofaGuiQt] remove useless line (#2107) --- modules/SofaGuiQt/src/sofa/gui/qt/viewer/SofaViewer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/SofaGuiQt/src/sofa/gui/qt/viewer/SofaViewer.cpp b/modules/SofaGuiQt/src/sofa/gui/qt/viewer/SofaViewer.cpp index 27b0033344c..3270d99efd3 100644 --- a/modules/SofaGuiQt/src/sofa/gui/qt/viewer/SofaViewer.cpp +++ b/modules/SofaGuiQt/src/sofa/gui/qt/viewer/SofaViewer.cpp @@ -235,7 +235,6 @@ void SofaViewer::keyPressEvent(QKeyEvent * e) msg_info("SofaViewer") << "Stereo mode: None"; break; default: msg_info("SofaViewer") << "Stereo mode: INVALID"; break; - break; } break; } From d2429f6eab285ab9c4746747ed703a6e9f9dc130 Mon Sep 17 00:00:00 2001 From: Mrbunbun Date: Tue, 8 Jun 2021 15:50:04 +0100 Subject: [PATCH 9/9] [Topology] apply request changes (#2131) --- .../EdgeSetGeometryAlgorithms.h | 6 +- .../EdgeSetGeometryAlgorithms.inl | 40 ++++-------- .../TriangleSetGeometryAlgorithms.h | 8 +-- .../TriangleSetGeometryAlgorithms.inl | 63 +++++++------------ 4 files changed, 42 insertions(+), 75 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h index 4f2b7c05680..7d62a5b3d51 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.h @@ -158,9 +158,9 @@ class EdgeSetGeometryAlgorithms : public PointSetGeometryAlgorithms NumericalIntegrationDescriptor &getEdgeNumericalIntegrationDescriptor(); bool computeEdgeSegmentIntersection(EdgeID edgeID, - const sofa::defaulttype::Vec<3,double>& a, - const sofa::defaulttype::Vec<3, double>& b, - double &baryCoef); + const sofa::defaulttype::Vec<3,Real>& a, + const sofa::defaulttype::Vec<3, Real>& b, + Real &baryCoef); protected: Data showEdgeIndices; ///< Debug : view Edge indices. diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl index 95935f71958..a478d1f7e42 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/EdgeSetGeometryAlgorithms.inl @@ -901,46 +901,28 @@ void EdgeSetGeometryAlgorithms::initPointAdded(PointID index, const c template bool EdgeSetGeometryAlgorithms::computeEdgeSegmentIntersection(EdgeID edgeID, - const sofa::defaulttype::Vec<3, double>& a, - const sofa::defaulttype::Vec<3, double>& b, - double &baryCoef) - //intersection=edge[0]+baryCoef*(edge[1]-edge[0]) + const sofa::defaulttype::Vec<3, Real>& a, + const sofa::defaulttype::Vec<3, Real>& b, + Real &baryCoef) { - double EPS = 1e-05; + const double EPS = 1e-05; bool is_intersect = false; const Edge& e = this->m_topology->getEdge(edgeID); const VecCoord& p = (this->object->read(core::ConstVecCoordId::position())->getValue()); const typename DataTypes::Coord& c0 = p[e[0]]; const typename DataTypes::Coord& c1 = p[e[1]]; - //sofa::defaulttype::Vec<3, Real> p0 = defaulttype::Vector3(DataTypes::getCPos(p[e[0]])); - //sofa::defaulttype::Vec<3, Real> p1 = defaulttype::Vector3(DataTypes::getCPos(p[e[1]])); - sofa::defaulttype::Vec<3, Real> p0; - p0[0] = (Real)(c0[0]); - p0[1] = (Real)(c0[1]); - p0[2] = (Real)(c0[2]); - sofa::defaulttype::Vec<3, Real> p1; - p1[0] = (Real)(c1[0]); - p1[1] = (Real)(c1[1]); - p1[2] = (Real)(c1[2]); - - sofa::defaulttype::Vec<3, Real> pa; - pa[0] = (Real)(a[0]); - pa[1] = (Real)(a[1]); - pa[2] = (Real)(a[2]); - sofa::defaulttype::Vec<3, Real> pb; - pb[0] = (Real)(b[0]); - pb[1] = (Real)(b[1]); - pb[2] = (Real)(b[2]); - - - + sofa::defaulttype::Vec<3, Real> p0{ c0[0],c0[1],c0[2] }; + sofa::defaulttype::Vec<3, Real> p1{ c1[0],c1[1],c1[2] }; + sofa::defaulttype::Vec<3, Real> pa{ a[0],a[1],a[2] }; + sofa::defaulttype::Vec<3, Real> pb{ b[0],b[1],b[2] }; + sofa::defaulttype::Vec<3, Real> v_0a = p0 - pa; sofa::defaulttype::Vec<3, Real> v_ba = pb - pa; sofa::defaulttype::Vec<3, Real> v_10 = p1 - p0; - double d0aba, dba10, d0a10, dbaba, d1010; + Real d0aba, dba10, d0a10, dbaba, d1010; d0aba = v_0a * v_ba; dba10 = v_ba * v_ba; @@ -948,7 +930,7 @@ bool EdgeSetGeometryAlgorithms::computeEdgeSegmentIntersection(EdgeID dbaba = v_ba * v_ba; d1010 = v_10 * v_10; - double deno, num; + Real deno, num; deno = d1010 * dbaba - dba10 * dba10; if (!abs(deno) <= EPS) { diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h index bd644619c0f..82dff85c303 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.h @@ -245,12 +245,12 @@ class TriangleSetGeometryAlgorithms : public EdgeSetGeometryAlgorithms& a, - const sofa::defaulttype::Vec<3, double>& b, + const sofa::defaulttype::Vec<3, Real>& a, + const sofa::defaulttype::Vec<3, Real>& b, const TriangleID ind_t, sofa::helper::vector& indices, - sofa::helper::vector& vecBaryCoef, - sofa::helper::vector& vecCoordKmin) const; + sofa::helper::vector& vecBaryCoef, + sofa::helper::vector& vecCoordKmin) const; /** \brief Computes the list of points (ind_edge,coord) intersected by the segment from point a to point b and the triangular mesh * diff --git a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl index 74104e47521..533804a0e70 100644 --- a/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/src/SofaBaseTopology/TriangleSetGeometryAlgorithms.inl @@ -1636,15 +1636,16 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeSegmentTriangleIntersect // Computes the intersection of the segment from point a to point b and the triangle indexed by t template bool TriangleSetGeometryAlgorithms< DataTypes >::computeIntersectionsLineTriangle(bool is_entered, - const sofa::defaulttype::Vec<3, double>& a, - const sofa::defaulttype::Vec<3, double>& b, + const sofa::defaulttype::Vec<3, Real>& a, + const sofa::defaulttype::Vec<3, Real>& b, const TriangleID ind_t, sofa::helper::vector& indices, - sofa::helper::vector& vecBaryCoef, - sofa::helper::vector& vecCoordKmin) const + sofa::helper::vector& vecBaryCoef, + sofa::helper::vector& vecCoordKmin) const { - double baryCoef; - double coord_kmin; + Real EPS = 1e-10; + Real baryCoef; + Real coord_kmin; // HYP : point a is in triangle indexed by t // is_entered == true => indices.size() == 2 TriangleID ind_first = 0; @@ -1673,32 +1674,16 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeIntersectionsLineTriangl const typename DataTypes::Coord& c1 = vect_c[t[1]]; const typename DataTypes::Coord& c2 = vect_c[t[2]]; - sofa::defaulttype::Vec<3, Real> p0; - p0[0] = (Real)(c0[0]); - p0[1] = (Real)(c0[1]); - p0[2] = (Real)(c0[2]); - sofa::defaulttype::Vec<3, Real> p1; - p1[0] = (Real)(c1[0]); - p1[1] = (Real)(c1[1]); - p1[2] = (Real)(c1[2]); - sofa::defaulttype::Vec<3, Real> p2; - p2[0] = (Real)(c2[0]); - p2[1] = (Real)(c2[1]); - p2[2] = (Real)(c2[2]); - - sofa::defaulttype::Vec<3, Real> pa; - pa[0] = (Real)(a[0]); - pa[1] = (Real)(a[1]); - pa[2] = (Real)(a[2]); - sofa::defaulttype::Vec<3, Real> pb; - pb[0] = (Real)(b[0]); - pb[1] = (Real)(b[1]); - pb[2] = (Real)(b[2]); + sofa::defaulttype::Vec<3, Real> p0{ c0[0],c0[1],c0[2] }; + sofa::defaulttype::Vec<3, Real> p1{ c1[0],c1[1],c1[2] }; + sofa::defaulttype::Vec<3, Real> p2{ c2[0],c2[1],c2[2] }; + sofa::defaulttype::Vec<3, Real> pa{ a[0],a[1],a[2] }; + sofa::defaulttype::Vec<3, Real> pb{ b[0],b[1],b[2] }; sofa::defaulttype::Vec<3, Real> v_normal = (p2 - p0).cross(p1 - p0); Real norm_v_normal = v_normal.norm(); // WARN : square root COST - if (norm_v_normal != 0.0) + if (norm_v_normal >=EPS) { v_normal /= norm_v_normal; @@ -1719,26 +1704,26 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeIntersectionsLineTriangl Real norm2_v_ab_proj = v_ab_proj * (v_ab_proj); //dot product WARNING - if (norm2_v_ab_proj != 0.0) // pb_proj != pa + if (norm2_v_ab_proj >= EPS) // pb_proj != pa { - double coord_t = 0.0; - double coord_k = 0.0; + Real coord_t = 0.0; + Real coord_k = 0.0; - double is_initialized = false; + bool is_initialized = false; coord_kmin = 0.0; - double coord_test1; - double coord_test2; + Real coord_test1; + Real coord_test2; - double s_t; - double s_k; + Real s_t; + Real s_k; if (!is_full_01) { coord_t = 0.0; coord_k = 0.0; bool is_intersected_01 = false; - double is_initialized_01 = false; + bool is_initialized_01 = false; /// Test of edge (p0,p1) : s_t = (p0 - p1) * n_proj; s_k = (pa - pb_proj) * n_01; @@ -1801,7 +1786,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeIntersectionsLineTriangl coord_t = 0.0; coord_k = 0.0; bool is_intersected_12 = false; - double is_initialized_12 = false; + bool is_initialized_12 = false; /// Test of edge (p1,p2) : s_t = (p1 - p2) * (n_proj); @@ -1869,7 +1854,7 @@ bool TriangleSetGeometryAlgorithms< DataTypes >::computeIntersectionsLineTriangl coord_t = 0.0; coord_k = 0.0; bool is_intersected_20 = false; - double is_initialized_20 = false; + bool is_initialized_20 = false; /// Test of edge (p2,p0) : s_t = (p2 - p0) * (n_proj);