@@ -737,7 +737,7 @@ void BaseTearingEngine<DataTypes>::draw(const core::visual::VisualParams* vparam
737737
738738 if (d_showFracturePath.getValue ())
739739 {
740- if (m_maxStressTriangleIndex != InvalidID && m_fracturePath. pathOk )
740+ if (m_maxStressTriangleIndex != InvalidID)
741741 {
742742 helper::ReadAccessor< Data<VecCoord> > x (d_input_positions);
743743
@@ -752,32 +752,34 @@ void BaseTearingEngine<DataTypes>::draw(const core::visual::VisualParams* vparam
752752 points.push_back (Pa);
753753 points.push_back (Pc);
754754 // Blue == computed fracture path using d_fractureMaxLength
755- vparams->drawTool ()->drawPoints (points, 10 , sofa::type::RGBAColor (1 , 0.2 , 1 , 1 ));
756- vparams->drawTool ()->drawLines (points, 1 , sofa::type::RGBAColor (1 , 0.5 , 1 , 1 ));
755+ vparams->drawTool ()->drawPoints (points, 10 , sofa::type::RGBAColor (0 , 1 , 0 , 1 ));
756+ vparams->drawTool ()->drawLines (points, 1 , sofa::type::RGBAColor (0.2 , 1 , 0 , 1 ));
757757
758758 // ---------------------------------------------------------------------------------------------------
759759 // Green == principal stress direction
760760 vector<Coord> pointsDir;
761761 pointsDir.push_back (Pa);
762762
763763 pointsDir.push_back (Pa + 100.0 *(principalStressDirection));
764- vparams->drawTool ()->drawPoints (pointsDir, 10 , sofa::type::RGBAColor (0 , 1 , 0.2 , 1 ));
765- vparams->drawTool ()->drawLines (pointsDir, 1 , sofa::type::RGBAColor (0 , 1 , 0.5 , 1 ));
764+ vparams->drawTool ()->drawPoints (pointsDir, 10 , sofa::type::RGBAColor (0 , 1 , 0.4 , 1 ));
765+ vparams->drawTool ()->drawLines (pointsDir, 1 , sofa::type::RGBAColor (0 , 1 , 0.8 , 1 ));
766766
767- std::vector<Vec3> pointsPath;
768- for (auto ptA : m_fracturePath.pointsToAdd )
767+ if (m_fracturePath.pathOk )
769768 {
770- sofa::type::Vec3 vecG = sofa::type::Vec3 (0.0 , 0.0 , 0.0 );
771- sofa::Size nbr = ptA->m_ancestors .size ();
772- for (int i = 0 ; i < nbr; ++i)
769+ std::vector<Vec3> pointsPath;
770+ for (auto ptA : m_fracturePath.pointsToAdd )
773771 {
774-
775- vecG += x[ptA->m_ancestors [i]] * ptA->m_coefs [i];
772+ sofa::type::Vec3 vecG = sofa::type::Vec3 (0.0 , 0.0 , 0.0 );
773+ sofa::Size nbr = ptA->m_ancestors .size ();
774+ for (int i = 0 ; i < nbr; ++i)
775+ {
776+
777+ vecG += x[ptA->m_ancestors [i]] * ptA->m_coefs [i];
778+ }
779+ pointsPath.push_back (vecG);
776780 }
777- pointsPath. push_back (vecG );
781+ vparams-> drawTool ()-> drawSpheres ( pointsPath, 0.01 , sofa::type::RGBAColor::red () );
778782 }
779- vparams->drawTool ()->drawSpheres (pointsPath, 0.01 , sofa::type::RGBAColor::red ());
780-
781783 }
782784 }
783785}
0 commit comments