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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

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

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 to review To notify reviewers to review this pull-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants