Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Topology.Container] Add new method computeSegmentTriangleIntersectionInPlane in TriangleSetGeometryAlgorithm #5188

Merged

Conversation

epernod
Copy link
Contributor

@epernod epernod commented Jan 6, 2025

Edit: PR based on #5246

This method compute the intersection between a Triangle from the current topology and a Segment [AB] which will be projected in Triangle Frame. Using Segment-Segment intersection from geometry::Edge::intersectionWithEdge

Return true if there is an intersection otherwise false.

Will fill input variables sofa::type::vector<EdgeID>& intersectedEdges and sofa::type::vector<Real>& baryCoefs with the list of intersected edges (Id in global topology, not relative to the triangle) and the barycoef of the intersection relative to the first vertex of the edge. I.e coordinate of the intersection is: Edge[0] * barycoef + Edge[1] * (1-barycoef )

This method will replace computeSegmentTriangleIntersection when all the work regarding new incision in triangle using TriangleSubvider is finished.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@epernod epernod added pr: status to review To notify reviewers to review this pull-request pr: new feature Implement a new feature labels Jan 6, 2025
@fredroy
Copy link
Contributor

fredroy commented Jan 20, 2025

I think some unit tests would be welcomed, especially for new things like these, introduced in "core" modules.

type::fixed_array<Vec3, 3> triP = { Vec3(c0[0], c0[1], c0[2]), Vec3(c1[0], c1[1], c1[2]), Vec3(c2[0], c2[1], c2[2]) };

// Project A and B into triangle plan
Vec3 v_normal = (triP[2] - triP[0]).cross(triP[1] - triP[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It changes nothing to the computation afterwards, but isn't this the opposite of the normal ?

@hugtalbot hugtalbot added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Jan 22, 2025
@epernod epernod force-pushed the inf_2025_01_triangleSegmentIntersection branch from e4d76ca to 2daf7df Compare January 25, 2025 23:52
@epernod epernod added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Jan 28, 2025
@epernod
Copy link
Contributor Author

epernod commented Jan 28, 2025

Tests have been added but in middle of others changes which have been suggested in PR #5246

@epernod
Copy link
Contributor Author

epernod commented Jan 28, 2025

[ci-build][with-all-tests]

@hugtalbot
Copy link
Contributor

hugtalbot commented Jan 29, 2025

CI is failing @epernod

/builds/workspace/sofa-framework/PR-5188/ubuntu_gcc_options_release/src/Sofa/Component/Topology/Container/Dynamic/tests/TriangleSetTopology_test.cpp:355:30: error: 'Triangle' was not declared in this scope
  355 |     const sofa::type::vector<Triangle>& triangles = m_topoCon->getTriangleArray();

@epernod
Copy link
Contributor Author

epernod commented Jan 29, 2025

CI is failing @epernod

/builds/workspace/sofa-framework/PR-5188/ubuntu_gcc_options_release/src/Sofa/Component/Topology/Container/Dynamic/tests/TriangleSetTopology_test.cpp:355:30: error: 'Triangle' was not declared in this scope
  355 |     const sofa::type::vector<Triangle>& triangles = m_topoCon->getTriangleArray();

This has been fixed in #5246

@bakpaul bakpaul added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Feb 10, 2025
@bakpaul bakpaul merged commit 5120328 into sofa-framework:master Feb 10, 2025
15 checks passed
bakpaul added a commit to bakpaul/sofa that referenced this pull request Feb 28, 2025
commit 0806b07
Author: Paul Baksic <[email protected]>
Date:   Fri Feb 21 15:55:34 2025 +0100

    [github] Use token for performance regression launching (sofa-framework#5287)

    Try fixing action

commit 9f56fca
Author: Paul Baksic <[email protected]>
Date:   Fri Feb 21 15:16:12 2025 +0100

    [github] Add workflow for performance testing launch (sofa-framework#5286)

    * Add workflow for performance testing launch

    * Fix github token and sha

commit 700b6cd
Author: Olivier Roussel <[email protected]>
Date:   Thu Feb 20 23:27:00 2025 +0100

    [IO.Mesh] Fix missing `iomanip` header in tests (sofa-framework#5279)

    Fix missing header

commit 5307e85
Author: Hugo <[email protected]>
Date:   Wed Feb 19 14:25:24 2025 +0100

    [ODESolver] Update data comment in EulerImplicit (sofa-framework#5282)

commit fee9657
Author: Alex Bilger <[email protected]>
Date:   Wed Feb 19 13:48:07 2025 +0100

    [ODESolver] Add option to compute residual at the end of the solving (sofa-framework#5263)

commit a229972
Author: Alex Bilger <[email protected]>
Date:   Wed Feb 19 12:20:51 2025 +0100

    [Helper] Deprecate findOrCreateAValidPath and introduce clearer functions (sofa-framework#5264)

    * [Helper] Fix findOrCreateAValidPath when given a file path

    * [Helper] Fix findOrCreateAValidPath when given a file path

    * Introduce clearer function names

    * deprecate findOrCreateAValidPath

    * restore previous findOrCreateAValidPath

commit 4ee24f6
Author: Frederick Roy <[email protected]>
Date:   Wed Feb 19 20:15:38 2025 +0900

    [All] Fix compilation with FLOATING_POINT_TYPE=float (sofa-framework#5269)

    fix compilation with FLOATING_POINT_TYPE=float

commit ef7ff21
Author: Hugo <[email protected]>
Date:   Wed Feb 19 09:52:47 2025 +0100

    [SceneUtility] Remove *AliasComponent (sofa-framework#5241)

    * [SceneUtility] Remove *AliasComponent

    * Update in the ComponentChange so that it appears as Removed

    * remove associated scenes

commit aa36098
Author: Alex Bilger <[email protected]>
Date:   Wed Feb 19 00:04:17 2025 +0100

    [SceneChecking] Check if a Node has an empty name (sofa-framework#5276)

commit f2f0b10
Author: EulalieCoevoet <[email protected]>
Date:   Wed Feb 12 12:14:48 2025 +0100

    [visual] Adds features to LineAxis and DrawTools (sofa-framework#5258)

    * [visual-gl] LineAxis & DrawTool:
    - fixes usage of thickness
    - new feature: infinite lines
    - new feature: vanishing infinite line
    - fixes typo

    * [visual] LineAxis: cleaning

commit b4e8b98
Author: Paul Baksic <[email protected]>
Date:   Wed Feb 12 09:35:16 2025 +0100

    [GUI] Remove Qt and make SofaImGUI as default viewer (sofa-framework#5176)

    * Add possibility to fetch and add by default for external plugins and set SofaGLFW as ON by default

    * Remove Qt-based GUI from sources

    * Add way to pull and build Sofa.Qt plugin

    * Fix compilation

    * Change order so SofaGLFW and SofaIMGUI are already in the target stack when runSofa produce the plugin_list.cong.default

    * Merge master

    * Make the packaging possible without Qt

    * Remove GuiDataRepository that was Qt specific -> will need to include it to the Qt gui plugin

    * Add fetchable Qt

commit d2f194d
Author: Alex Bilger <[email protected]>
Date:   Wed Feb 12 07:26:17 2025 +0100

    [Contact] Clean FrictionContact (sofa-framework#5261)

    * [Contact] Replace double by SReal

    * add override keyword on destructor

commit 62264fb
Author: Alex Bilger <[email protected]>
Date:   Mon Feb 10 14:20:15 2025 +0100

    [StateContainer] Allow coord difference in vOp for rigids (sofa-framework#5253)

    * [StateContainer] Allow coord difference in vOp for rigids

    * check that DataTypes support coordDifference

commit 5120328
Author: erik pernod <[email protected]>
Date:   Mon Feb 10 14:19:28 2025 +0100

    [Topology.Container] Add new method computeSegmentTriangleIntersectionInPlane in TriangleSetGeometryAlgorithm (sofa-framework#5188)

    * Update TriangleSetGeometryAlgorithms.h

    * Update TriangleSetGeometryAlgorithms.inl

    * [TopologyTest] Add comments

    * [Topology.Dynamic_test] factorize some code in TriangleSetTopology_test

    * [Topology.Dynamic_test] Add some tests in TriangleSetTopology_test to test adding and removing triangles

    * typo errors

    * [Topology.Dynamic_test] Add tests in TriangleSetTopology_test tto test TriangleSegmentIntersection inside same plane or with projection

    * Update TriangleSetTopology_test.cpp

    * Update TriangleSetTopology_test.cpp

    * Update TriangleSetTopology_test.cpp

    * Fix namespace

commit 5448a14
Author: Alex Bilger <[email protected]>
Date:   Fri Jan 31 15:10:05 2025 +0100

    [StateContainer] Extend the possible vector operations in vOp (sofa-framework#5237)

    * missing test

    * remove duplicated test

    * [StateContainer] Extend the possible vector operations in vOp

    ---------

    Co-authored-by: Paul Baksic <[email protected]>

commit 6af25d5
Author: Alex Bilger <[email protected]>
Date:   Fri Jan 31 15:04:36 2025 +0100

    [Simulation] Trigger warning when Node already contains component (sofa-framework#5212)

    * [Simulation] Trigger error when Node already contains component

    * also mention the class name

    * convert error to warning

    * fix STLExporter_test

commit 9ceb6dc
Author: Alex Bilger <[email protected]>
Date:   Fri Jan 31 15:04:21 2025 +0100

    [SofaCUDA] Print CUDA standard at init of the module (sofa-framework#5166)

    * [SofaCUDA] Print CUDA standard at init of the module

    * add an empty scene loading the plugin

    * compiler output

    * remove empty scene

commit 3eecf8f
Author: Alex Bilger <[email protected]>
Date:   Wed Jan 29 22:18:50 2025 +0100

    Bump version of Tracy from v0.9.1 to v0.11.1 (sofa-framework#5249)

commit 3659403
Author: Alex Bilger <[email protected]>
Date:   Wed Jan 29 21:39:51 2025 +0100

    [Core] Remove some static functions create (sofa-framework#5239)

commit 989a885
Author: Alex Bilger <[email protected]>
Date:   Wed Jan 29 21:03:59 2025 +0100

    [StateContainer] Extensive tests of MechanicalObject::vOp (sofa-framework#5233)

    * [StateContainer] Extensive tests of MechanicalObject::vOp

    * fix wrong name

    * fix test

    * Use variable for the coefficients

    * missing test

    * remove duplicated test

commit 38c295d
Author: Alex Bilger <[email protected]>
Date:   Wed Jan 29 19:54:39 2025 +0100

    [Playback] Remove deprecated macro (sofa-framework#5231)

commit ffddff7
Author: Paul Baksic <[email protected]>
Date:   Wed Jan 29 19:48:23 2025 +0100

    [CMake] Add possibility to remove auto installing of resource files (sofa-framework#5230)

    Add possibility to remove auto installing of ressource files

commit 7c6bddc
Author: Alex Bilger <[email protected]>
Date:   Fri Jan 24 14:24:02 2025 +0100

    [ODESolver] Remove repeated class name in log messages (sofa-framework#5242)
@epernod epernod deleted the inf_2025_01_triangleSegmentIntersection branch March 3, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new feature Implement a new feature pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants