polyscope icon indicating copy to clipboard operation
polyscope copied to clipboard

Add corner scalar quantity, corner picker

Open nzfeng opened this issue 3 years ago • 4 comments

Add addCornerScalarQuantity() function, and expand the picker to include corners. A corner is picked if the user clicks within some radius of the corner's vertex (but further than the vertex's pick radius.) When a corner is picked, the corner info GUI pops up.

So far, no support for other corner quantities beyond scalar.

nzfeng avatar Mar 24 '22 17:03 nzfeng

Thank you for submitting this PR, it looks great!

I'm going to leave a few comments inline. If any requests are too much work, just let me know and I can make them myself at some point and push changes directly to your PR.

nmwsharp avatar Mar 25 '22 13:03 nmwsharp

Another wish-list request, could we add a simple test like this for corner data? https://github.com/nmwsharp/polyscope/blob/master/test/src/basics_test.cpp#L368

nmwsharp avatar Mar 25 '22 13:03 nmwsharp

Thank you for all the changes/additions!

It looks like there's one failure happening in the tests? I think it's because the volume mesh picking code also uses the same surface mesh shader; that shader now has an additional corner attribute, and the volume mesh code is not filling it out.

I think the fix is just to add a dummy buffer here https://github.com/nmwsharp/polyscope/blob/master/src/volume_mesh.cpp#L554 for corners of each face in the volume mesh; we can just populate it with the index for the vertex corresponding to that corner, since we don't track corners for volume meshes. A similar thing is already done with the halfedge index buffer there for the same reason.

nmwsharp avatar Apr 01 '22 15:04 nmwsharp

I hope that fixes it... thanks, Nick, for being patient with my first couple contributions to Polyscope :)

nzfeng avatar Apr 04 '22 21:04 nzfeng

Sorry for the delay getting this merged. This PR was quite out of date from the current main branch, so I made a new one here https://github.com/nmwsharp/polyscope/pull/209 and ported the changes forward.

There was one additional complication: with the extra parameter for the pick shader, we started hitting platform limits on number of attributes in an openGL vertex shader.... To work around this I set up an ugly hack that essentially shares edge/halfedge indices as one parameter. Maybe one day we can find a better solution, like separating the different pick elements out in to separate render passes or something.

Anyway, thank you for submitting this! I added you as a coauthor to the other PR so it's still associated with your code. Please follow-up if anything doesn't seem right.

nmwsharp avatar Mar 27 '23 06:03 nmwsharp

Seems good to me! Thanks for doing this! (Too bad shaders have limits on the number of attributes. But I suppose that it's a sign of Polyscope's ever-increasing maturity.)

nzfeng avatar Mar 28 '23 19:03 nzfeng