diff --git a/scenes/TearingEngine/SquareTissue_01_gravity.scn b/scenes/TearingEngine/SquareTissue_01_gravity.scn index 408bd56..c86d141 100644 --- a/scenes/TearingEngine/SquareTissue_01_gravity.scn +++ b/scenes/TearingEngine/SquareTissue_01_gravity.scn @@ -32,7 +32,8 @@ - + + + - + + - - - - + + - --> diff --git a/src/Tearing/TearingAlgorithms.h b/src/Tearing/TearingAlgorithms.h index 5fd775f..b4e2faa 100644 --- a/src/Tearing/TearingAlgorithms.h +++ b/src/Tearing/TearingAlgorithms.h @@ -65,6 +65,8 @@ class TearingAlgorithms void algoFracturePath(Coord Pa, Index indexA, Coord Pb, Coord Pc, const Index indexTriangleMaxStress, const Coord principalStressDirection, const VecCoord& input_position); + void algoFracturePath2(const Index triID, Coord Pa, Coord Pb, Coord Pc, const Coord principalStressDirection, const VecCoord& input_position); + int getFractureNumber() const { return m_fractureNumber; } const sofa::type::vector< sofa::type::vector >& getTjunctionTriangles() const { return m_TjunctionTriangle; } diff --git a/src/Tearing/TearingAlgorithms.inl b/src/Tearing/TearingAlgorithms.inl index 0950c56..e72c4e6 100644 --- a/src/Tearing/TearingAlgorithms.inl +++ b/src/Tearing/TearingAlgorithms.inl @@ -50,6 +50,33 @@ TearingAlgorithms::~TearingAlgorithms() } + +template +void TearingAlgorithms::algoFracturePath2(const Index triID, Coord Pa, Coord Pb, Coord Pc, const Coord principalStressDirection, const VecCoord& input_position) +{ + m_fracturePath.clear(); + m_fracturePath.push_back(Pa); + double EPS = 1e-8; + core::topology::BaseMeshTopology::TriangleID idxA; + core::topology::BaseMeshTopology::TriangleID idxB; + // Output declarations + //sofa::type::vector< sofa::core::topology::TopologyElementType> topoPath_list; + //sofa::type::vector indices_list; + //sofa::type::vector< type::Vec3 > coords2_list; + + //bool path_ok = m_triangleGeo->computeIntersectedObjectsList(sofa::InvalidID, Pa, Pb, idxA, idxB, topoPath_list, indices_list, coords2_list); + //if (!path_ok) + //{ + // msg_error("TearingAlgorithms") << " in computeIntersectedObjectsList in algoFracturePath2"; + // return; + //} + + ////std::cout << "topoPath_list: " << topoPath_list << std::endl; + //std::cout << "indices_list: " << indices_list << std::endl; + //std::cout << "coords2_list: " << coords2_list << std::endl; +} + + template void TearingAlgorithms::algoFracturePath(Coord Pa, Index indexA, Coord Pb, Coord Pc, const Index indexTriangleMaxStress, const Coord principalStressDirection, const VecCoord& input_position) diff --git a/src/Tearing/TearingEngine.h b/src/Tearing/TearingEngine.h index 7e3ae02..cc8a756 100644 --- a/src/Tearing/TearingEngine.h +++ b/src/Tearing/TearingEngine.h @@ -127,6 +127,8 @@ class TearingEngine : public core::DataEngine void performFractureScenario(); void computeFractureDirection(Coord principleStressDirection, Coord& fracture_direction); + + void algoFracturePath2(); /// /// compute extremities of fracture Pb and Pc from a start point Pa @@ -216,6 +218,8 @@ class TearingEngine : public core::DataEngine int m_stepCounter = 0; ///< counter of doUpdate called by the simulation. Used to put gap between consecutives fractures TriangleID m_maxStressTriangleIndex = 0; ///< Triangle ID of the triangle from filter candadites with the max stress Index m_maxStressVertexIndex = 0; ///< Global Vertex Id where the stress is maximum. Vertex is part of @sa m_maxStressTriangleIndex Triangle + + Coord m_Pa, m_Pb, m_Pc; }; #if !defined(SOFA_COMPONENT_ENGINE_TEARINGENGINE_CPP) diff --git a/src/Tearing/TearingEngine.inl b/src/Tearing/TearingEngine.inl index c0b2968..76dc97f 100644 --- a/src/Tearing/TearingEngine.inl +++ b/src/Tearing/TearingEngine.inl @@ -336,6 +336,14 @@ void TearingEngine::updateTriangleInformation() } +template +void TearingEngine::algoFracturePath2() +{ + std::cout << "TearingEngine::algoFracturePath2" << std::endl; + m_tearingAlgo->algoFracturePath2(m_maxStressTriangleIndex, m_Pa, m_Pb, m_Pc, Coord(0, 0, 0), d_input_positions.getValue()); +} + + template void TearingEngine::algoFracturePath() {