[PR02 Mesh Intersection] Sofa cgal vertex push using CGAL methodes#3
Open
FadiWahbeh wants to merge 1 commit into
Open
[PR02 Mesh Intersection] Sofa cgal vertex push using CGAL methodes#3FadiWahbeh wants to merge 1 commit into
FadiWahbeh wants to merge 1 commit into
Conversation
d67c83d to
b40adf8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based #2
PR 02B - CGAL Local Repulsion with Rest-Position Stabilization
Goal
This PR introduces a CGAL-based local repulsion system inside
MeshRepulsionEngine.The objective is to move the slave mesh outside the master mesh using a local correction. The correction is computed locally from the relation between slave vertices and the master surface.
Main Idea
The component uses CGAL to detect slave vertices located inside the master mesh.
For each problematic slave vertex, CGAL computes a local geometric correction using the closest point on the master surface.
The correction is then applied progressively to the slave mesh.
The general workflow is:
The correction remains local and non-rigid.
Why
restPositionIs UpdatedIn SOFA, physical components such as FEM or springs may use
restPositionas the reference configuration.If only
positionis updated, the solver can still try to bring the mesh back toward its old reference shape.If this old reference shape is still interpenetrating the master mesh, SOFA may pull the slave mesh back inside the master.
To avoid this conflict, this PR allows the component to update both:
This helps keep the CGAL correction and the SOFA simulation state consistent.
Modified Files
Moddify Test Scene
Important Scene Parameters
Example configuration:
Parameters
enableCgalDetectionEnables CGAL inside / boundary / outside detection.
enablePositionUpdateEnables the local correction of slave vertex positions.
When disabled, the component can still be used for detection and diagnostics only.
updateRestPositionWhen enabled, the component updates both the current position and the rest position of the slave mesh.
This prevents the SOFA solver from pulling the slave mesh back toward an invalid initial configuration.
rejectIfInsideIncreasesRejects a correction step if the number of inside vertices increases after applying the candidate correction.
Example:
In this case, the correction step is cancelled.
maxMovedVerticesPerStepA value of
0means that there is no artificial limit on the number of corrected vertices per step.This avoids leaving some inside vertices untreated while other vertices are already corrected.
alphaControls the fraction of the correction applied at each step.
maxStepLimits the maximum displacement applied to one slave vertex during one correction step.
This avoids large jumps.
safetyDistanceDefines the target gap outside the master surface.
The goal is not only to put the slave vertex exactly on the master surface, but slightly outside it.
CGAL Methods Used
This PR uses CGAL for the geometric part of the correction.
Main CGAL structures:
Main geometric operations:
Algorithm
The code follows this logic:
Validation Checklist
insideBeforedecreases over simulation steps.insideAfterdoes not increase whenrejectIfInsideIncreases=true.acceptedremains1for valid correction steps.Not Included Yet
This PR does not include:
2026-07-07.08-02-18.mp4