Skip to content

Fast mesh-to-mesh intersection and mesh self intersection without CGAL#2109

Merged
alecjacobson merged 7 commits intolibigl:mainfrom
vfonov:tri_tri_intersect
Mar 14, 2023
Merged

Fast mesh-to-mesh intersection and mesh self intersection without CGAL#2109
alecjacobson merged 7 commits intolibigl:mainfrom
vfonov:tri_tri_intersect

Conversation

@vfonov
Copy link
Copy Markdown
Contributor

@vfonov vfonov commented Oct 24, 2022

Added code for fast triangle-triangle intersection checking and function for fast detection of mesh self-intersections and mesh-to-mesh intersections without CGAL.

Triangle-triangle intersection code is based on https://github.com/erich666/jgt-code/blob/master/Volume_08/Number_1/Guigue2003/tri_tri_intersect.c

Functions for fast mesh self-intersection detection and mesh-mesh intrersections is using AABB and triangle-triangle intersection functions.

I added unit tests for mesh-mesh intersection and mesh-self intersection.
Also added two tutorial programs.

Checklist

  • All changes meet libigl style-guidelines.
  • Adds new .cpp file.
  • Adds corresponding unit test.
  • This is a minor change.

@vfonov
Copy link
Copy Markdown
Contributor Author

vfonov commented Nov 4, 2022

@alecjacobson Hello, is there I should do to make this pull request pass Windows build ?

@alecjacobson
Copy link
Copy Markdown
Contributor

Is it just timing out? I haven't seen this issue before. @jdumas do you recognize it?

@jdumas
Copy link
Copy Markdown
Collaborator

jdumas commented Nov 17, 2022

It may be just a transient issue. I've restarted the failed jobs, fingers crossed... If this happens repeatedly we'll need to investigate more closely.

@alecjacobson
Copy link
Copy Markdown
Contributor

alecjacobson commented Feb 5, 2023

Something seems seriously wrong on windows. It should not take 6 hours to build on windows. (using two make threads didn't help: #2163).

It seems like the tri_tri_intersect uses a lot of macros. I don't see why that's a problem but maybe there's something uniquely horrible happening on windows. Probably requires hopping on a windows machine to debug further.

@jdumas
Copy link
Copy Markdown
Collaborator

jdumas commented Feb 6, 2023

I don't see any reasons why those macros cannot be inline functions, or just regular functions anyway (I doubt it'll make a difference in perfs, but you'd need to measure).

In any case, if someone wants to spend time investigating slow compile times on MSVC, @aras-p has some cool blog posts about it here and there. One can also try the newer flag /timetrace.

@vfonov vfonov force-pushed the tri_tri_intersect branch from 862f54f to c183818 Compare March 3, 2023 19:50
@vfonov
Copy link
Copy Markdown
Contributor Author

vfonov commented Mar 3, 2023

I replaced macros with proper c++

@vfonov vfonov force-pushed the tri_tri_intersect branch from c183818 to dce9478 Compare March 3, 2023 19:56
@vfonov vfonov force-pushed the tri_tri_intersect branch from dce9478 to 24289b8 Compare March 3, 2023 20:53
Copy link
Copy Markdown
Contributor

@alecjacobson alecjacobson left a comment

Choose a reason for hiding this comment

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

This looks good but as a final thing I'd like to standardize the file/function names a bit.

  • file names Guigue2003_tri_tri_intersect.{h,cpp}tri_tri_intersect.{h,cpp} to match the functions within
  • include paper name for Guigue2003 in header.
  • fast_find_mesh_intersect (files and functions) → fast_find_intersections
  • fast_find_mesh_intersect (files and functions) → fast_find_self_intersections
  • tests/include/igl/XYZ.cpp [XYZ] should match the include/igl/XYZ function being tested.
  • 723_ShowSelfIntersections → - 723_FastFindSelfIntersections
  • 723_ShowIntersections → - 723_FastFindIntersections

Thanks!! This is a really cool thing and will be a great feature in the upcoming new release


/*
*
* C++ version based on the routines published in
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Might be worth mentioning that this code is under MIT license, according to this repository (and the original code can be grabbed from this folder, since the original web page shows a 404 error).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added a reference to the original repository and copy of the original license.

@vfonov vfonov force-pushed the tri_tri_intersect branch from 7b85470 to f77dacc Compare March 13, 2023 18:45
added reference to the original license for tri_tri_intersect
@vfonov vfonov force-pushed the tri_tri_intersect branch from f77dacc to 7d9e7ab Compare March 13, 2023 18:47
@vfonov
Copy link
Copy Markdown
Contributor Author

vfonov commented Mar 13, 2023

This looks good but as a final thing I'd like to standardize the file/function names a bit.

  • file names Guigue2003_tri_tri_intersect.{h,cpp}tri_tri_intersect.{h,cpp} to match the functions within
  • include paper name for Guigue2003 in header.
  • fast_find_mesh_intersect (files and functions) → fast_find_intersections
  • fast_find_mesh_intersect (files and functions) → fast_find_self_intersections
  • tests/include/igl/XYZ.cpp [XYZ] should match the include/igl/XYZ function being tested.
  • 723_ShowSelfIntersections → - 723_FastFindSelfIntersections
  • 723_ShowIntersections → - 723_FastFindIntersections

Thanks!! This is a really cool thing and will be a great feature in the upcoming new release

I implemented these changes in the last commit.

@alecjacobson alecjacobson merged commit 1d007f4 into libigl:main Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants