Skip to content

WIP: Improved Pbd Picking

Andrew Wilson requested to merge andrew.wilson/iMSTK:PbdElementPicking into master

Refactors picking first by removing PbdPickingCH and placing it directly in the interaction.

This is mainly because:

  • A CollisionHandler is an object that consumes collision data & resolves or sets up a system to resolve a collision. Picking is not doing this, in many modes I found collision to not even be used.

3 modes were introduced that I found useful.

  • PickVertex: Grabs all the vertices inside the picking object (most similar to current implementation).
  • PickElement: Grabs all the elements intersecting the picking object. Works well for coarse mesh.
  • PickPoint: Grabs an individual point on an element. Right now it grabs the deepest point in each intersecting element. Suitable for ray picking or nearest point picking.

This also introduces PbdBaryPointToPointConstraint. Which can constrain the distance between two points defined by barycentric coordinates from separate elements. This is not only useful for picking but can also be used for holding together a stitch.

Issues:

  • Ray picking: Ray picking is useful. ClothGrabExample implements its own picking but could be made to use PbdObjectPicking if it supported rays.
  • Nearest point on element picking: Nearest vertex picking or N nearest vertex didn't work so well. But picking the nearest point on an element should work (doing so within provided shape or a provided picking radius would be nice).

Note:

  • After these are more realized & we have time the common parts could be left in PbdObjectPicking whilst the various methods descend into composited objects.
Edited by Andrew Wilson

Merge request reports