8000 removed face from halfedge by pca006132 · Pull Request #939 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

removed face from halfedge #939

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

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Conversation

pca006132
Copy link
Collaborator

Just some cleanup, I think we talked about face being redundant because we can just compute it from the index, so I took the time to remove it.

@@ -496,8 +498,9 @@ void Manifold::Impl::CreateHalfedges(const Vec<ivec3>& triVerts) {
if (h0.startVert != h1.endVert || h0.endVert != h1.startVert) break;
if (halfedge_[NextHalfedge(pair0)].endVert ==
halfedge_[NextHalfedge(pair1)].endVert) {
h0.face = -1;
h1.face = -1;
// FIXME: this actually does nothing
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an interesting one, I was trying to use a vector instead for this and was having weird issues. It turns out we declared h0 and h1 as Halfedge, so these assignments aren't doing anything. Changing them to Halfedge& breaks things, so I just commented them out for now.

Copy link
Owner

Choose a reason for hiding this comment

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

Ha, I think I put this in to try to debug something and then forgot about it. Let's remove.

@@ -78,13 +78,15 @@ size_t MeshBuilder::addHalfedge() {
return index;
}
halfedges.push_back({});
halfedgeToFace.push_back(0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Face index is needed in quickhull, so I keep a halfedgeToFace vector for that.

extrema = reduce(halfedge_.begin(), halfedge_.end(), extrema, Extrema());
#endif

for (size_t i = 0; i < halfedge_.size(); i++) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Simplified the code a bit as well. Was thinking about using pair iterators, but it is too much work. We don't need parallelization here anyway.

@pca006132 pca006132 requested a review from elalish September 18, 2024 16:54
Copy link
codecov bot commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 96.19048% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.45%. Comparing base (d437097) to head (40f7bb4).
Report is 98 commits behind head on master.

Files with missing lines Patch % Lines
src/manifold/src/quickhull.cpp 90.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
- Coverage   91.84%   88.45%   -3.39%     
==========================================
  Files          37       62      +25     
  Lines        4976     8650    +3674     
  Branches        0     1042    +1042     
==========================================
+ Hits         4570     7651    +3081     
- Misses        406      999     +593     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner
@elalish elalish left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup! I'm guessing this didn't make any noticeable speed change?

@@ -496,8 +498,9 @@ void Manifold::Impl::CreateHalfedges(const Vec<ivec3>& triVerts) {
if (h0.startVert != h1.endVert || h0.endVert != h1.startVert) break;
if (halfedge_[NextHalfedge(pair0)].endVert ==
halfedge_[NextHalfedge(pair1)].endVert) {
h0.face = -1;
h1.face = -1;
// FIXME: this actually does nothing
Copy link
Owner

Choose a reason for hiding this comment

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

Ha, I think I put this in to try to debug something and then forgot about it. Let's remove.

// if (halfedge_[pair0].face < 0) {
// halfedge_[pair0] = {-1, -1, -1, -1};
// halfedge_[pair1] = {-1, -1, -1, -1};
// } else {
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will remove tmr when I wake up.

8000
halfedges[index].face = index / 3;
}
// for (size_t index = 0; index < halfedges.size(); index++) {
// halfedges[index].face = index / 3;
Copy link
Owner

Choose a reason for hiding this comment

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

remove?

@pca006132
Copy link
Collaborator Author

Measurable overall, like 26k ms to 25k ms in total.

Another interesting idea: We don't really need both start and end vertex, as we can get the opposite one from the paired halfedge. The problem is whether or not it is worth the changes (less readable perhaps?) and uncertain performance implication (cache misses?).

@elalish
Copy link
Owner
elalish commented Sep 18, 2024

Yeah, I thought about that when I made Halfedge - I think it's worth leaving start and end in. It's also useful in other places, like the Boolean where the edges get created and operated on before they know what their pair is.

@pca006132 pca006132 merged commit fcc7075 into elalish:master Sep 19, 2024
22 checks passed
@pca006132 pca006132 deleted the halfedge-face branch September 19, 2024 02:07
@elalish elalish mentioned this pull request Nov 5, 2024
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.

2 participants
0