Skip to content

Commit

Permalink
Fix compilation and add new sceen for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
epernod committed Feb 10, 2025
1 parent 7f72c7c commit 6a0e922
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" ?>
<Node name="root" dt="0.03" showBoundingTree="0" gravity="0 -0.1 0">
<Node name="RequiredPlugins">
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase, BruteForceBroadPhase, CollisionPipeline] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [PointCollisionModel, SphereCollisionModel, TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [DefaultContactManager] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Mapping.NonLinear"/> <!-- Needed to use components [RigidMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass, UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedralCorotationalFEMForceField] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms, TetrahedronSetTopologyContainer, TetrahedronSetTopologyModifier, TriangleSetGeometryAlgorithms, TriangleSetTopologyContainer, TriangleSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
<RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2TetraTopologicalMapping, Tetra2TriangleTopologicalMapping] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [TriangularBendingSprings] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="Tearing" />
</Node>

<VisualStyle displayFlags="hideCollisionModels showVisual showBehaviorModels showWireframe" />

<DefaultAnimationLoop />
<DefaultVisualManagerLoop />
<CollisionPipeline verbose="0" />
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<CollisionResponse response="PenalityContactForceField" />
<MinProximityIntersection name="Proximity" alarmDistance="1.0" contactDistance="0.1" />

<Node name="FixedPlane" >
<EulerImplicitSolver name="cg_odesolver" />
<CGLinearSolver iterations="40" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
<MeshOBJLoader name="loader" filename="./mesh/plane_128_triangles.obj" scale3d="10 10 10" />
<MechanicalObject name="CoarseMesh" position="@loader.position" template="Vec3d" />
<TriangleSetTopologyContainer triangles="@loader.triangles" name="Ttopo" />
<TriangleSetTopologyModifier name="Modifier" />
<TriangleSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" drawEdges="1" showIndicesScale="0.04" showTriangleIndices="1" showEdgeIndices="1" showPointIndices="1"/>
<DiagonalMass template="Vec3d,Vec3d" name="default5" massDensity="0.1" />
<BoxROI template="Vec3d" name="box_roi1" box="-20.1 -1 -20.1 -19.9 1 20.1 19.9 -1 -20.1 20.1 1 20.1" drawBoxes="1"/>
<FixedProjectiveConstraint template="Vec3d" name="fixedConstraint1" indices="@box_roi1.indices"/>
<TriangularFEMForceField template="Vec3d" name="FEM" method="large" poissonRatio="0.45" youngModulus="600" />
<TriangleCollisionModel name="default7" selfCollision="true" />
<TriangleCuttingController name="TriCtrl" triAID="8" triBID="66" triACoefs="0.33 0.33 0.33 " triBCoefs=" 0.33 0.33 0.33" drawDebugCut="1" performCut="1"/>
<Node name="visu">
<OglModel name="Visual" texcoords="@../loader.texcoords" texturename="textures/colorMap.png"/>
<IdentityMapping input="@.." output="@." />
</Node>
</Node>

</Node>
6 changes: 3 additions & 3 deletions src/Tearing/Controllers/TriangleCuttingController.inl
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,11 @@ void TriangleCuttingController<DataTypes>::processCutNew()
SReal snapThreshold = 0.8;
SReal snapThresholdBorder = 0.8;

m_pointsToAdd = m_geometryAlgorithms->computeIncisionPathNew(ptA, ptB, triIds[0], triIds[1], snapThreshold, snapThresholdBorder);
m_pointsToAdd = m_geometryAlgorithms->computeIncisionPath(ptA, ptB, triIds[0], triIds[1], snapThreshold, snapThresholdBorder);
std::cout << "m_pointsToAdd: " << m_pointsToAdd.size() << std::endl;

if (d_performCut.getValue())
m_geometryAlgorithms->ComputeIncision(ptA, ptB, triIds[0], triIds[1], m_pointsToAdd);
m_geometryAlgorithms->InciseAlongPath(ptA, ptB, triIds[0], triIds[1], m_pointsToAdd);

std::cout << "TriangleCuttingController::processCutNew() out" << std::endl;
}
Expand Down Expand Up @@ -524,7 +524,7 @@ void TriangleCuttingController<DataTypes>::processCut()

std::cout << "ptA: " << ptA << std::endl;
std::cout << "ptB: " << ptB << std::endl;
m_geometryAlgorithms->computeIncisionPath(ptA, ptB, triIds[0], triIds[1], triangles_list, edges_list, coords_list);
m_geometryAlgorithms->computeSegmentTriangulationIntersections(ptA, ptB, triIds[0], triIds[1], triangles_list, edges_list, coords_list);

std::cout << "triangles_list: " << triangles_list << std::endl;
std::cout << "edges_list: " << edges_list << std::endl;
Expand Down

0 comments on commit 6a0e922

Please sign in to comment.