-
Notifications
You must be signed in to change notification settings - Fork 25
Add mesh patch splitting with default convex assumption and manual patch assignment #22
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
Add mesh patch splitting with default convex assumption and manual patch assignment #22
Conversation
Co-authored-by: Ruochun <24469442+Ruochun@users.noreply.github.com>
Co-authored-by: Ruochun <24469442+Ruochun@users.noreply.github.com>
Co-authored-by: Ruochun <24469442+Ruochun@users.noreply.github.com>
Co-authored-by: Ruochun <24469442+Ruochun@users.noreply.github.com>
|
@copilot One improvement needed: The default patch info should be present, and that should be "all mesh is one patch", aka we assume the mesh is convex if the user does not do anything. And we should allow a method to let the user manually supply patch info, as a vector of integers that manually specifies the patch ID for each triangle. |
Co-authored-by: Ruochun <24469442+Ruochun@users.noreply.github.com>
Implemented both improvements in commit 7b7b740:
The API now uses |
Implements region-growing algorithm to split
DEMMeshConnectedinto convex patches based on face normal angle thresholds. Patches enable future mesh-based contact force optimization.Changes
Core functionality (
src/DEM/MeshUtils.cpp)SplitIntoConvexPatches(angle_threshold_deg): Groups adjacent triangles with normals differing by less than thresholdSetPatchIDs(patch_ids): Allows manual specification of patch assignments for each triangleData model (
src/DEM/BdrsAndObjs.h)m_patch_ids: Per-triangle patch assignment (defaults to all 0s)num_patches: Total patch count (defaults to 1)patches_explicitly_set: Flag indicating if patches were explicitly set vs. using defaultGetPatchIDs(),GetNumPatches(),ArePatchesExplicitlySet()Clear()to reset patch data to defaultsTest demo (
src/demo/DEMdemo_MeshPatch.cpp)Usage
Default behavior (assumes convex mesh):
Automatic splitting:
Manual patch assignment:
Lower thresholds yield more patches (stricter convexity); higher thresholds yield fewer patches. Patches are non-overlapping and cover the entire mesh.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.